gtk2 0.20.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +6664 -0
- data/README +33 -0
- data/Rakefile +71 -0
- data/extconf.rb +116 -0
- data/src/global.h +33 -0
- data/src/init.c +39 -0
- data/src/lib/gtk2.rb +13 -0
- data/src/lib/gtk2/base.rb +95 -0
- data/src/makeinits.rb +57 -0
- data/src/makekeysyms.rb +5 -0
- data/src/rbgdk.c +395 -0
- data/src/rbgdk.h +50 -0
- data/src/rbgdkatom.c +122 -0
- data/src/rbgdkcairo.c +100 -0
- data/src/rbgdkcolor.c +151 -0
- data/src/rbgdkcolormap.c +142 -0
- data/src/rbgdkconst.c +29 -0
- data/src/rbgdkconversions.h +18 -0
- data/src/rbgdkcursor.c +115 -0
- data/src/rbgdkdevice.c +235 -0
- data/src/rbgdkdisplay.c +634 -0
- data/src/rbgdkdisplaymanager.c +50 -0
- data/src/rbgdkdragcontext.c +280 -0
- data/src/rbgdkdraw.c +487 -0
- data/src/rbgdkevent.c +1020 -0
- data/src/rbgdkgc.c +456 -0
- data/src/rbgdkgeometry.c +272 -0
- data/src/rbgdkimage.c +155 -0
- data/src/rbgdkinput.c +70 -0
- data/src/rbgdkkeymap.c +153 -0
- data/src/rbgdkkeysyms.h +2174 -0
- data/src/rbgdkkeyval.c +105 -0
- data/src/rbgdkpango.c +171 -0
- data/src/rbgdkpangorenderer.c +132 -0
- data/src/rbgdkpixbuf.c +178 -0
- data/src/rbgdkpixmap.c +255 -0
- data/src/rbgdkproperty.c +342 -0
- data/src/rbgdkrectangle.c +146 -0
- data/src/rbgdkregion.c +242 -0
- data/src/rbgdkrgb.c +197 -0
- data/src/rbgdkscreen.c +535 -0
- data/src/rbgdkselection.c +161 -0
- data/src/rbgdkthreads.c +68 -0
- data/src/rbgdktimecoord.c +118 -0
- data/src/rbgdkvisual.c +273 -0
- data/src/rbgdkwindow.c +1302 -0
- data/src/rbgdkwindowattr.c +213 -0
- data/src/rbgdkx11.c +256 -0
- data/src/rbgtk.c +93 -0
- data/src/rbgtk.h +121 -0
- data/src/rbgtkaboutdialog.c +195 -0
- data/src/rbgtkaccelerator.c +78 -0
- data/src/rbgtkaccelgroup.c +216 -0
- data/src/rbgtkaccelgroupentry.c +85 -0
- data/src/rbgtkaccelkey.c +116 -0
- data/src/rbgtkaccellabel.c +46 -0
- data/src/rbgtkaccelmap.c +162 -0
- data/src/rbgtkaccessible.c +29 -0
- data/src/rbgtkaction.c +277 -0
- data/src/rbgtkactiongroup.c +377 -0
- data/src/rbgtkadjustment.c +153 -0
- data/src/rbgtkalignment.c +71 -0
- data/src/rbgtkallocation.c +171 -0
- data/src/rbgtkarrow.c +47 -0
- data/src/rbgtkaspectframe.c +46 -0
- data/src/rbgtkassistant.c +230 -0
- data/src/rbgtkbbox.c +47 -0
- data/src/rbgtkbin.c +31 -0
- data/src/rbgtkbindingset.c +192 -0
- data/src/rbgtkborder.c +80 -0
- data/src/rbgtkbox.c +142 -0
- data/src/rbgtkbuildable.c +115 -0
- data/src/rbgtkbuilder.c +154 -0
- data/src/rbgtkbutton.c +151 -0
- data/src/rbgtkcalendar.c +159 -0
- data/src/rbgtkcelleditable.c +49 -0
- data/src/rbgtkcelllayout.c +144 -0
- data/src/rbgtkcellrenderer.c +139 -0
- data/src/rbgtkcellrendereraccel.c +42 -0
- data/src/rbgtkcellrenderercombo.c +37 -0
- data/src/rbgtkcellrendererpixbuf.c +33 -0
- data/src/rbgtkcellrendererprogress.c +37 -0
- data/src/rbgtkcellrendererspin.c +38 -0
- data/src/rbgtkcellrenderertext.c +45 -0
- data/src/rbgtkcellrenderertoggle.c +32 -0
- data/src/rbgtkcellview.c +134 -0
- data/src/rbgtkcheckbutton.c +55 -0
- data/src/rbgtkcheckmenuitem.c +56 -0
- data/src/rbgtkclipboard.c +473 -0
- data/src/rbgtkcolorbutton.c +63 -0
- data/src/rbgtkcolorsel.c +175 -0
- data/src/rbgtkcolorselectiondialog.c +72 -0
- data/src/rbgtkcombo.c +117 -0
- data/src/rbgtkcombobox.c +240 -0
- data/src/rbgtkcomboboxentry.c +60 -0
- data/src/rbgtkconst.c +163 -0
- data/src/rbgtkcontainer.c +776 -0
- data/src/rbgtkconversions.h +26 -0
- data/src/rbgtkcurve.c +105 -0
- data/src/rbgtkdialog.c +244 -0
- data/src/rbgtkdrag.c +436 -0
- data/src/rbgtkdrawingarea.c +31 -0
- data/src/rbgtkeditable.c +152 -0
- data/src/rbgtkentry.c +161 -0
- data/src/rbgtkentrycompletion.c +167 -0
- data/src/rbgtkeventbox.c +31 -0
- data/src/rbgtkexpander.c +67 -0
- data/src/rbgtkfilechooser.c +403 -0
- data/src/rbgtkfilechooserbutton.c +72 -0
- data/src/rbgtkfilechooserdialog.c +58 -0
- data/src/rbgtkfilechooserwidget.c +50 -0
- data/src/rbgtkfilefilter.c +139 -0
- data/src/rbgtkfilesel.c +155 -0
- data/src/rbgtkfixed.c +72 -0
- data/src/rbgtkfontbutton.c +69 -0
- data/src/rbgtkfontselection.c +30 -0
- data/src/rbgtkfontselectiondialog.c +106 -0
- data/src/rbgtkframe.c +64 -0
- data/src/rbgtkgamma.c +47 -0
- data/src/rbgtkhandlebox.c +42 -0
- data/src/rbgtkhbbox.c +31 -0
- data/src/rbgtkhbox.c +38 -0
- data/src/rbgtkhpaned.c +31 -0
- data/src/rbgtkhruler.c +31 -0
- data/src/rbgtkhscale.c +45 -0
- data/src/rbgtkhscrollbar.c +38 -0
- data/src/rbgtkhseparator.c +30 -0
- data/src/rbgtkiconfactory.c +80 -0
- data/src/rbgtkiconinfo.c +118 -0
- data/src/rbgtkiconset.c +87 -0
- data/src/rbgtkiconsize.c +90 -0
- data/src/rbgtkiconsource.c +176 -0
- data/src/rbgtkicontheme.c +309 -0
- data/src/rbgtkiconview.c +351 -0
- data/src/rbgtkimage.c +152 -0
- data/src/rbgtkimagemenuitem.c +52 -0
- data/src/rbgtkimcontext.c +134 -0
- data/src/rbgtkimcontextsimple.c +48 -0
- data/src/rbgtkimmulticontext.c +38 -0
- data/src/rbgtkinits.c +473 -0
- data/src/rbgtkinputdialog.c +30 -0
- data/src/rbgtkinvisible.c +68 -0
- data/src/rbgtkitem.c +51 -0
- data/src/rbgtkitemfactory.c +312 -0
- data/src/rbgtklabel.c +168 -0
- data/src/rbgtklayout.c +91 -0
- data/src/rbgtklinkbutton.c +68 -0
- data/src/rbgtkliststore.c +412 -0
- data/src/rbgtkmacros.h +26 -0
- data/src/rbgtkmain.c +532 -0
- data/src/rbgtkmenu.c +272 -0
- data/src/rbgtkmenubar.c +48 -0
- data/src/rbgtkmenuitem.c +171 -0
- data/src/rbgtkmenushell.c +128 -0
- data/src/rbgtkmenutoolbutton.c +74 -0
- data/src/rbgtkmessagedialog.c +102 -0
- data/src/rbgtkmisc.c +63 -0
- data/src/rbgtknotebook.c +484 -0
- data/src/rbgtkobject.c +186 -0
- data/src/rbgtkoptionmenu.c +65 -0
- data/src/rbgtkpagesetup.c +196 -0
- data/src/rbgtkpagesetupunixdialog.c +80 -0
- data/src/rbgtkpaned.c +114 -0
- data/src/rbgtkpapersize.c +186 -0
- data/src/rbgtkplug.c +84 -0
- data/src/rbgtkprintcontext.c +124 -0
- data/src/rbgtkprinter.c +155 -0
- data/src/rbgtkprintjob.c +151 -0
- data/src/rbgtkprintoperation.c +152 -0
- data/src/rbgtkprintoperationpreview.c +54 -0
- data/src/rbgtkprintsettings.c +794 -0
- data/src/rbgtkprintunixdialog.c +98 -0
- data/src/rbgtkprogress.c +21 -0
- data/src/rbgtkprogressbar.c +72 -0
- data/src/rbgtkradioaction.c +102 -0
- data/src/rbgtkradiobutton.c +83 -0
- data/src/rbgtkradiomenuitem.c +115 -0
- data/src/rbgtkradiotoolbutton.c +99 -0
- data/src/rbgtkrange.c +98 -0
- data/src/rbgtkrc.c +228 -0
- data/src/rbgtkrcstyle.c +184 -0
- data/src/rbgtkrecentaction.c +52 -0
- data/src/rbgtkrecentchooser.c +276 -0
- data/src/rbgtkrecentchooserdialog.c +59 -0
- data/src/rbgtkrecentchoosermenu.c +55 -0
- data/src/rbgtkrecentchooserwidget.c +45 -0
- data/src/rbgtkrecentdata.c +152 -0
- data/src/rbgtkrecentfilter.c +180 -0
- data/src/rbgtkrecentfilterinfo.c +197 -0
- data/src/rbgtkrecentinfo.c +232 -0
- data/src/rbgtkrecentmanager.c +164 -0
- data/src/rbgtkruler.c +82 -0
- data/src/rbgtkscale.c +47 -0
- data/src/rbgtkscalebutton.c +115 -0
- data/src/rbgtkscrollbar.c +21 -0
- data/src/rbgtkscrolledwindow.c +160 -0
- data/src/rbgtkselection.c +171 -0
- data/src/rbgtkselectiondata.c +333 -0
- data/src/rbgtkseparator.c +21 -0
- data/src/rbgtkseparatormenuitem.c +28 -0
- data/src/rbgtkseparatortoolitem.c +40 -0
- data/src/rbgtksettings.c +225 -0
- data/src/rbgtksizegroup.c +74 -0
- data/src/rbgtksocket.c +72 -0
- data/src/rbgtkspinbutton.c +138 -0
- data/src/rbgtkstatusbar.c +90 -0
- data/src/rbgtkstatusicon.c +120 -0
- data/src/rbgtkstock.c +264 -0
- data/src/rbgtkstyle.c +722 -0
- data/src/rbgtktable.c +190 -0
- data/src/rbgtktargetlist.c +148 -0
- data/src/rbgtktearoffmenuitem.c +30 -0
- data/src/rbgtktextappearance.c +173 -0
- data/src/rbgtktextattributes.c +209 -0
- data/src/rbgtktextbuffer.c +993 -0
- data/src/rbgtktextchild.c +49 -0
- data/src/rbgtktextiter.c +553 -0
- data/src/rbgtktextmark.c +87 -0
- data/src/rbgtktexttag.c +66 -0
- data/src/rbgtktexttagtable.c +94 -0
- data/src/rbgtktextview.c +351 -0
- data/src/rbgtktoggleaction.c +76 -0
- data/src/rbgtktogglebutton.c +84 -0
- data/src/rbgtktoggletoolbutton.c +70 -0
- data/src/rbgtktoolbar.c +373 -0
- data/src/rbgtktoolbutton.c +75 -0
- data/src/rbgtktoolitem.c +184 -0
- data/src/rbgtktooltip.c +76 -0
- data/src/rbgtktooltips.c +107 -0
- data/src/rbgtktreedragdest.c +19 -0
- data/src/rbgtktreedragsource.c +19 -0
- data/src/rbgtktreeiter.c +259 -0
- data/src/rbgtktreemodel.c +256 -0
- data/src/rbgtktreemodelfilter.c +214 -0
- data/src/rbgtktreemodelsort.c +113 -0
- data/src/rbgtktreepath.c +195 -0
- data/src/rbgtktreerowreference.c +168 -0
- data/src/rbgtktreeselection.c +235 -0
- data/src/rbgtktreesortable.c +127 -0
- data/src/rbgtktreestore.c +379 -0
- data/src/rbgtktreeview.c +881 -0
- data/src/rbgtktreeviewcolumn.c +331 -0
- data/src/rbgtkuimanager.c +210 -0
- data/src/rbgtkvbbox.c +31 -0
- data/src/rbgtkvbox.c +38 -0
- data/src/rbgtkviewport.c +33 -0
- data/src/rbgtkvolumebutton.c +36 -0
- data/src/rbgtkvpaned.c +31 -0
- data/src/rbgtkvruler.c +30 -0
- data/src/rbgtkvscale.c +45 -0
- data/src/rbgtkvscrollbar.c +38 -0
- data/src/rbgtkvseparator.c +30 -0
- data/src/rbgtkwidget.c +1414 -0
- data/src/rbgtkwindow.c +822 -0
- data/src/rbgtkwindowgroup.c +48 -0
- data/test/gtk-test-utils.rb +15 -0
- data/test/run-test.rb +30 -0
- data/test/test_gc.rb +25 -0
- data/test/test_gdk.rb +18 -0
- data/test/test_gdk_color.rb +10 -0
- data/test/test_gdk_display.rb +37 -0
- data/test/test_gdk_event.rb +11 -0
- data/test/test_gdk_gc.rb +7 -0
- data/test/test_gdk_keymap.rb +8 -0
- data/test/test_gdk_pango.rb +9 -0
- data/test/test_gdk_selection_data.rb +17 -0
- data/test/test_gdk_window.rb +29 -0
- data/test/test_gdk_window_attribute.rb +9 -0
- data/test/test_gtk_about_dialog.rb +14 -0
- data/test/test_gtk_buildable.rb +66 -0
- data/test/test_gtk_builder.rb +188 -0
- data/test/test_gtk_entry.rb +18 -0
- data/test/test_gtk_icon_theme.rb +30 -0
- data/test/test_gtk_image.rb +8 -0
- data/test/test_gtk_list_store.rb +65 -0
- data/test/test_gtk_menu_item.rb +13 -0
- data/test/test_gtk_rc_style.rb +14 -0
- data/test/test_gtk_tree_path.rb +20 -0
- data/test/test_gtk_unix_print.rb +14 -0
- data/test/test_gtk_widget.rb +32 -0
- metadata +393 -0
data/src/rbgdkscreen.c
ADDED
@@ -0,0 +1,535 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/************************************************
|
3
|
+
|
4
|
+
rbgdkdisplay.c -
|
5
|
+
|
6
|
+
$Author: sakai $
|
7
|
+
$Date: 2007/07/08 03:00:50 $
|
8
|
+
|
9
|
+
Copyright (C) 2003-2006 Ruby-GNOME2 Project Team
|
10
|
+
Copyright (C) 2003 Geoff Youngs
|
11
|
+
************************************************/
|
12
|
+
|
13
|
+
#include "global.h"
|
14
|
+
#ifdef HAVE_RB_CAIRO_H
|
15
|
+
#include <rb_cairo.h>
|
16
|
+
#endif
|
17
|
+
|
18
|
+
#if GTK_CHECK_VERSION(2,2,0)
|
19
|
+
#define _SELF(i) GDK_SCREEN(RVAL2GOBJ(i))
|
20
|
+
|
21
|
+
static ID id_new;
|
22
|
+
|
23
|
+
static VALUE
|
24
|
+
gdkscreen_default(self)
|
25
|
+
VALUE self;
|
26
|
+
{
|
27
|
+
return GOBJ2RVAL(gdk_screen_get_default());
|
28
|
+
}
|
29
|
+
|
30
|
+
static VALUE
|
31
|
+
gdkscreen_get_default_colormap(self)
|
32
|
+
VALUE self;
|
33
|
+
{
|
34
|
+
return GOBJ2RVAL(gdk_screen_get_default_colormap(_SELF(self)));
|
35
|
+
}
|
36
|
+
|
37
|
+
static VALUE
|
38
|
+
gdkscreen_set_default_colormap(self, colormap)
|
39
|
+
VALUE self, colormap;
|
40
|
+
{
|
41
|
+
gdk_screen_set_default_colormap(_SELF(self),
|
42
|
+
GDK_COLORMAP(RVAL2GOBJ(colormap)));
|
43
|
+
return self;
|
44
|
+
}
|
45
|
+
|
46
|
+
static VALUE
|
47
|
+
gdkscreen_get_system_colormap(self)
|
48
|
+
VALUE self;
|
49
|
+
{
|
50
|
+
return GOBJ2RVAL(gdk_screen_get_system_colormap(_SELF(self)));
|
51
|
+
}
|
52
|
+
|
53
|
+
static VALUE
|
54
|
+
gdkscreen_get_system_visual(self)
|
55
|
+
VALUE self;
|
56
|
+
{
|
57
|
+
return GOBJ2RVAL(gdk_screen_get_system_visual(_SELF(self)));
|
58
|
+
}
|
59
|
+
|
60
|
+
static VALUE
|
61
|
+
gdkscreen_get_rgb_colormap(self)
|
62
|
+
VALUE self;
|
63
|
+
{
|
64
|
+
return GOBJ2RVAL(gdk_screen_get_rgb_colormap(_SELF(self)));
|
65
|
+
}
|
66
|
+
|
67
|
+
static VALUE
|
68
|
+
gdkscreen_get_rgb_visual(self)
|
69
|
+
VALUE self;
|
70
|
+
{
|
71
|
+
return GOBJ2RVAL(gdk_screen_get_rgb_visual(_SELF(self)));
|
72
|
+
}
|
73
|
+
|
74
|
+
#if GTK_CHECK_VERSION(2,8,0)
|
75
|
+
static VALUE
|
76
|
+
gdkscreen_get_rgba_colormap(self)
|
77
|
+
VALUE self;
|
78
|
+
{
|
79
|
+
return GOBJ2RVAL(gdk_screen_get_rgba_colormap(_SELF(self)));
|
80
|
+
}
|
81
|
+
|
82
|
+
static VALUE
|
83
|
+
gdkscreen_get_rgba_visual(self)
|
84
|
+
VALUE self;
|
85
|
+
{
|
86
|
+
return GOBJ2RVAL(gdk_screen_get_rgba_visual(_SELF(self)));
|
87
|
+
}
|
88
|
+
#endif
|
89
|
+
|
90
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
91
|
+
static VALUE
|
92
|
+
gdkscreen_is_composited(self)
|
93
|
+
VALUE self;
|
94
|
+
{
|
95
|
+
return CBOOL2RVAL(gdk_screen_is_composited(_SELF(self)));
|
96
|
+
}
|
97
|
+
#endif
|
98
|
+
|
99
|
+
static VALUE
|
100
|
+
gdkscreen_get_root_window(self)
|
101
|
+
VALUE self;
|
102
|
+
{
|
103
|
+
return GOBJ2RVAL(gdk_screen_get_root_window(_SELF(self)));
|
104
|
+
}
|
105
|
+
|
106
|
+
static VALUE
|
107
|
+
gdkscreen_get_display(self)
|
108
|
+
VALUE self;
|
109
|
+
{
|
110
|
+
return GOBJ2RVAL(gdk_screen_get_display(_SELF(self)));
|
111
|
+
}
|
112
|
+
|
113
|
+
static VALUE
|
114
|
+
gdkscreen_number(self)
|
115
|
+
VALUE self;
|
116
|
+
{
|
117
|
+
return INT2NUM(gdk_screen_get_number(_SELF(self)));
|
118
|
+
}
|
119
|
+
static VALUE
|
120
|
+
gdkscreen_width(self)
|
121
|
+
VALUE self;
|
122
|
+
{
|
123
|
+
return INT2NUM(gdk_screen_get_width(_SELF(self)));
|
124
|
+
}
|
125
|
+
static VALUE
|
126
|
+
gdkscreen_height(self)
|
127
|
+
VALUE self;
|
128
|
+
{
|
129
|
+
return INT2NUM(gdk_screen_get_height(_SELF(self)));
|
130
|
+
}
|
131
|
+
static VALUE
|
132
|
+
gdkscreen_width_mm(self)
|
133
|
+
VALUE self;
|
134
|
+
{
|
135
|
+
return INT2NUM(gdk_screen_get_width_mm(_SELF(self)));
|
136
|
+
}
|
137
|
+
static VALUE
|
138
|
+
gdkscreen_height_mm(self)
|
139
|
+
VALUE self;
|
140
|
+
{
|
141
|
+
return INT2NUM(gdk_screen_get_height_mm(_SELF(self)));
|
142
|
+
}
|
143
|
+
|
144
|
+
static VALUE
|
145
|
+
gdkscreen_list_visuals(self)
|
146
|
+
VALUE self;
|
147
|
+
{
|
148
|
+
return GLIST2ARYF(gdk_screen_list_visuals(_SELF(self)));
|
149
|
+
}
|
150
|
+
|
151
|
+
static VALUE
|
152
|
+
gdkscreen_get_toplevel_windows(self)
|
153
|
+
VALUE self;
|
154
|
+
{
|
155
|
+
return GLIST2ARYF(gdk_screen_get_toplevel_windows(_SELF(self)));
|
156
|
+
}
|
157
|
+
|
158
|
+
static VALUE
|
159
|
+
gdkscreen_make_display_name(self)
|
160
|
+
VALUE self;
|
161
|
+
{
|
162
|
+
gchar* name = gdk_screen_make_display_name(_SELF(self));
|
163
|
+
VALUE ret = CSTR2RVAL(name);
|
164
|
+
g_free(name);
|
165
|
+
return ret;
|
166
|
+
}
|
167
|
+
|
168
|
+
static VALUE
|
169
|
+
gdkscreen_n_monitors(self)
|
170
|
+
VALUE self;
|
171
|
+
{
|
172
|
+
return INT2NUM(gdk_screen_get_n_monitors(_SELF(self)));
|
173
|
+
}
|
174
|
+
|
175
|
+
static VALUE
|
176
|
+
gdkscreen_monitor_geometry(self, num)
|
177
|
+
VALUE self, num;
|
178
|
+
{
|
179
|
+
GdkRectangle rect;
|
180
|
+
gdk_screen_get_monitor_geometry(_SELF(self), NUM2INT(num), &rect);
|
181
|
+
return BOXED2RVAL(&rect, GDK_TYPE_RECTANGLE);
|
182
|
+
}
|
183
|
+
|
184
|
+
static VALUE
|
185
|
+
gdkscreen_get_monitor(argc, argv, self)
|
186
|
+
int argc;
|
187
|
+
VALUE* argv;
|
188
|
+
VALUE self;
|
189
|
+
{
|
190
|
+
VALUE arg1, arg2;
|
191
|
+
VALUE ret;
|
192
|
+
|
193
|
+
rb_scan_args(argc, argv, "11", &arg1, &arg2);
|
194
|
+
if (argc == 2){
|
195
|
+
ret = INT2NUM(gdk_screen_get_monitor_at_point(_SELF(self),
|
196
|
+
NUM2INT(arg1), NUM2INT(arg2)));
|
197
|
+
} else if (argc == 1){
|
198
|
+
ret = INT2NUM(gdk_screen_get_monitor_at_window(_SELF(self),
|
199
|
+
GDK_WINDOW(RVAL2GOBJ(arg1))));
|
200
|
+
} else {
|
201
|
+
rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc);
|
202
|
+
}
|
203
|
+
return ret;
|
204
|
+
}
|
205
|
+
|
206
|
+
static VALUE
|
207
|
+
gdkscreen_broadcast_client_message(self, event)
|
208
|
+
VALUE self, event;
|
209
|
+
{
|
210
|
+
gdk_screen_broadcast_client_message(_SELF(self), RVAL2GEV(event));
|
211
|
+
return self;
|
212
|
+
}
|
213
|
+
|
214
|
+
/*
|
215
|
+
type: String, Integer, Gdk::Color.
|
216
|
+
*/
|
217
|
+
static VALUE
|
218
|
+
gdkscreen_get_setting(argc, argv, self)
|
219
|
+
int argc;
|
220
|
+
VALUE* argv;
|
221
|
+
VALUE self;
|
222
|
+
{
|
223
|
+
VALUE name, type;
|
224
|
+
GType gtype;
|
225
|
+
GValue val = {0,};
|
226
|
+
gboolean ret;
|
227
|
+
VALUE value;
|
228
|
+
|
229
|
+
rb_scan_args(argc, argv, "11", &name, &type);
|
230
|
+
if NIL_P(type)
|
231
|
+
gtype = G_TYPE_STRING;
|
232
|
+
else
|
233
|
+
gtype = CLASS2GTYPE(type);
|
234
|
+
|
235
|
+
g_value_init(&val, gtype);
|
236
|
+
ret = gdk_screen_get_setting(_SELF(self), RVAL2CSTR(name), &val);
|
237
|
+
value = ret ? GVAL2RVAL(&val) : Qnil;
|
238
|
+
g_value_unset(&val);
|
239
|
+
return value;
|
240
|
+
}
|
241
|
+
|
242
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
243
|
+
#ifdef HAVE_RB_CAIRO_H
|
244
|
+
static VALUE
|
245
|
+
gdkscreen_get_font_options(self)
|
246
|
+
VALUE self;
|
247
|
+
{
|
248
|
+
return CRFONTOPTIONS2RVAL((cairo_font_options_t *)gdk_screen_get_font_options(_SELF(self)));
|
249
|
+
}
|
250
|
+
|
251
|
+
static VALUE
|
252
|
+
gdkscreen_set_font_options(self, options)
|
253
|
+
VALUE self, options;
|
254
|
+
{
|
255
|
+
gdk_screen_set_font_options(_SELF(self),
|
256
|
+
(const cairo_font_options_t *)RVAL2CRFONTOPTIONS(options));
|
257
|
+
return self;
|
258
|
+
}
|
259
|
+
#endif
|
260
|
+
|
261
|
+
/* Defined as properties
|
262
|
+
void gdk_screen_set_font_options (GdkScreen *screen,
|
263
|
+
const cairo_font_options_t *options);
|
264
|
+
gdouble gdk_screen_get_resolution (GdkScreen *screen);
|
265
|
+
*/
|
266
|
+
|
267
|
+
static VALUE
|
268
|
+
gdkscreen_get_active_window(self)
|
269
|
+
VALUE self;
|
270
|
+
{
|
271
|
+
return GOBJ2RVAL(gdk_screen_get_active_window(_SELF(self)));
|
272
|
+
}
|
273
|
+
|
274
|
+
static VALUE
|
275
|
+
gdkscreen_get_window_stack(self)
|
276
|
+
VALUE self;
|
277
|
+
{
|
278
|
+
GList* list = gdk_screen_get_window_stack(_SELF(self));
|
279
|
+
VALUE ary = rb_ary_new();
|
280
|
+
while (list) {
|
281
|
+
rb_ary_push(ary, GOBJ2RVAL(list->data));
|
282
|
+
g_object_unref(list->data);
|
283
|
+
list = list->next;
|
284
|
+
}
|
285
|
+
g_list_free(list);
|
286
|
+
return ary;
|
287
|
+
}
|
288
|
+
#endif
|
289
|
+
|
290
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
291
|
+
static void
|
292
|
+
child_setup(func)
|
293
|
+
gpointer func;
|
294
|
+
{
|
295
|
+
if (! NIL_P(func)){
|
296
|
+
rb_funcall((VALUE)func, id_call, 0);
|
297
|
+
}
|
298
|
+
}
|
299
|
+
|
300
|
+
static VALUE
|
301
|
+
gdkscreen_spawn_on_screen(self, working_directory, argv, envp, flags)
|
302
|
+
VALUE self, working_directory, argv, envp, flags;
|
303
|
+
{
|
304
|
+
GError *err = NULL;
|
305
|
+
gboolean ret;
|
306
|
+
gint child_pid;
|
307
|
+
VALUE func = Qnil;
|
308
|
+
gint gargc, genc, i;
|
309
|
+
gchar** gargv = (gchar**)NULL;
|
310
|
+
gchar** genvp = (gchar**)NULL;
|
311
|
+
|
312
|
+
if (rb_block_given_p()) {
|
313
|
+
func = rb_block_proc();
|
314
|
+
G_RELATIVE(self, func);
|
315
|
+
}
|
316
|
+
|
317
|
+
if (! NIL_P(argv)){
|
318
|
+
Check_Type(argv, T_ARRAY);
|
319
|
+
gargc = RARRAY_LEN(argv);
|
320
|
+
gargv = ALLOCA_N(gchar*, gargc + 1);
|
321
|
+
for (i = 0; i < gargc; i++) {
|
322
|
+
if (TYPE(RARRAY_PTR(argv)[i]) == T_STRING) {
|
323
|
+
gargv[i] = RVAL2CSTR(RARRAY_PTR(argv)[i]);
|
324
|
+
}
|
325
|
+
else {
|
326
|
+
gargv[i] = "";
|
327
|
+
}
|
328
|
+
}
|
329
|
+
gargv[gargc] = (gchar*)NULL;
|
330
|
+
}
|
331
|
+
|
332
|
+
if (! NIL_P(envp)){
|
333
|
+
Check_Type(envp, T_ARRAY);
|
334
|
+
genc = RARRAY_LEN(envp);
|
335
|
+
genvp = ALLOCA_N(gchar*, genc + 1);
|
336
|
+
for (i = 0; i < genc; i++) {
|
337
|
+
if (TYPE(RARRAY_PTR(envp)[i]) == T_STRING) {
|
338
|
+
genvp[i] = RVAL2CSTR(RARRAY_PTR(envp)[i]);
|
339
|
+
}
|
340
|
+
else {
|
341
|
+
genvp[i] = "";
|
342
|
+
}
|
343
|
+
}
|
344
|
+
genvp[genc] = (gchar*)NULL;
|
345
|
+
}
|
346
|
+
|
347
|
+
ret = gdk_spawn_on_screen(_SELF(self),
|
348
|
+
NIL_P(working_directory) ? NULL : RVAL2CSTR(working_directory),
|
349
|
+
gargv, genvp, NUM2INT(flags),
|
350
|
+
(GSpawnChildSetupFunc)child_setup, (gpointer)func,
|
351
|
+
&child_pid, &err);
|
352
|
+
|
353
|
+
if (! ret){
|
354
|
+
RAISE_GERROR(err);
|
355
|
+
}
|
356
|
+
|
357
|
+
return INT2NUM(child_pid);
|
358
|
+
}
|
359
|
+
|
360
|
+
static VALUE
|
361
|
+
gdkscreen_spawn_on_screen_with_pipes(self, working_directory, argv, envp, flags)
|
362
|
+
VALUE self, working_directory, argv, envp, flags;
|
363
|
+
{
|
364
|
+
GError *err = NULL;
|
365
|
+
gboolean ret;
|
366
|
+
gint child_pid;
|
367
|
+
VALUE func = Qnil;
|
368
|
+
gint gargc, genc, i;
|
369
|
+
gchar** gargv = (gchar**)NULL;
|
370
|
+
gchar** genvp = (gchar**)NULL;
|
371
|
+
gint standard_input, standard_output, standard_error;
|
372
|
+
|
373
|
+
if (rb_block_given_p()) {
|
374
|
+
func = rb_block_proc();
|
375
|
+
G_RELATIVE(self, func);
|
376
|
+
}
|
377
|
+
|
378
|
+
if (! NIL_P(argv)){
|
379
|
+
Check_Type(argv, T_ARRAY);
|
380
|
+
gargc = RARRAY_LEN(argv);
|
381
|
+
gargv = ALLOCA_N(gchar*, gargc + 1);
|
382
|
+
for (i = 0; i < gargc; i++) {
|
383
|
+
if (TYPE(RARRAY_PTR(argv)[i]) == T_STRING) {
|
384
|
+
gargv[i] = RVAL2CSTR(RARRAY_PTR(argv)[i]);
|
385
|
+
}
|
386
|
+
else {
|
387
|
+
gargv[i] = "";
|
388
|
+
}
|
389
|
+
}
|
390
|
+
gargv[gargc] = (gchar*)NULL;
|
391
|
+
}
|
392
|
+
|
393
|
+
if (! NIL_P(envp)){
|
394
|
+
Check_Type(envp, T_ARRAY);
|
395
|
+
genc = RARRAY_LEN(envp);
|
396
|
+
genvp = ALLOCA_N(gchar*, genc + 1);
|
397
|
+
for (i = 0; i < genc; i++) {
|
398
|
+
if (TYPE(RARRAY_PTR(envp)[i]) == T_STRING) {
|
399
|
+
genvp[i] = RVAL2CSTR(RARRAY_PTR(envp)[i]);
|
400
|
+
}
|
401
|
+
else {
|
402
|
+
genvp[i] = "";
|
403
|
+
}
|
404
|
+
}
|
405
|
+
genvp[genc] = (gchar*)NULL;
|
406
|
+
}
|
407
|
+
|
408
|
+
ret = gdk_spawn_on_screen_with_pipes(_SELF(self),
|
409
|
+
NIL_P(working_directory) ? NULL : RVAL2CSTR(working_directory),
|
410
|
+
gargv, genvp, NUM2INT(flags),
|
411
|
+
(GSpawnChildSetupFunc)child_setup, (gpointer)func,
|
412
|
+
&child_pid,
|
413
|
+
&standard_input, &standard_output,
|
414
|
+
&standard_error, &err);
|
415
|
+
|
416
|
+
if (! ret) RAISE_GERROR(err);
|
417
|
+
|
418
|
+
return rb_ary_new3(4, INT2NUM(child_pid),
|
419
|
+
rb_funcall(rb_cIO, id_new, 1, INT2NUM(standard_input)),
|
420
|
+
rb_funcall(rb_cIO, id_new, 1, INT2NUM(standard_output)),
|
421
|
+
rb_funcall(rb_cIO, id_new, 1, INT2NUM(standard_error)));
|
422
|
+
}
|
423
|
+
|
424
|
+
static VALUE
|
425
|
+
gdkscreen_spawn_command_line_on_screen(self, command_line)
|
426
|
+
VALUE self, command_line;
|
427
|
+
{
|
428
|
+
GError *err = NULL;
|
429
|
+
VALUE ret;
|
430
|
+
|
431
|
+
ret = CBOOL2RVAL(g_spawn_command_line_async(RVAL2CSTR(command_line), &err));
|
432
|
+
if (!ret) RAISE_GERROR(err);
|
433
|
+
|
434
|
+
return ret;
|
435
|
+
}
|
436
|
+
#endif
|
437
|
+
|
438
|
+
/* From X Window System Interaction */
|
439
|
+
#ifdef GDK_WINDOWING_X11
|
440
|
+
#include <gdk/gdkx.h>
|
441
|
+
static VALUE
|
442
|
+
gdkscreen_xnumber(self)
|
443
|
+
VALUE self;
|
444
|
+
{
|
445
|
+
return INT2NUM(GDK_SCREEN_XNUMBER(_SELF(self)));
|
446
|
+
}
|
447
|
+
static VALUE
|
448
|
+
gdkscreen_supports_net_wm_hint(self, property)
|
449
|
+
VALUE self, property;
|
450
|
+
{
|
451
|
+
return CBOOL2RVAL(gdk_x11_screen_supports_net_wm_hint(_SELF(self),
|
452
|
+
RVAL2ATOM(property)));
|
453
|
+
}
|
454
|
+
|
455
|
+
static VALUE
|
456
|
+
gdkscreen_get_window_manager_name(self)
|
457
|
+
VALUE self;
|
458
|
+
{
|
459
|
+
return CSTR2RVAL(gdk_x11_screen_get_window_manager_name(_SELF(self)));
|
460
|
+
}
|
461
|
+
static VALUE
|
462
|
+
gdkscreen_get_screen_number(self)
|
463
|
+
VALUE self;
|
464
|
+
{
|
465
|
+
return INT2NUM(gdk_x11_screen_get_screen_number(_SELF(self)));
|
466
|
+
}
|
467
|
+
#endif
|
468
|
+
|
469
|
+
#endif
|
470
|
+
|
471
|
+
void
|
472
|
+
Init_gtk_gdk_screen()
|
473
|
+
{
|
474
|
+
#if GTK_CHECK_VERSION(2,2,0)
|
475
|
+
VALUE gdkScreen = G_DEF_CLASS(GDK_TYPE_SCREEN, "Screen", mGdk);
|
476
|
+
|
477
|
+
id_new = rb_intern("new");
|
478
|
+
|
479
|
+
rb_define_singleton_method(gdkScreen, "default", gdkscreen_default, 0);
|
480
|
+
rb_define_method(gdkScreen, "default_colormap", gdkscreen_get_default_colormap, 0);
|
481
|
+
rb_define_method(gdkScreen, "set_default_colormap", gdkscreen_set_default_colormap, 1);
|
482
|
+
rb_define_method(gdkScreen, "system_colormap", gdkscreen_get_system_colormap, 0);
|
483
|
+
rb_define_method(gdkScreen, "system_visual", gdkscreen_get_system_visual, 0);
|
484
|
+
rb_define_method(gdkScreen, "rgb_colormap", gdkscreen_get_rgb_colormap, 0);
|
485
|
+
rb_define_method(gdkScreen, "rgb_visual", gdkscreen_get_rgb_visual, 0);
|
486
|
+
#if GTK_CHECK_VERSION(2,8,0)
|
487
|
+
rb_define_method(gdkScreen, "rgba_colormap", gdkscreen_get_rgba_colormap, 0);
|
488
|
+
rb_define_method(gdkScreen, "rgba_visual", gdkscreen_get_rgba_visual, 0);
|
489
|
+
#endif
|
490
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
491
|
+
rb_define_method(gdkScreen, "composited?", gdkscreen_is_composited, 0);
|
492
|
+
#endif
|
493
|
+
rb_define_method(gdkScreen, "root_window", gdkscreen_get_root_window, 0);
|
494
|
+
rb_define_method(gdkScreen, "display", gdkscreen_get_display, 0);
|
495
|
+
rb_define_method(gdkScreen, "number", gdkscreen_number, 0);
|
496
|
+
rb_define_method(gdkScreen, "width", gdkscreen_width, 0);
|
497
|
+
rb_define_method(gdkScreen, "height", gdkscreen_height, 0);
|
498
|
+
rb_define_method(gdkScreen, "width_mm", gdkscreen_width_mm, 0);
|
499
|
+
rb_define_method(gdkScreen, "height_mm", gdkscreen_height_mm, 0);
|
500
|
+
rb_define_method(gdkScreen, "visuals", gdkscreen_list_visuals, 0);
|
501
|
+
rb_define_method(gdkScreen, "toplevel_windows", gdkscreen_get_toplevel_windows, 0);
|
502
|
+
rb_define_method(gdkScreen, "display_name", gdkscreen_make_display_name, 0);
|
503
|
+
rb_define_method(gdkScreen, "n_monitors", gdkscreen_n_monitors, 0);
|
504
|
+
rb_define_method(gdkScreen, "monitor_geometry", gdkscreen_monitor_geometry, 1);
|
505
|
+
rb_define_method(gdkScreen, "get_monitor", gdkscreen_get_monitor, -1);
|
506
|
+
rb_define_method(gdkScreen, "broadcast_client_message", gdkscreen_broadcast_client_message, 1);
|
507
|
+
rb_define_method(gdkScreen, "get_setting", gdkscreen_get_setting, -1);
|
508
|
+
#if GTK_CHECK_VERSION(2,10,0)
|
509
|
+
#ifdef HAVE_RB_CAIRO_H
|
510
|
+
rb_define_method(gdkScreen, "font_options", gdkscreen_get_font_options, 0);
|
511
|
+
rb_define_method(gdkScreen, "set_font_options", gdkscreen_set_font_options, 1);
|
512
|
+
#endif
|
513
|
+
rb_define_method(gdkScreen, "active_window", gdkscreen_get_active_window, 0);
|
514
|
+
rb_define_method(gdkScreen, "window_stack", gdkscreen_get_window_stack, 0);
|
515
|
+
#endif
|
516
|
+
|
517
|
+
#if GTK_CHECK_VERSION(2,4,0)
|
518
|
+
rb_define_method(gdkScreen, "spawn_on_screen", gdkscreen_spawn_on_screen, 4);
|
519
|
+
rb_define_method(gdkScreen, "spawn_on_screen_with_pipes", gdkscreen_spawn_on_screen_with_pipes, 4);
|
520
|
+
rb_define_method(gdkScreen, "spawn_command_line_on_screen", gdkscreen_spawn_command_line_on_screen, 1);
|
521
|
+
#endif
|
522
|
+
|
523
|
+
#ifdef GDK_WINDOWING_X11
|
524
|
+
rb_define_method(gdkScreen, "xnumber", gdkscreen_xnumber, 0);
|
525
|
+
rb_define_method(gdkScreen, "supports_net_wm_hint?", gdkscreen_supports_net_wm_hint, 0);
|
526
|
+
rb_define_method(gdkScreen, "window_manager_name", gdkscreen_get_window_manager_name, 0);
|
527
|
+
rb_define_method(gdkScreen, "screen_number", gdkscreen_get_screen_number, 0);
|
528
|
+
#endif
|
529
|
+
G_DEF_SETTERS(gdkScreen);
|
530
|
+
|
531
|
+
#ifdef GDK_WINDOWING_X11
|
532
|
+
G_DEF_CLASS3("GdkScreenX11", "ScreenX11", mGdk);
|
533
|
+
#endif
|
534
|
+
#endif
|
535
|
+
}
|