gtk2 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +66 -1
- data/ext/gtk2/extconf.rb +0 -96
- data/ext/gtk2/global.h +274 -13
- data/ext/gtk2/gtk2.def +5 -3
- data/ext/gtk2/init.c +263 -19
- data/ext/gtk2/rbgdk.c +245 -89
- data/ext/gtk2/rbgdk.h +32 -6
- data/ext/gtk2/rbgdkatom.c +38 -28
- data/ext/gtk2/rbgdkcairo.c +32 -42
- data/ext/gtk2/rbgdkcolor.c +52 -42
- data/ext/gtk2/rbgdkcolormap.c +42 -37
- data/ext/gtk2/rbgdkconst.c +23 -13
- data/ext/gtk2/rbgdkconversions.h +19 -6
- data/ext/gtk2/rbgdkcursor.c +37 -25
- data/ext/gtk2/rbgdkdevice.c +77 -67
- data/ext/gtk2/rbgdkdisplay.c +158 -150
- data/ext/gtk2/rbgdkdisplaymanager.c +27 -15
- data/ext/gtk2/rbgdkdragcontext.c +121 -70
- data/ext/gtk2/rbgdkdraw.c +252 -160
- data/ext/gtk2/rbgdkevent.c +30 -20
- data/ext/gtk2/rbgdkgc.c +123 -116
- data/ext/gtk2/rbgdkgeometry.c +77 -68
- data/ext/gtk2/rbgdkimage.c +58 -47
- data/ext/gtk2/rbgdkinput.c +33 -26
- data/ext/gtk2/rbgdkkeymap.c +38 -27
- data/ext/gtk2/rbgdkkeyval.c +44 -32
- data/ext/gtk2/rbgdkpango.c +66 -39
- data/ext/gtk2/rbgdkpangorenderer.c +63 -35
- data/ext/gtk2/rbgdkpixbuf.c +36 -25
- data/ext/gtk2/rbgdkpixmap.c +65 -49
- data/ext/gtk2/rbgdkproperty.c +66 -60
- data/ext/gtk2/rbgdkrectangle.c +54 -46
- data/ext/gtk2/rbgdkregion.c +144 -79
- data/ext/gtk2/rbgdkrgb.c +74 -58
- data/ext/gtk2/rbgdkscreen.c +103 -97
- data/ext/gtk2/rbgdkselection.c +49 -39
- data/ext/gtk2/rbgdkthreads.c +32 -19
- data/ext/gtk2/rbgdktimecoord.c +60 -38
- data/ext/gtk2/rbgdkvisual.c +79 -71
- data/ext/gtk2/rbgdkwindow.c +284 -305
- data/ext/gtk2/rbgdkwindowattr.c +69 -58
- data/ext/gtk2/rbgdkx11.c +41 -28
- data/ext/gtk2/rbgtk.c +498 -19
- data/ext/gtk2/rbgtk.h +35 -20
- data/ext/gtk2/rbgtkaboutdialog.c +33 -80
- data/ext/gtk2/rbgtkaccelerator.c +36 -23
- data/ext/gtk2/rbgtkaccelgroup.c +50 -40
- data/ext/gtk2/rbgtkaccelgroupentry.c +32 -20
- data/ext/gtk2/rbgtkaccelkey.c +40 -28
- data/ext/gtk2/rbgtkaccellabel.c +30 -18
- data/ext/gtk2/rbgtkaccelmap.c +55 -42
- data/ext/gtk2/rbgtkaccessible.c +25 -14
- data/ext/gtk2/rbgtkaction.c +68 -68
- data/ext/gtk2/rbgtkactiongroup.c +317 -195
- data/ext/gtk2/rbgtkadjustment.c +33 -46
- data/ext/gtk2/rbgtkalignment.c +36 -24
- data/ext/gtk2/rbgtkallocation.c +53 -42
- data/ext/gtk2/rbgtkarrow.c +34 -22
- data/ext/gtk2/rbgtkaspectframe.c +32 -20
- data/ext/gtk2/rbgtkassistant.c +81 -61
- data/ext/gtk2/rbgtkbbox.c +32 -20
- data/ext/gtk2/rbgtkbin.c +28 -16
- data/ext/gtk2/rbgtkbindingset.c +42 -35
- data/ext/gtk2/rbgtkborder.c +34 -23
- data/ext/gtk2/rbgtkbox.c +40 -29
- data/ext/gtk2/rbgtkbuildable.c +57 -45
- data/ext/gtk2/rbgtkbuilder.c +53 -38
- data/ext/gtk2/rbgtkbutton.c +41 -55
- data/ext/gtk2/rbgtkcalendar.c +51 -40
- data/ext/gtk2/rbgtkcelleditable.c +28 -17
- data/ext/gtk2/rbgtkcelllayout.c +41 -30
- data/ext/gtk2/rbgtkcellrenderer.c +43 -32
- data/ext/gtk2/rbgtkcellrendereraccel.c +26 -18
- data/ext/gtk2/rbgtkcellrenderercombo.c +25 -17
- data/ext/gtk2/rbgtkcellrendererpixbuf.c +24 -17
- data/ext/gtk2/rbgtkcellrendererprogress.c +25 -17
- data/ext/gtk2/rbgtkcellrendererspin.c +24 -16
- data/ext/gtk2/rbgtkcellrendererspinner.c +23 -11
- data/ext/gtk2/rbgtkcellrenderertext.c +28 -21
- data/ext/gtk2/rbgtkcellrenderertoggle.c +24 -16
- data/ext/gtk2/rbgtkcellview.c +34 -33
- data/ext/gtk2/rbgtkcheckbutton.c +28 -16
- data/ext/gtk2/rbgtkcheckmenuitem.c +31 -19
- data/ext/gtk2/rbgtkclipboard.c +123 -77
- data/ext/gtk2/rbgtkcolorbutton.c +26 -31
- data/ext/gtk2/rbgtkcolorsel.c +109 -55
- data/ext/gtk2/rbgtkcolorselectiondialog.c +28 -19
- data/ext/gtk2/rbgtkcombo.c +43 -32
- data/ext/gtk2/rbgtkcombobox.c +44 -83
- data/ext/gtk2/rbgtkcomboboxentry.c +26 -21
- data/ext/gtk2/rbgtkconst.c +23 -13
- data/ext/gtk2/rbgtkcontainer.c +153 -100
- data/ext/gtk2/rbgtkconversions.h +19 -6
- data/ext/gtk2/rbgtkcurve.c +46 -36
- data/ext/gtk2/rbgtkdialog.c +104 -70
- data/ext/gtk2/rbgtkdrag.c +173 -121
- data/ext/gtk2/rbgtkdrawingarea.c +28 -16
- data/ext/gtk2/rbgtkeditable.c +63 -51
- data/ext/gtk2/rbgtkentry.c +48 -85
- data/ext/gtk2/rbgtkentrycompletion.c +42 -55
- data/ext/gtk2/rbgtkeventbox.c +28 -16
- data/ext/gtk2/rbgtkexpander.c +26 -35
- data/ext/gtk2/rbgtkfilechooser.c +87 -143
- data/ext/gtk2/rbgtkfilechooserbutton.c +26 -32
- data/ext/gtk2/rbgtkfilechooserdialog.c +25 -15
- data/ext/gtk2/rbgtkfilechooserwidget.c +26 -15
- data/ext/gtk2/rbgtkfilefilter.c +45 -35
- data/ext/gtk2/rbgtkfilesel.c +54 -43
- data/ext/gtk2/rbgtkfilesystemerror.c +51 -0
- data/ext/gtk2/rbgtkfixed.c +36 -25
- data/ext/gtk2/rbgtkfontbutton.c +26 -37
- data/ext/gtk2/rbgtkfontselection.c +27 -15
- data/ext/gtk2/rbgtkfontselectiondialog.c +43 -32
- data/ext/gtk2/rbgtkframe.c +39 -28
- data/ext/gtk2/rbgtkgamma.c +32 -20
- data/ext/gtk2/rbgtkhandlebox.c +31 -19
- data/ext/gtk2/rbgtkhbbox.c +28 -16
- data/ext/gtk2/rbgtkhbox.c +29 -17
- data/ext/gtk2/rbgtkhpaned.c +28 -16
- data/ext/gtk2/rbgtkhruler.c +28 -16
- data/ext/gtk2/rbgtkhscale.c +28 -16
- data/ext/gtk2/rbgtkhscrollbar.c +28 -16
- data/ext/gtk2/rbgtkhseparator.c +28 -16
- data/ext/gtk2/rbgtkiconfactory.c +35 -23
- data/ext/gtk2/rbgtkiconinfo.c +42 -30
- data/ext/gtk2/rbgtkiconset.c +31 -19
- data/ext/gtk2/rbgtkiconsize.c +38 -25
- data/ext/gtk2/rbgtkiconsource.c +62 -50
- data/ext/gtk2/rbgtkicontheme.c +95 -95
- data/ext/gtk2/rbgtkiconview.c +87 -121
- data/ext/gtk2/rbgtkimage.c +31 -40
- data/ext/gtk2/rbgtkimagemenuitem.c +26 -14
- data/ext/gtk2/rbgtkimcontext.c +46 -34
- data/ext/gtk2/rbgtkimcontextsimple.c +47 -24
- data/ext/gtk2/rbgtkimmulticontext.c +26 -14
- data/ext/gtk2/rbgtkinputdialog.c +28 -16
- data/ext/gtk2/rbgtkinvisible.c +24 -18
- data/ext/gtk2/rbgtkitem.c +32 -20
- data/ext/gtk2/rbgtkitemfactory.c +65 -57
- data/ext/gtk2/rbgtklabel.c +46 -57
- data/ext/gtk2/rbgtklayout.c +40 -29
- data/ext/gtk2/rbgtklinkbutton.c +26 -15
- data/ext/gtk2/rbgtkliststore.c +145 -102
- data/ext/gtk2/rbgtkmacros.h +19 -6
- data/ext/gtk2/rbgtkmenu.c +47 -59
- data/ext/gtk2/rbgtkmenubar.c +30 -30
- data/ext/gtk2/rbgtkmenuitem.c +34 -41
- data/ext/gtk2/rbgtkmenushell.c +43 -42
- data/ext/gtk2/rbgtkmenutoolbutton.c +27 -16
- data/ext/gtk2/rbgtkmessagedialog.c +31 -25
- data/ext/gtk2/rbgtkmisc.c +33 -22
- data/ext/gtk2/rbgtknotebook.c +98 -134
- data/ext/gtk2/rbgtkobject.c +46 -81
- data/ext/gtk2/rbgtkoptionmenu.c +35 -23
- data/ext/gtk2/rbgtkpagesetup.c +64 -54
- data/ext/gtk2/rbgtkpagesetupunixdialog.c +34 -27
- data/ext/gtk2/rbgtkpaned.c +46 -36
- data/ext/gtk2/rbgtkpapersize.c +60 -54
- data/ext/gtk2/rbgtkplug.c +32 -20
- data/ext/gtk2/rbgtkprintcontext.c +43 -35
- data/ext/gtk2/rbgtkprinter.c +36 -37
- data/ext/gtk2/rbgtkprintjob.c +36 -37
- data/ext/gtk2/rbgtkprintoperation.c +44 -33
- data/ext/gtk2/rbgtkprintoperationpreview.c +30 -18
- data/ext/gtk2/rbgtkprintsettings.c +248 -192
- data/ext/gtk2/rbgtkprintunixdialog.c +33 -45
- data/ext/gtk2/rbgtkprogress.c +23 -13
- data/ext/gtk2/rbgtkprogressbar.c +47 -46
- data/ext/gtk2/rbgtkradioaction.c +84 -39
- data/ext/gtk2/rbgtkradiobutton.c +33 -21
- data/ext/gtk2/rbgtkradiomenuitem.c +86 -45
- data/ext/gtk2/rbgtkradiotoolbutton.c +99 -53
- data/ext/gtk2/rbgtkrange.c +36 -56
- data/ext/gtk2/rbgtkrc.c +61 -49
- data/ext/gtk2/rbgtkrcstyle.c +59 -48
- data/ext/gtk2/rbgtkrecentaction.c +28 -16
- data/ext/gtk2/rbgtkrecentchooser.c +58 -92
- data/ext/gtk2/rbgtkrecentchooserdialog.c +29 -18
- data/ext/gtk2/rbgtkrecentchoosermenu.c +25 -21
- data/ext/gtk2/rbgtkrecentchooserwidget.c +24 -13
- data/ext/gtk2/rbgtkrecentdata.c +47 -36
- data/ext/gtk2/rbgtkrecentfilter.c +55 -46
- data/ext/gtk2/rbgtkrecentfilterinfo.c +51 -40
- data/ext/gtk2/rbgtkrecentinfo.c +66 -56
- data/ext/gtk2/rbgtkrecentmanager.c +47 -43
- data/ext/gtk2/rbgtkruler.c +35 -30
- data/ext/gtk2/rbgtkscale.c +29 -18
- data/ext/gtk2/rbgtkscalebutton.c +27 -27
- data/ext/gtk2/rbgtkscrollbar.c +23 -13
- data/ext/gtk2/rbgtkscrolledwindow.c +44 -60
- data/ext/gtk2/rbgtkselection.c +87 -67
- data/ext/gtk2/rbgtkselectiondata.c +74 -65
- data/ext/gtk2/rbgtkseparator.c +23 -13
- data/ext/gtk2/rbgtkseparatormenuitem.c +25 -13
- data/ext/gtk2/rbgtkseparatortoolitem.c +26 -21
- data/ext/gtk2/rbgtksettings.c +123 -103
- data/ext/gtk2/rbgtksizegroup.c +33 -30
- data/ext/gtk2/rbgtksocket.c +32 -20
- data/ext/gtk2/rbgtkspinbutton.c +48 -38
- data/ext/gtk2/rbgtkspinner.c +27 -14
- data/ext/gtk2/rbgtkstatusbar.c +36 -31
- data/ext/gtk2/rbgtkstatusicon.c +31 -44
- data/ext/gtk2/rbgtkstock.c +137 -125
- data/ext/gtk2/rbgtkstyle.c +177 -161
- data/ext/gtk2/rbgtktable.c +58 -47
- data/ext/gtk2/rbgtktargetlist.c +56 -36
- data/ext/gtk2/rbgtktearoffmenuitem.c +28 -16
- data/ext/gtk2/rbgtktextappearance.c +44 -34
- data/ext/gtk2/rbgtktextattributes.c +54 -42
- data/ext/gtk2/rbgtktextbuffer.c +188 -191
- data/ext/gtk2/rbgtktextchild.c +29 -18
- data/ext/gtk2/rbgtktextiter.c +153 -145
- data/ext/gtk2/rbgtktextmark.c +33 -30
- data/ext/gtk2/rbgtktexttag.c +34 -22
- data/ext/gtk2/rbgtktexttagtable.c +36 -25
- data/ext/gtk2/rbgtktextview.c +85 -73
- data/ext/gtk2/rbgtktoggleaction.c +27 -22
- data/ext/gtk2/rbgtktogglebutton.c +37 -26
- data/ext/gtk2/rbgtktoggletoolbutton.c +26 -20
- data/ext/gtk2/rbgtktoolbar.c +66 -69
- data/ext/gtk2/rbgtktoolbutton.c +27 -40
- data/ext/gtk2/rbgtktoolitem.c +60 -62
- data/ext/gtk2/rbgtktooltip.c +36 -25
- data/ext/gtk2/rbgtktooltips.c +42 -34
- data/ext/gtk2/rbgtktreedragdest.c +20 -11
- data/ext/gtk2/rbgtktreedragsource.c +20 -11
- data/ext/gtk2/rbgtktreeiter.c +58 -47
- data/ext/gtk2/rbgtktreemodel.c +83 -65
- data/ext/gtk2/rbgtktreemodelfilter.c +47 -35
- data/ext/gtk2/rbgtktreemodelsort.c +38 -27
- data/ext/gtk2/rbgtktreepath.c +55 -44
- data/ext/gtk2/rbgtktreerowreference.c +60 -42
- data/ext/gtk2/rbgtktreeselection.c +61 -52
- data/ext/gtk2/rbgtktreesortable.c +52 -42
- data/ext/gtk2/rbgtktreestore.c +88 -67
- data/ext/gtk2/rbgtktreeview.c +157 -185
- data/ext/gtk2/rbgtktreeviewcolumn.c +57 -62
- data/ext/gtk2/rbgtkuimanager.c +61 -61
- data/ext/gtk2/rbgtkvbbox.c +28 -16
- data/ext/gtk2/rbgtkvbox.c +29 -17
- data/ext/gtk2/rbgtkviewport.c +28 -16
- data/ext/gtk2/rbgtkvolumebutton.c +28 -16
- data/ext/gtk2/rbgtkvpaned.c +28 -16
- data/ext/gtk2/rbgtkvruler.c +28 -16
- data/ext/gtk2/rbgtkvscale.c +28 -16
- data/ext/gtk2/rbgtkvscrollbar.c +28 -16
- data/ext/gtk2/rbgtkvseparator.c +28 -16
- data/ext/gtk2/rbgtkwidget.c +284 -296
- data/ext/gtk2/rbgtkwindow.c +156 -214
- data/ext/gtk2/rbgtkwindowgroup.c +35 -24
- data/sample/testgtk/labels.rb +1 -0
- data/sample/testgtk/testgtk.rb +2 -0
- metadata +16 -17
- data/ChangeLog +0 -6902
- data/ext/gtk2/rbgtkmain.c +0 -493
data/ext/gtk2/rbgtkmain.c
DELETED
@@ -1,493 +0,0 @@
|
|
1
|
-
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
-
/************************************************
|
3
|
-
|
4
|
-
rbgtkmain.c -
|
5
|
-
|
6
|
-
$Author: ggc $
|
7
|
-
$Date: 2007/07/13 16:07:31 $
|
8
|
-
|
9
|
-
Copyright (C) 2002,2003, 2009 Ruby-GNOME2 Project Team
|
10
|
-
Copyright (C) 1998-2000 Yukihiro Matsumoto,
|
11
|
-
Daisuke Kanda,
|
12
|
-
Hiroshi Igarashi
|
13
|
-
************************************************/
|
14
|
-
#include "global.h"
|
15
|
-
#include <locale.h>
|
16
|
-
|
17
|
-
static VALUE rbgtk_eGtkInitError;
|
18
|
-
|
19
|
-
static ID id__quit_callbacks__, id__timeout_callbacks__;
|
20
|
-
static ID id__idle_callbacks__, id__snooper_callbacks__;
|
21
|
-
|
22
|
-
|
23
|
-
typedef struct _callback_info_t
|
24
|
-
{
|
25
|
-
VALUE callback;
|
26
|
-
ID key;
|
27
|
-
guint id;
|
28
|
-
} callback_info_t;
|
29
|
-
|
30
|
-
|
31
|
-
static VALUE
|
32
|
-
gtk_m_function_body(VALUE data)
|
33
|
-
{
|
34
|
-
callback_info_t *info = (callback_info_t *)data;
|
35
|
-
VALUE ret = rb_funcall(info->callback, id_call, 0);
|
36
|
-
|
37
|
-
if (info->key && !ret)
|
38
|
-
G_REMOVE_RELATIVE(mGtk, info->key, UINT2NUM(info->id));
|
39
|
-
return ret;
|
40
|
-
}
|
41
|
-
|
42
|
-
static gboolean
|
43
|
-
gtk_m_function(gpointer data)
|
44
|
-
{
|
45
|
-
return RVAL2CBOOL(G_PROTECT_CALLBACK(gtk_m_function_body, data));
|
46
|
-
}
|
47
|
-
|
48
|
-
static VALUE
|
49
|
-
gtk_m_function2_body(gpointer proc)
|
50
|
-
{
|
51
|
-
rb_funcall((VALUE)proc, id_call, 0);
|
52
|
-
return Qnil;
|
53
|
-
}
|
54
|
-
|
55
|
-
static void
|
56
|
-
gtk_m_function2(gpointer proc)
|
57
|
-
{
|
58
|
-
G_PROTECT_CALLBACK(gtk_m_function2_body, proc);
|
59
|
-
}
|
60
|
-
|
61
|
-
|
62
|
-
static VALUE
|
63
|
-
gtk_m_set_locale(VALUE self)
|
64
|
-
{
|
65
|
-
return CSTR2RVAL(gtk_set_locale());
|
66
|
-
}
|
67
|
-
|
68
|
-
static VALUE
|
69
|
-
gtk_m_disable_setlocale(VALUE self)
|
70
|
-
{
|
71
|
-
gtk_disable_setlocale();
|
72
|
-
return Qnil;
|
73
|
-
}
|
74
|
-
|
75
|
-
static VALUE
|
76
|
-
gtk_m_get_default_language(VALUE self)
|
77
|
-
{
|
78
|
-
return BOXED2RVAL(gtk_get_default_language(), PANGO_TYPE_LANGUAGE);
|
79
|
-
}
|
80
|
-
|
81
|
-
typedef void (*SignalFunc) (int);
|
82
|
-
|
83
|
-
static gboolean _initialized = FALSE;
|
84
|
-
|
85
|
-
static VALUE
|
86
|
-
gtk_m_init(int argc, VALUE *argv, VALUE self)
|
87
|
-
{
|
88
|
-
gint i, gargc;
|
89
|
-
VALUE argary;
|
90
|
-
char** gargv;
|
91
|
-
VALUE progname;
|
92
|
-
|
93
|
-
if (_initialized)
|
94
|
-
return self;
|
95
|
-
else
|
96
|
-
_initialized = TRUE;
|
97
|
-
|
98
|
-
rb_scan_args(argc, argv, "01", &argary);
|
99
|
-
|
100
|
-
if (NIL_P(argary)){
|
101
|
-
argary = rb_const_get(rb_cObject, rb_intern("ARGV"));
|
102
|
-
gargc = RARRAY_LEN(argary);
|
103
|
-
} else {
|
104
|
-
Check_Type(argary, T_ARRAY);
|
105
|
-
gargc = RARRAY_LEN(argary);
|
106
|
-
}
|
107
|
-
|
108
|
-
gargv = ALLOCA_N(char *, gargc + 1);
|
109
|
-
progname = rb_gv_get("$0");
|
110
|
-
gargv[0] = (char *)RVAL2CSTR(progname);
|
111
|
-
|
112
|
-
for (i = 0; i < gargc; i++)
|
113
|
-
if (TYPE(RARRAY_PTR(argary)[i]) == T_STRING)
|
114
|
-
gargv[i+1] = (char *)RVAL2CSTR(RARRAY_PTR(argary)[i]);
|
115
|
-
else
|
116
|
-
gargv[i+1] = (char *)"";
|
117
|
-
gargc++;
|
118
|
-
|
119
|
-
{
|
120
|
-
gboolean is_initialized;
|
121
|
-
/* Gdk modifies sighandlers, sigh */
|
122
|
-
#ifdef NT
|
123
|
-
RETSIGTYPE (*sigfunc[3])();
|
124
|
-
#else
|
125
|
-
RETSIGTYPE (*sigfunc[7])();
|
126
|
-
#endif
|
127
|
-
|
128
|
-
#ifdef NT
|
129
|
-
sigfunc[0] = signal(SIGINT, SIG_IGN);
|
130
|
-
sigfunc[1] = signal(SIGSEGV, SIG_IGN);
|
131
|
-
sigfunc[2] = signal(SIGTERM, SIG_IGN);
|
132
|
-
#else
|
133
|
-
sigfunc[0] = signal(SIGHUP, SIG_IGN);
|
134
|
-
sigfunc[1] = signal(SIGINT, SIG_IGN);
|
135
|
-
sigfunc[2] = signal(SIGQUIT, SIG_IGN);
|
136
|
-
sigfunc[3] = signal(SIGBUS, SIG_IGN);
|
137
|
-
sigfunc[4] = signal(SIGSEGV, SIG_IGN);
|
138
|
-
sigfunc[5] = signal(SIGPIPE, SIG_IGN);
|
139
|
-
sigfunc[6] = signal(SIGTERM, SIG_IGN);
|
140
|
-
#endif
|
141
|
-
|
142
|
-
is_initialized = gtk_init_check(&gargc, &gargv);
|
143
|
-
if (! is_initialized) {
|
144
|
-
const char *display_name_arg = gdk_get_display_arg_name();
|
145
|
-
display_name_arg = display_name_arg ? display_name_arg : g_getenv("DISPLAY");
|
146
|
-
rb_raise(rbgtk_eGtkInitError, "Cannot open display: %s",
|
147
|
-
display_name_arg ? display_name_arg : " ");
|
148
|
-
}
|
149
|
-
|
150
|
-
setlocale(LC_NUMERIC, "C");
|
151
|
-
|
152
|
-
#ifdef NT
|
153
|
-
signal(SIGINT, (SignalFunc)sigfunc[0]);
|
154
|
-
signal(SIGSEGV, (SignalFunc)sigfunc[1]);
|
155
|
-
signal(SIGTERM, (SignalFunc)sigfunc[2]);
|
156
|
-
#else
|
157
|
-
signal(SIGHUP, sigfunc[0]);
|
158
|
-
signal(SIGINT, sigfunc[1]);
|
159
|
-
signal(SIGQUIT, sigfunc[2]);
|
160
|
-
signal(SIGBUS, sigfunc[3]);
|
161
|
-
signal(SIGSEGV, sigfunc[4]);
|
162
|
-
signal(SIGPIPE, sigfunc[5]);
|
163
|
-
signal(SIGTERM, sigfunc[6]);
|
164
|
-
#endif
|
165
|
-
}
|
166
|
-
|
167
|
-
return self;
|
168
|
-
}
|
169
|
-
|
170
|
-
/* We don't need them.
|
171
|
-
gtk_init()
|
172
|
-
gtk_exit()
|
173
|
-
*/
|
174
|
-
|
175
|
-
static VALUE
|
176
|
-
gtk_m_main(VALUE self)
|
177
|
-
{
|
178
|
-
gtk_main();
|
179
|
-
return Qnil;
|
180
|
-
}
|
181
|
-
|
182
|
-
static VALUE
|
183
|
-
gtk_m_main_level(VALUE self)
|
184
|
-
{
|
185
|
-
return INT2FIX(gtk_main_level());
|
186
|
-
}
|
187
|
-
|
188
|
-
static VALUE
|
189
|
-
gtk_m_main_quit(VALUE self)
|
190
|
-
{
|
191
|
-
gtk_main_quit();
|
192
|
-
return Qnil;
|
193
|
-
}
|
194
|
-
|
195
|
-
static VALUE
|
196
|
-
gtk_m_main_iteration(VALUE self)
|
197
|
-
{
|
198
|
-
return CBOOL2RVAL(gtk_main_iteration());
|
199
|
-
}
|
200
|
-
|
201
|
-
static VALUE
|
202
|
-
gtk_m_main_iteration_do(VALUE self, VALUE blocking)
|
203
|
-
{
|
204
|
-
return CBOOL2RVAL(gtk_main_iteration_do(RVAL2CBOOL(blocking)));
|
205
|
-
}
|
206
|
-
|
207
|
-
static VALUE
|
208
|
-
gtk_m_main_do_event(VALUE self, VALUE event)
|
209
|
-
{
|
210
|
-
gtk_main_do_event(RVAL2GEV(event));
|
211
|
-
return event;
|
212
|
-
}
|
213
|
-
|
214
|
-
/* We don't need them.
|
215
|
-
gtk_true()
|
216
|
-
gtk_false()
|
217
|
-
*/
|
218
|
-
|
219
|
-
static VALUE
|
220
|
-
gtk_m_grab_add(VALUE self, VALUE widget)
|
221
|
-
{
|
222
|
-
gtk_grab_add(GTK_WIDGET(RVAL2GOBJ(widget)));
|
223
|
-
return Qnil;
|
224
|
-
}
|
225
|
-
|
226
|
-
static VALUE
|
227
|
-
gtk_m_get_current(VALUE self)
|
228
|
-
{
|
229
|
-
return GOBJ2RVAL(gtk_grab_get_current());
|
230
|
-
}
|
231
|
-
|
232
|
-
static VALUE
|
233
|
-
gtk_m_grab_remove(VALUE self, VALUE widget)
|
234
|
-
{
|
235
|
-
gtk_grab_remove(GTK_WIDGET(RVAL2GOBJ(widget)));
|
236
|
-
return Qnil;
|
237
|
-
}
|
238
|
-
|
239
|
-
static VALUE
|
240
|
-
gtk_m_init_add(VALUE self)
|
241
|
-
{
|
242
|
-
volatile VALUE func = rb_block_proc();
|
243
|
-
|
244
|
-
gtk_init_add((GtkFunction)gtk_m_function2, (gpointer)func);
|
245
|
-
G_RELATIVE(self, func);
|
246
|
-
return Qnil;
|
247
|
-
}
|
248
|
-
|
249
|
-
static VALUE
|
250
|
-
gtk_m_quit_add(VALUE self, VALUE main_level)
|
251
|
-
{
|
252
|
-
volatile VALUE func = rb_block_proc();
|
253
|
-
VALUE rb_id;
|
254
|
-
callback_info_t *info;
|
255
|
-
guint id;
|
256
|
-
|
257
|
-
info = ALLOC(callback_info_t);
|
258
|
-
info->callback = func;
|
259
|
-
info->key = id_relative_callbacks;
|
260
|
-
id = gtk_quit_add_full(NUM2UINT(main_level), (GtkFunction)gtk_m_function,
|
261
|
-
NULL, (gpointer)info, g_free);
|
262
|
-
info->id = id;
|
263
|
-
rb_id = UINT2NUM(id);
|
264
|
-
G_RELATIVE2(self, func, id__quit_callbacks__, rb_id);
|
265
|
-
return rb_id;
|
266
|
-
}
|
267
|
-
|
268
|
-
static VALUE
|
269
|
-
gtk_m_quit_remove(VALUE self, VALUE quit_handler_id)
|
270
|
-
{
|
271
|
-
gtk_quit_remove(NUM2UINT(quit_handler_id));
|
272
|
-
G_REMOVE_RELATIVE(self, id__quit_callbacks__, quit_handler_id);
|
273
|
-
return quit_handler_id;
|
274
|
-
}
|
275
|
-
|
276
|
-
/* We don't need this.
|
277
|
-
gtk_quit_add_full ()
|
278
|
-
gtk_quit_add_destroy()
|
279
|
-
gtk_quit_remove_by_data()
|
280
|
-
gtk_timeout_add_full()
|
281
|
-
*/
|
282
|
-
|
283
|
-
static VALUE
|
284
|
-
timeout_add(VALUE self, VALUE interval)
|
285
|
-
{
|
286
|
-
VALUE func, rb_id;
|
287
|
-
callback_info_t *info;
|
288
|
-
guint id;
|
289
|
-
|
290
|
-
func = rb_block_proc();
|
291
|
-
info = ALLOC(callback_info_t);
|
292
|
-
info->callback = func;
|
293
|
-
info->key = id__timeout_callbacks__;
|
294
|
-
id = gtk_timeout_add_full(NUM2UINT(interval), (GtkFunction)gtk_m_function,
|
295
|
-
NULL, (gpointer)info, g_free);
|
296
|
-
info->id = id;
|
297
|
-
rb_id = UINT2NUM(id);
|
298
|
-
G_RELATIVE2(self, func, id__timeout_callbacks__, rb_id);
|
299
|
-
return rb_id;
|
300
|
-
}
|
301
|
-
|
302
|
-
static VALUE
|
303
|
-
timeout_remove(VALUE self, VALUE id)
|
304
|
-
{
|
305
|
-
gtk_timeout_remove(NUM2UINT(id));
|
306
|
-
G_REMOVE_RELATIVE(self, id__timeout_callbacks__, id);
|
307
|
-
return Qnil;
|
308
|
-
}
|
309
|
-
|
310
|
-
static VALUE
|
311
|
-
idle_add(VALUE self)
|
312
|
-
{
|
313
|
-
VALUE func, rb_id;
|
314
|
-
callback_info_t *info;
|
315
|
-
guint id;
|
316
|
-
|
317
|
-
func = rb_block_proc();
|
318
|
-
info = ALLOC(callback_info_t);
|
319
|
-
info->callback = func;
|
320
|
-
info->key = id__idle_callbacks__;
|
321
|
-
id = gtk_idle_add_full(G_PRIORITY_DEFAULT_IDLE,
|
322
|
-
(GtkFunction)gtk_m_function, NULL,
|
323
|
-
(gpointer)info, g_free);
|
324
|
-
info->id = id;
|
325
|
-
rb_id = UINT2NUM(id);
|
326
|
-
G_RELATIVE2(self, func, id__idle_callbacks__, rb_id);
|
327
|
-
return rb_id;
|
328
|
-
}
|
329
|
-
|
330
|
-
static VALUE
|
331
|
-
idle_add_priority(VALUE self, VALUE priority)
|
332
|
-
{
|
333
|
-
VALUE func, rb_id;
|
334
|
-
callback_info_t *info;
|
335
|
-
guint id;
|
336
|
-
|
337
|
-
func = rb_block_proc();
|
338
|
-
info = ALLOC(callback_info_t);
|
339
|
-
info->callback = func;
|
340
|
-
info->key = id__idle_callbacks__;
|
341
|
-
id = gtk_idle_add_full(NUM2INT(priority), (GtkFunction)gtk_m_function,
|
342
|
-
NULL, (gpointer)info, g_free);
|
343
|
-
info->id = id;
|
344
|
-
rb_id = UINT2NUM(id);
|
345
|
-
G_RELATIVE2(self, func, id__idle_callbacks__, rb_id);
|
346
|
-
return rb_id;
|
347
|
-
}
|
348
|
-
|
349
|
-
static VALUE
|
350
|
-
idle_remove(VALUE self, VALUE id)
|
351
|
-
{
|
352
|
-
gtk_idle_remove(NUM2UINT(id));
|
353
|
-
G_REMOVE_RELATIVE(self, id__idle_callbacks__, id);
|
354
|
-
return Qnil;
|
355
|
-
}
|
356
|
-
|
357
|
-
/* We don't need this.
|
358
|
-
gtk_idle_remove_by_data()
|
359
|
-
gtk_idle_add_full()
|
360
|
-
|
361
|
-
Use Gdk::Input.add, remove
|
362
|
-
gtk_input_add_full()
|
363
|
-
gtk_input_remove()
|
364
|
-
*/
|
365
|
-
|
366
|
-
static gint
|
367
|
-
gtk_m_key_snoop_func(GtkWidget *grab_widget, GdkEventKey *event, gpointer func)
|
368
|
-
{
|
369
|
-
VALUE ret = rb_funcall((VALUE)func, id_call, 2,
|
370
|
-
GOBJ2RVAL(grab_widget),
|
371
|
-
GEV2RVAL((GdkEvent*)event));
|
372
|
-
return RVAL2CBOOL(ret);
|
373
|
-
}
|
374
|
-
|
375
|
-
static VALUE
|
376
|
-
gtk_m_key_snooper_install(VALUE self)
|
377
|
-
{
|
378
|
-
VALUE func = rb_block_proc();
|
379
|
-
VALUE id = INT2FIX(gtk_key_snooper_install(
|
380
|
-
(GtkKeySnoopFunc)gtk_m_key_snoop_func,
|
381
|
-
(gpointer)func));
|
382
|
-
G_RELATIVE2(self, func, id__snooper_callbacks__, id);
|
383
|
-
return id;
|
384
|
-
}
|
385
|
-
|
386
|
-
static VALUE
|
387
|
-
gtk_m_key_snooper_remove(VALUE self, VALUE id)
|
388
|
-
{
|
389
|
-
gtk_key_snooper_remove(NUM2UINT(id));
|
390
|
-
G_REMOVE_RELATIVE(self, id__snooper_callbacks__, id);
|
391
|
-
return Qnil;
|
392
|
-
}
|
393
|
-
|
394
|
-
static VALUE
|
395
|
-
gtk_m_get_current_event(VALUE self)
|
396
|
-
{
|
397
|
-
return GEV2RVAL(gtk_get_current_event());
|
398
|
-
}
|
399
|
-
|
400
|
-
static VALUE
|
401
|
-
gtk_m_get_current_event_time(VALUE self)
|
402
|
-
{
|
403
|
-
return INT2NUM(gtk_get_current_event_time());
|
404
|
-
}
|
405
|
-
|
406
|
-
static VALUE
|
407
|
-
gtk_m_get_current_event_state(VALUE self)
|
408
|
-
{
|
409
|
-
GdkModifierType state;
|
410
|
-
gboolean ret = gtk_get_current_event_state(&state);
|
411
|
-
return ret ? GFLAGS2RVAL(state, GDK_TYPE_MODIFIER_TYPE) : Qnil;
|
412
|
-
}
|
413
|
-
|
414
|
-
static VALUE
|
415
|
-
gtk_m_get_event_widget(int argc, VALUE *argv, VALUE self)
|
416
|
-
{
|
417
|
-
VALUE event;
|
418
|
-
rb_scan_args(argc, argv, "01", &event);
|
419
|
-
|
420
|
-
return GOBJ2RVAL(gtk_get_event_widget(NIL_P(event) ? NULL :RVAL2GEV(event)));
|
421
|
-
}
|
422
|
-
|
423
|
-
static VALUE
|
424
|
-
gtk_m_propagate_event(VALUE self, VALUE widget, VALUE event)
|
425
|
-
{
|
426
|
-
gtk_propagate_event(GTK_WIDGET(RVAL2GOBJ(widget)), RVAL2GEV(event));
|
427
|
-
return Qnil;
|
428
|
-
}
|
429
|
-
|
430
|
-
/* From Version Information */
|
431
|
-
static VALUE
|
432
|
-
gtk_m_check_version(VALUE self, VALUE major, VALUE minor, VALUE micro)
|
433
|
-
{
|
434
|
-
const gchar *ret;
|
435
|
-
ret = gtk_check_version(FIX2INT(major), FIX2INT(minor), FIX2INT(micro));
|
436
|
-
return ret ? CSTR2RVAL(ret) : Qnil;
|
437
|
-
}
|
438
|
-
|
439
|
-
static VALUE
|
440
|
-
gtk_m_check_version_q(VALUE self, VALUE major, VALUE minor, VALUE micro)
|
441
|
-
{
|
442
|
-
const gchar *ret;
|
443
|
-
ret = gtk_check_version(FIX2INT(major), FIX2INT(minor), FIX2INT(micro));
|
444
|
-
return CBOOL2RVAL(ret == NULL);
|
445
|
-
}
|
446
|
-
|
447
|
-
|
448
|
-
void
|
449
|
-
Init_gtk_main()
|
450
|
-
{
|
451
|
-
id__quit_callbacks__ = rb_intern("__quit_callbacks__");
|
452
|
-
id__timeout_callbacks__ = rb_intern("__timeout_callbacks__");
|
453
|
-
id__idle_callbacks__ = rb_intern("__idle_callbacks__");
|
454
|
-
id__snooper_callbacks__ = rb_intern("__snooper_callbacks__");
|
455
|
-
|
456
|
-
rbgtk_eGtkInitError = rb_define_class_under(mGtk, "InitError",
|
457
|
-
rb_eRuntimeError);
|
458
|
-
|
459
|
-
rb_define_module_function(mGtk, "set_locale", gtk_m_set_locale, 0);
|
460
|
-
rb_define_module_function(mGtk, "disable_setlocale", gtk_m_disable_setlocale, 0);
|
461
|
-
rb_define_module_function(mGtk, "default_language", gtk_m_get_default_language, 0);
|
462
|
-
rb_define_module_function(mGtk, "init", gtk_m_init, -1);
|
463
|
-
rb_define_module_function(mGtk, "main", gtk_m_main, 0);
|
464
|
-
rb_define_module_function(mGtk, "main_level", gtk_m_main_level, 0);
|
465
|
-
rb_define_module_function(mGtk, "main_quit", gtk_m_main_quit, 0);
|
466
|
-
rb_define_module_function(mGtk, "main_iteration", gtk_m_main_iteration, 0);
|
467
|
-
rb_define_module_function(mGtk, "main_iteration_do", gtk_m_main_iteration_do, 1);
|
468
|
-
rb_define_module_function(mGtk, "main_do_event", gtk_m_main_do_event, 1);
|
469
|
-
rb_define_module_function(mGtk, "grab_add", gtk_m_grab_add, 1);
|
470
|
-
rb_define_module_function(mGtk, "current", gtk_m_get_current, 0);
|
471
|
-
rb_define_module_function(mGtk, "grab_remove", gtk_m_grab_remove, 1);
|
472
|
-
rb_define_module_function(mGtk, "init_add", gtk_m_init_add, 0);
|
473
|
-
rb_define_module_function(mGtk, "quit_add", gtk_m_quit_add, 1);
|
474
|
-
rb_define_module_function(mGtk, "quit_remove", gtk_m_quit_remove, 1);
|
475
|
-
|
476
|
-
rb_define_module_function(mGtk, "timeout_add", timeout_add, 1);
|
477
|
-
rb_define_module_function(mGtk, "timeout_remove", timeout_remove, 1);
|
478
|
-
rb_define_module_function(mGtk, "idle_add", idle_add, 0);
|
479
|
-
rb_define_module_function(mGtk, "idle_add_priority", idle_add_priority, 1);
|
480
|
-
rb_define_module_function(mGtk, "idle_remove", idle_remove, 1);
|
481
|
-
rb_define_module_function(mGtk, "key_snooper_install", gtk_m_key_snooper_install, 0);
|
482
|
-
rb_define_module_function(mGtk, "key_snooper_remove", gtk_m_key_snooper_remove, 1);
|
483
|
-
rb_define_module_function(mGtk, "current_event", gtk_m_get_current_event, 0);
|
484
|
-
rb_define_module_function(mGtk, "current_event_time", gtk_m_get_current_event_time, 0);
|
485
|
-
rb_define_module_function(mGtk, "current_event_state", gtk_m_get_current_event_state, 0);
|
486
|
-
rb_define_module_function(mGtk, "get_event_widget", gtk_m_get_event_widget, -1);
|
487
|
-
rb_define_module_function(mGtk, "propagate_event", gtk_m_propagate_event, 2);
|
488
|
-
rb_define_module_function(mGtk, "check_version", gtk_m_check_version, 3);
|
489
|
-
rb_define_module_function(mGtk, "check_version?", gtk_m_check_version_q, 3);
|
490
|
-
|
491
|
-
rb_define_const(mGtk, "PRIORITY_RESIZE", INT2FIX(GTK_PRIORITY_RESIZE));
|
492
|
-
|
493
|
-
}
|