Sha256: 0060e1e2a5201dbbae68c26c200a70fd432dd9d20d73cb94f8b11c9fe3b8b58d

Contents?: true

Size: 1.82 KB

Versions: 15

Compression:

Stored size: 1.82 KB

Contents

/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
/************************************************

  rbgdkinput.c -

  $Author: sakai $
  $Date: 2007/07/08 03:00:50 $

  Copyright (C) 2002,2003 Masao Mutoh

  This file is devided from rbgtkmain.c.
  rbgtkmain.c -
  Copyright (C) 1998-2000 Yukihiro Matsumoto,
                          Daisuke Kanda,
                          Hiroshi Igarashi
************************************************/

#include "global.h"

static void
exec_input(data, source, condition)
    gpointer data;
    gint source;
    GdkInputCondition condition;
{
    rb_funcall((VALUE)data, id_call, 1, 
               GFLAGS2RVAL(condition, GDK_TYPE_INPUT_CONDITION));
}

static VALUE
input_add(self, filedescriptor, gdk_input_condition)
    VALUE self, filedescriptor, gdk_input_condition;
{
    VALUE id;
    VALUE func;

    func = rb_block_proc();
    id = INT2FIX(gdk_input_add(NUM2INT(rb_funcall(filedescriptor,
                                                  rb_intern("to_i"), 0)),
                               RVAL2GFLAGS(gdk_input_condition, GDK_TYPE_INPUT_CONDITION),
                               (GdkInputFunction)exec_input,
                               (gpointer)func));
    G_RELATIVE2(self, func, id_relative_callbacks, id);
    return id;
}

static VALUE
input_remove(self, id)
    VALUE self, id;
{
    gdk_input_remove(NUM2INT(id));
    G_REMOVE_RELATIVE(self, id_relative_callbacks, id);
    return id;
}


void
Init_gtk_gdk_input()
{
    VALUE mGdkInput = rb_define_module_under(mGdk, "Input");

    rb_define_module_function(mGdkInput, "add", input_add, 2);
    rb_define_module_function(mGdkInput, "remove", input_remove, 1);

    /* GdkInputCondition */
    G_DEF_CLASS(GDK_TYPE_INPUT_CONDITION, "Condition", mGdkInput);
    G_DEF_CONSTANTS(mGdkInput, GDK_TYPE_INPUT_CONDITION, "GDK_INPUT_");

}

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
gtk2-0.90.7-x86-mingw32 ext/gtk2/rbgdkinput.c
gtk2-0.90.7 ext/gtk2/rbgdkinput.c
gtk2-0.90.6 ext/gtk2/rbgdkinput.c
gtk2-0.90.6-x86-mingw32 ext/gtk2/rbgdkinput.c
gtk2-0.90.5 ext/gtk2/rbgdkinput.c
gtk2-0.90.5-x86-mingw32 ext/gtk2/rbgdkinput.c
gtk2-0.90.4 ext/gtk2/rbgdkinput.c
gtk2-0.90.4-x86-mingw32 ext/gtk2/rbgdkinput.c
gtk2-0.90.3 ext/gtk2/rbgdkinput.c
gtk2-0.90.3-x86-mingw32 ext/gtk2/rbgdkinput.c
gtk2-0.90.2 ext/gtk2/rbgdkinput.c
gtk2-0.90.2-x86-mingw32 ext/gtk2/rbgdkinput.c
gtk2-0.20.1 src/rbgdkinput.c
gtk2-0.20.0.1 src/rbgdkinput.c
gtk2-0.20.0 src/rbgdkinput.c