gdk3 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +53 -0
- data/ext/gdk3/depend +11 -0
- data/ext/gdk3/extconf.rb +127 -0
- data/ext/gdk3/gdk3.def +12 -0
- data/ext/gdk3/init.c +35 -0
- data/ext/gdk3/rbgdk.c +540 -0
- data/ext/gdk3/rbgdk3.h +71 -0
- data/ext/gdk3/rbgdk3conversions.h +118 -0
- data/ext/gdk3/rbgdk3private.h +93 -0
- data/ext/gdk3/rbgdkatom.c +122 -0
- data/ext/gdk3/rbgdkcairo.c +95 -0
- data/ext/gdk3/rbgdkcolor.c +137 -0
- data/ext/gdk3/rbgdkconst.c +33 -0
- data/ext/gdk3/rbgdkcursor.c +99 -0
- data/ext/gdk3/rbgdkdevice.c +197 -0
- data/ext/gdk3/rbgdkdisplay.c +482 -0
- data/ext/gdk3/rbgdkdisplaymanager.c +55 -0
- data/ext/gdk3/rbgdkdragcontext.c +191 -0
- data/ext/gdk3/rbgdkdraw.c +520 -0
- data/ext/gdk3/rbgdkevent.c +926 -0
- data/ext/gdk3/rbgdkgeometry.c +252 -0
- data/ext/gdk3/rbgdkkeymap.c +151 -0
- data/ext/gdk3/rbgdkkeyval.c +108 -0
- data/ext/gdk3/rbgdkpango.c +197 -0
- data/ext/gdk3/rbgdkpangorenderer.c +144 -0
- data/ext/gdk3/rbgdkpixbuf.c +176 -0
- data/ext/gdk3/rbgdkproperty.c +305 -0
- data/ext/gdk3/rbgdkrectangle.c +140 -0
- data/ext/gdk3/rbgdkrgb.c +199 -0
- data/ext/gdk3/rbgdkrgba.c +142 -0
- data/ext/gdk3/rbgdkscreen.c +443 -0
- data/ext/gdk3/rbgdkselection.c +146 -0
- data/ext/gdk3/rbgdkthreads.c +77 -0
- data/ext/gdk3/rbgdktimecoord.c +133 -0
- data/ext/gdk3/rbgdkvisual.c +251 -0
- data/ext/gdk3/rbgdkwindow.c +1044 -0
- data/ext/gdk3/rbgdkwindowattr.c +191 -0
- data/ext/gdk3/rbgdkx11.c +102 -0
- data/ext/gdk3/rbgdkx11x11window.c +66 -0
- data/extconf.rb +49 -0
- data/lib/gdk3.rb +3 -0
- data/lib/gdk3/base.rb +50 -0
- data/lib/gdk3/deprecated.rb +152 -0
- metadata +156 -0
@@ -0,0 +1,142 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
*
|
5
|
+
* This library is free software; you can redistribute it and/or
|
6
|
+
* modify it under the terms of the GNU Lesser General Public
|
7
|
+
* License as published by the Free Software Foundation; either
|
8
|
+
* version 2.1 of the License, or (at your option) any later version.
|
9
|
+
*
|
10
|
+
* This library is distributed in the hope that it will be useful,
|
11
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
13
|
+
* Lesser General Public License for more details.
|
14
|
+
*
|
15
|
+
* You should have received a copy of the GNU Lesser General Public
|
16
|
+
* License along with this library; if not, write to the Free Software
|
17
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
18
|
+
* MA 02110-1301 USA
|
19
|
+
*/
|
20
|
+
|
21
|
+
#include "rbgdk3private.h"
|
22
|
+
|
23
|
+
#define RG_TARGET_NAMESPACE cRGBA
|
24
|
+
#define _SELF(self) (RVAL2GDKRGBA(self))
|
25
|
+
|
26
|
+
static VALUE
|
27
|
+
rg_s_parse(G_GNUC_UNUSED VALUE self, VALUE spec)
|
28
|
+
{
|
29
|
+
GdkRGBA color;
|
30
|
+
if (!gdk_rgba_parse(&color, RVAL2CSTR(spec)))
|
31
|
+
rb_raise(rb_eArgError, "can't parse color representation `%s'", RVAL2CSTR(spec));
|
32
|
+
return GDKRGBA2RVAL(&color);
|
33
|
+
}
|
34
|
+
|
35
|
+
static VALUE
|
36
|
+
rg_initialize(VALUE self, VALUE red, VALUE green, VALUE blue, VALUE alpha)
|
37
|
+
{
|
38
|
+
GdkRGBA color;
|
39
|
+
|
40
|
+
color.red = NUM2DBL(red);
|
41
|
+
color.green = NUM2DBL(green);
|
42
|
+
color.blue = NUM2DBL(blue);
|
43
|
+
color.alpha = NUM2DBL(alpha);
|
44
|
+
|
45
|
+
G_INITIALIZE(self, &color);
|
46
|
+
|
47
|
+
return Qnil;
|
48
|
+
}
|
49
|
+
|
50
|
+
static VALUE
|
51
|
+
rg_red(VALUE self)
|
52
|
+
{
|
53
|
+
return DBL2NUM(_SELF(self)->red);
|
54
|
+
}
|
55
|
+
|
56
|
+
static VALUE
|
57
|
+
rg_set_red(VALUE self, VALUE red)
|
58
|
+
{
|
59
|
+
_SELF(self)->red = NUM2DBL(red);
|
60
|
+
return self;
|
61
|
+
}
|
62
|
+
|
63
|
+
static VALUE
|
64
|
+
rg_green(VALUE self)
|
65
|
+
{
|
66
|
+
return DBL2NUM(_SELF(self)->green);
|
67
|
+
}
|
68
|
+
|
69
|
+
static VALUE
|
70
|
+
rg_set_green(VALUE self, VALUE green)
|
71
|
+
{
|
72
|
+
_SELF(self)->green = NUM2DBL(green);
|
73
|
+
return self;
|
74
|
+
}
|
75
|
+
|
76
|
+
static VALUE
|
77
|
+
rg_blue(VALUE self)
|
78
|
+
{
|
79
|
+
return DBL2NUM(_SELF(self)->blue);
|
80
|
+
}
|
81
|
+
|
82
|
+
static VALUE
|
83
|
+
rg_set_blue(VALUE self, VALUE blue)
|
84
|
+
{
|
85
|
+
_SELF(self)->blue = NUM2DBL(blue);
|
86
|
+
return self;
|
87
|
+
}
|
88
|
+
|
89
|
+
static VALUE
|
90
|
+
rg_alpha(VALUE self)
|
91
|
+
{
|
92
|
+
return DBL2NUM(_SELF(self)->alpha);
|
93
|
+
}
|
94
|
+
|
95
|
+
static VALUE
|
96
|
+
rg_set_alpha(VALUE self, VALUE alpha)
|
97
|
+
{
|
98
|
+
_SELF(self)->alpha = NUM2DBL(alpha);
|
99
|
+
return self;
|
100
|
+
}
|
101
|
+
|
102
|
+
static VALUE
|
103
|
+
rg_to_a(VALUE self)
|
104
|
+
{
|
105
|
+
GdkRGBA *color = _SELF(self);
|
106
|
+
return rb_ary_new3(4, DBL2NUM(color->red),
|
107
|
+
DBL2NUM(color->green),
|
108
|
+
DBL2NUM(color->blue),
|
109
|
+
DBL2NUM(color->alpha));
|
110
|
+
}
|
111
|
+
|
112
|
+
static VALUE
|
113
|
+
rg_to_s(VALUE self)
|
114
|
+
{
|
115
|
+
return CSTR2RVAL_FREE(gdk_rgba_to_string(_SELF(self)));
|
116
|
+
}
|
117
|
+
|
118
|
+
static VALUE
|
119
|
+
rg_operator_equal(VALUE self, VALUE other)
|
120
|
+
{
|
121
|
+
return CBOOL2RVAL(gdk_rgba_equal(_SELF(self), _SELF(other)));
|
122
|
+
}
|
123
|
+
|
124
|
+
void
|
125
|
+
Init_gdk_rgba(VALUE mGdk)
|
126
|
+
{
|
127
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_RGBA, "RGBA", mGdk);
|
128
|
+
|
129
|
+
RG_DEF_SMETHOD(parse, 1);
|
130
|
+
RG_DEF_METHOD(initialize, 4);
|
131
|
+
RG_DEF_METHOD(red, 0);
|
132
|
+
RG_DEF_METHOD(set_red, 1);
|
133
|
+
RG_DEF_METHOD(green, 0);
|
134
|
+
RG_DEF_METHOD(set_green, 1);
|
135
|
+
RG_DEF_METHOD(blue, 0);
|
136
|
+
RG_DEF_METHOD(set_blue, 1);
|
137
|
+
RG_DEF_METHOD(alpha, 0);
|
138
|
+
RG_DEF_METHOD(set_alpha, 1);
|
139
|
+
RG_DEF_METHOD(to_a, 0);
|
140
|
+
RG_DEF_METHOD(to_s, 0);
|
141
|
+
RG_DEF_METHOD_OPERATOR("==", equal, 1);
|
142
|
+
}
|
@@ -0,0 +1,443 @@
|
|
1
|
+
/* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
|
2
|
+
/*
|
3
|
+
* Copyright (C) 2011 Ruby-GNOME2 Project Team
|
4
|
+
* Copyright (C) 2003-2006 Ruby-GNOME2 Project Team
|
5
|
+
* Copyright (C) 2003 Geoff Youngs
|
6
|
+
*
|
7
|
+
* This library is free software; you can redistribute it and/or
|
8
|
+
* modify it under the terms of the GNU Lesser General Public
|
9
|
+
* License as published by the Free Software Foundation; either
|
10
|
+
* version 2.1 of the License, or (at your option) any later version.
|
11
|
+
*
|
12
|
+
* This library is distributed in the hope that it will be useful,
|
13
|
+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
14
|
+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
15
|
+
* Lesser General Public License for more details.
|
16
|
+
*
|
17
|
+
* You should have received a copy of the GNU Lesser General Public
|
18
|
+
* License along with this library; if not, write to the Free Software
|
19
|
+
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
20
|
+
* MA 02110-1301 USA
|
21
|
+
*/
|
22
|
+
|
23
|
+
#include "rbgdk3private.h"
|
24
|
+
#ifdef HAVE_RB_CAIRO_H
|
25
|
+
#include <rb_cairo.h>
|
26
|
+
#endif
|
27
|
+
|
28
|
+
#define RG_TARGET_NAMESPACE cScreen
|
29
|
+
#define _SELF(i) RVAL2GDKSCREEN(i)
|
30
|
+
|
31
|
+
static ID id_new;
|
32
|
+
|
33
|
+
static VALUE
|
34
|
+
rg_s_default(G_GNUC_UNUSED VALUE self)
|
35
|
+
{
|
36
|
+
return GOBJ2RVAL(gdk_screen_get_default());
|
37
|
+
}
|
38
|
+
|
39
|
+
/* deprecated
|
40
|
+
static VALUE
|
41
|
+
rg_default_colormap(VALUE self)
|
42
|
+
{
|
43
|
+
return GOBJ2RVAL(gdk_screen_get_default_colormap(_SELF(self)));
|
44
|
+
}
|
45
|
+
|
46
|
+
static VALUE
|
47
|
+
rg_set_default_colormap(VALUE self, VALUE colormap)
|
48
|
+
{
|
49
|
+
gdk_screen_set_default_colormap(_SELF(self),
|
50
|
+
RVAL2GDKCOLORMAP(colormap));
|
51
|
+
return self;
|
52
|
+
}
|
53
|
+
|
54
|
+
static VALUE
|
55
|
+
rg_system_colormap(VALUE self)
|
56
|
+
{
|
57
|
+
return GOBJ2RVAL(gdk_screen_get_system_colormap(_SELF(self)));
|
58
|
+
}
|
59
|
+
*/
|
60
|
+
|
61
|
+
static VALUE
|
62
|
+
rg_system_visual(VALUE self)
|
63
|
+
{
|
64
|
+
return GOBJ2RVAL(gdk_screen_get_system_visual(_SELF(self)));
|
65
|
+
}
|
66
|
+
|
67
|
+
/* deprecated
|
68
|
+
static VALUE
|
69
|
+
rg_rgb_colormap(VALUE self)
|
70
|
+
{
|
71
|
+
return GOBJ2RVAL(gdk_screen_get_rgb_colormap(_SELF(self)));
|
72
|
+
}
|
73
|
+
|
74
|
+
static VALUE
|
75
|
+
rg_rgb_visual(VALUE self)
|
76
|
+
{
|
77
|
+
return GOBJ2RVAL(gdk_screen_get_rgb_visual(_SELF(self)));
|
78
|
+
}
|
79
|
+
*/
|
80
|
+
|
81
|
+
/* deprecated
|
82
|
+
static VALUE
|
83
|
+
rg_rgba_colormap(VALUE self)
|
84
|
+
{
|
85
|
+
return GOBJ2RVAL(gdk_screen_get_rgba_colormap(_SELF(self)));
|
86
|
+
}
|
87
|
+
*/
|
88
|
+
|
89
|
+
static VALUE
|
90
|
+
rg_rgba_visual(VALUE self)
|
91
|
+
{
|
92
|
+
return GOBJ2RVAL(gdk_screen_get_rgba_visual(_SELF(self)));
|
93
|
+
}
|
94
|
+
|
95
|
+
static VALUE
|
96
|
+
rg_composited_p(VALUE self)
|
97
|
+
{
|
98
|
+
return CBOOL2RVAL(gdk_screen_is_composited(_SELF(self)));
|
99
|
+
}
|
100
|
+
|
101
|
+
static VALUE
|
102
|
+
rg_root_window(VALUE self)
|
103
|
+
{
|
104
|
+
return GOBJ2RVAL(gdk_screen_get_root_window(_SELF(self)));
|
105
|
+
}
|
106
|
+
|
107
|
+
static VALUE
|
108
|
+
rg_display(VALUE self)
|
109
|
+
{
|
110
|
+
return GOBJ2RVAL(gdk_screen_get_display(_SELF(self)));
|
111
|
+
}
|
112
|
+
|
113
|
+
static VALUE
|
114
|
+
rg_number(VALUE self)
|
115
|
+
{
|
116
|
+
return INT2NUM(gdk_screen_get_number(_SELF(self)));
|
117
|
+
}
|
118
|
+
static VALUE
|
119
|
+
rg_width(VALUE self)
|
120
|
+
{
|
121
|
+
return INT2NUM(gdk_screen_get_width(_SELF(self)));
|
122
|
+
}
|
123
|
+
static VALUE
|
124
|
+
rg_height(VALUE self)
|
125
|
+
{
|
126
|
+
return INT2NUM(gdk_screen_get_height(_SELF(self)));
|
127
|
+
}
|
128
|
+
static VALUE
|
129
|
+
rg_width_mm(VALUE self)
|
130
|
+
{
|
131
|
+
return INT2NUM(gdk_screen_get_width_mm(_SELF(self)));
|
132
|
+
}
|
133
|
+
static VALUE
|
134
|
+
rg_height_mm(VALUE self)
|
135
|
+
{
|
136
|
+
return INT2NUM(gdk_screen_get_height_mm(_SELF(self)));
|
137
|
+
}
|
138
|
+
|
139
|
+
static VALUE
|
140
|
+
rg_visuals(VALUE self)
|
141
|
+
{
|
142
|
+
return GOBJGLIST2RVAL_FREE(gdk_screen_list_visuals(_SELF(self)),
|
143
|
+
g_list_free, NULL);
|
144
|
+
}
|
145
|
+
|
146
|
+
static VALUE
|
147
|
+
rg_toplevel_windows(VALUE self)
|
148
|
+
{
|
149
|
+
return GOBJGLIST2RVAL_FREE(gdk_screen_get_toplevel_windows(_SELF(self)),
|
150
|
+
g_list_free, NULL);
|
151
|
+
}
|
152
|
+
|
153
|
+
static VALUE
|
154
|
+
rg_display_name(VALUE self)
|
155
|
+
{
|
156
|
+
gchar* name = gdk_screen_make_display_name(_SELF(self));
|
157
|
+
VALUE ret = CSTR2RVAL(name);
|
158
|
+
g_free(name);
|
159
|
+
return ret;
|
160
|
+
}
|
161
|
+
|
162
|
+
static VALUE
|
163
|
+
rg_n_monitors(VALUE self)
|
164
|
+
{
|
165
|
+
return INT2NUM(gdk_screen_get_n_monitors(_SELF(self)));
|
166
|
+
}
|
167
|
+
|
168
|
+
static VALUE
|
169
|
+
rg_monitor_geometry(VALUE self, VALUE num)
|
170
|
+
{
|
171
|
+
GdkRectangle rect;
|
172
|
+
gdk_screen_get_monitor_geometry(_SELF(self), NUM2INT(num), &rect);
|
173
|
+
return GDKRECTANGLE2RVAL(&rect);
|
174
|
+
}
|
175
|
+
|
176
|
+
static VALUE
|
177
|
+
rg_get_monitor(int argc, VALUE *argv, VALUE self)
|
178
|
+
{
|
179
|
+
VALUE arg1, arg2;
|
180
|
+
VALUE ret;
|
181
|
+
|
182
|
+
rb_scan_args(argc, argv, "11", &arg1, &arg2);
|
183
|
+
if (argc == 2){
|
184
|
+
ret = INT2NUM(gdk_screen_get_monitor_at_point(_SELF(self),
|
185
|
+
NUM2INT(arg1), NUM2INT(arg2)));
|
186
|
+
} else if (argc == 1){
|
187
|
+
ret = INT2NUM(gdk_screen_get_monitor_at_window(_SELF(self),
|
188
|
+
RVAL2GDKWINDOW(arg1)));
|
189
|
+
} else {
|
190
|
+
rb_raise(rb_eArgError, "Wrong number of arguments: %d", argc);
|
191
|
+
}
|
192
|
+
return ret;
|
193
|
+
}
|
194
|
+
|
195
|
+
/* deprecated
|
196
|
+
static VALUE
|
197
|
+
rg_broadcast_client_message(VALUE self, VALUE event)
|
198
|
+
{
|
199
|
+
gdk_screen_broadcast_client_message(_SELF(self), RVAL2GEV(event));
|
200
|
+
return self;
|
201
|
+
}
|
202
|
+
*/
|
203
|
+
|
204
|
+
/*
|
205
|
+
type: String, Integer, Gdk::Color.
|
206
|
+
*/
|
207
|
+
static VALUE
|
208
|
+
rg_get_setting(int argc, VALUE *argv, VALUE self)
|
209
|
+
{
|
210
|
+
VALUE name, type;
|
211
|
+
GType gtype;
|
212
|
+
GValue val = G_VALUE_INIT;
|
213
|
+
gboolean ret;
|
214
|
+
VALUE value;
|
215
|
+
|
216
|
+
rb_scan_args(argc, argv, "11", &name, &type);
|
217
|
+
if NIL_P(type)
|
218
|
+
gtype = G_TYPE_STRING;
|
219
|
+
else
|
220
|
+
gtype = CLASS2GTYPE(type);
|
221
|
+
|
222
|
+
g_value_init(&val, gtype);
|
223
|
+
ret = gdk_screen_get_setting(_SELF(self), RVAL2CSTR(name), &val);
|
224
|
+
value = ret ? GVAL2RVAL(&val) : Qnil;
|
225
|
+
g_value_unset(&val);
|
226
|
+
return value;
|
227
|
+
}
|
228
|
+
|
229
|
+
#ifdef HAVE_RB_CAIRO_H
|
230
|
+
static VALUE
|
231
|
+
gdkscreen_get_font_options(VALUE self)
|
232
|
+
{
|
233
|
+
return CRFONTOPTIONS2RVAL((cairo_font_options_t *)gdk_screen_get_font_options(_SELF(self)));
|
234
|
+
}
|
235
|
+
|
236
|
+
static VALUE
|
237
|
+
gdkscreen_set_font_options(VALUE self, VALUE options)
|
238
|
+
{
|
239
|
+
gdk_screen_set_font_options(_SELF(self),
|
240
|
+
(const cairo_font_options_t *)RVAL2CRFONTOPTIONS(options));
|
241
|
+
return self;
|
242
|
+
}
|
243
|
+
#endif
|
244
|
+
|
245
|
+
static VALUE
|
246
|
+
rg_active_window(VALUE self)
|
247
|
+
{
|
248
|
+
return GOBJ2RVAL(gdk_screen_get_active_window(_SELF(self)));
|
249
|
+
}
|
250
|
+
|
251
|
+
static VALUE
|
252
|
+
rg_window_stack(VALUE self)
|
253
|
+
{
|
254
|
+
GList* list = gdk_screen_get_window_stack(_SELF(self));
|
255
|
+
VALUE ary = rb_ary_new();
|
256
|
+
while (list) {
|
257
|
+
rb_ary_push(ary, GOBJ2RVAL(list->data));
|
258
|
+
g_object_unref(list->data);
|
259
|
+
list = list->next;
|
260
|
+
}
|
261
|
+
g_list_free(list);
|
262
|
+
return ary;
|
263
|
+
}
|
264
|
+
|
265
|
+
static void
|
266
|
+
child_setup(gpointer func)
|
267
|
+
{
|
268
|
+
if (! NIL_P(func)){
|
269
|
+
rb_funcall((VALUE)func, id_call, 0);
|
270
|
+
}
|
271
|
+
}
|
272
|
+
|
273
|
+
/* deprecated
|
274
|
+
static VALUE
|
275
|
+
rg_spawn_on_screen(VALUE self, VALUE working_directory, VALUE argv, VALUE envp, VALUE flags)
|
276
|
+
{
|
277
|
+
GError *err = NULL;
|
278
|
+
gboolean ret;
|
279
|
+
gint child_pid;
|
280
|
+
VALUE func = Qnil;
|
281
|
+
gchar **gargv;
|
282
|
+
gchar **genvp;
|
283
|
+
|
284
|
+
if (rb_block_given_p()) {
|
285
|
+
func = rb_block_proc();
|
286
|
+
G_RELATIVE(self, func);
|
287
|
+
}
|
288
|
+
|
289
|
+
gargv = (gchar **)RVAL2STRV(argv);
|
290
|
+
genvp = (gchar **)RVAL2STRV_ACCEPT_NIL(envp);
|
291
|
+
ret = gdk_spawn_on_screen(_SELF(self),
|
292
|
+
RVAL2CSTR_ACCEPT_NIL(working_directory),
|
293
|
+
gargv, genvp, NUM2INT(flags),
|
294
|
+
(GSpawnChildSetupFunc)child_setup, (gpointer)func,
|
295
|
+
&child_pid, &err);
|
296
|
+
g_free(gargv);
|
297
|
+
g_free(genvp);
|
298
|
+
if (!ret)
|
299
|
+
RAISE_GERROR(err);
|
300
|
+
|
301
|
+
return INT2NUM(child_pid);
|
302
|
+
}
|
303
|
+
|
304
|
+
static VALUE
|
305
|
+
rg_spawn_on_screen_with_pipes(VALUE self, VALUE working_directory, VALUE argv, VALUE envp, VALUE flags)
|
306
|
+
{
|
307
|
+
GError *err = NULL;
|
308
|
+
gboolean ret;
|
309
|
+
gint child_pid;
|
310
|
+
VALUE func = Qnil;
|
311
|
+
gchar **gargv;
|
312
|
+
gchar **genvp;
|
313
|
+
gint standard_input, standard_output, standard_error;
|
314
|
+
|
315
|
+
if (rb_block_given_p()) {
|
316
|
+
func = rb_block_proc();
|
317
|
+
G_RELATIVE(self, func);
|
318
|
+
}
|
319
|
+
|
320
|
+
gargv = (gchar **)RVAL2STRV(argv);
|
321
|
+
genvp = (gchar **)RVAL2STRV_ACCEPT_NIL(envp);
|
322
|
+
ret = gdk_spawn_on_screen_with_pipes(_SELF(self),
|
323
|
+
RVAL2CSTR_ACCEPT_NIL(working_directory),
|
324
|
+
gargv, genvp, NUM2INT(flags),
|
325
|
+
(GSpawnChildSetupFunc)child_setup, (gpointer)func,
|
326
|
+
&child_pid,
|
327
|
+
&standard_input, &standard_output,
|
328
|
+
&standard_error, &err);
|
329
|
+
g_free(gargv);
|
330
|
+
g_free(genvp);
|
331
|
+
if (!ret)
|
332
|
+
RAISE_GERROR(err);
|
333
|
+
|
334
|
+
return rb_ary_new3(4, INT2NUM(child_pid),
|
335
|
+
rb_funcall(rb_cIO, id_new, 1, INT2NUM(standard_input)),
|
336
|
+
rb_funcall(rb_cIO, id_new, 1, INT2NUM(standard_output)),
|
337
|
+
rb_funcall(rb_cIO, id_new, 1, INT2NUM(standard_error)));
|
338
|
+
}
|
339
|
+
*/
|
340
|
+
|
341
|
+
static VALUE
|
342
|
+
rg_spawn_command_line_on_screen(G_GNUC_UNUSED VALUE self, VALUE command_line)
|
343
|
+
{
|
344
|
+
GError *err = NULL;
|
345
|
+
VALUE ret;
|
346
|
+
|
347
|
+
ret = CBOOL2RVAL(g_spawn_command_line_async(RVAL2CSTR(command_line), &err));
|
348
|
+
if (!ret) RAISE_GERROR(err);
|
349
|
+
|
350
|
+
return ret;
|
351
|
+
}
|
352
|
+
|
353
|
+
/* From X Window System Interaction */
|
354
|
+
#ifdef GDK_WINDOWING_X11
|
355
|
+
#include <gdk/gdkx.h>
|
356
|
+
static VALUE
|
357
|
+
rg_xnumber(VALUE self)
|
358
|
+
{
|
359
|
+
return INT2NUM(GDK_SCREEN_XNUMBER(_SELF(self)));
|
360
|
+
}
|
361
|
+
static VALUE
|
362
|
+
rg_supports_net_wm_hint_p(VALUE self, VALUE property)
|
363
|
+
{
|
364
|
+
return CBOOL2RVAL(gdk_x11_screen_supports_net_wm_hint(_SELF(self),
|
365
|
+
RVAL2ATOM(property)));
|
366
|
+
}
|
367
|
+
|
368
|
+
static VALUE
|
369
|
+
rg_window_manager_name(VALUE self)
|
370
|
+
{
|
371
|
+
return CSTR2RVAL(gdk_x11_screen_get_window_manager_name(_SELF(self)));
|
372
|
+
}
|
373
|
+
static VALUE
|
374
|
+
rg_screen_number(VALUE self)
|
375
|
+
{
|
376
|
+
return INT2NUM(gdk_x11_screen_get_screen_number(_SELF(self)));
|
377
|
+
}
|
378
|
+
#endif
|
379
|
+
|
380
|
+
void
|
381
|
+
Init_gdk_screen(VALUE mGdk)
|
382
|
+
{
|
383
|
+
VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_SCREEN, "Screen", mGdk);
|
384
|
+
|
385
|
+
id_new = rb_intern("new");
|
386
|
+
|
387
|
+
RG_DEF_SMETHOD(default, 0);
|
388
|
+
/* deprecated
|
389
|
+
RG_DEF_METHOD(default_colormap, 0);
|
390
|
+
RG_DEF_METHOD(set_default_colormap, 1);
|
391
|
+
RG_DEF_METHOD(system_colormap, 0);
|
392
|
+
*/
|
393
|
+
RG_DEF_METHOD(system_visual, 0);
|
394
|
+
/* deprecated
|
395
|
+
RG_DEF_METHOD(rgb_colormap, 0);
|
396
|
+
RG_DEF_METHOD(rgb_visual, 0);
|
397
|
+
*/
|
398
|
+
/* deprecated
|
399
|
+
RG_DEF_METHOD(rgba_colormap, 0);
|
400
|
+
*/
|
401
|
+
RG_DEF_METHOD(rgba_visual, 0);
|
402
|
+
RG_DEF_METHOD_P(composited, 0);
|
403
|
+
RG_DEF_METHOD(root_window, 0);
|
404
|
+
RG_DEF_METHOD(display, 0);
|
405
|
+
RG_DEF_METHOD(number, 0);
|
406
|
+
RG_DEF_METHOD(width, 0);
|
407
|
+
RG_DEF_METHOD(height, 0);
|
408
|
+
RG_DEF_METHOD(width_mm, 0);
|
409
|
+
RG_DEF_METHOD(height_mm, 0);
|
410
|
+
RG_DEF_METHOD(visuals, 0);
|
411
|
+
RG_DEF_METHOD(toplevel_windows, 0);
|
412
|
+
RG_DEF_METHOD(display_name, 0);
|
413
|
+
RG_DEF_METHOD(n_monitors, 0);
|
414
|
+
RG_DEF_METHOD(monitor_geometry, 1);
|
415
|
+
RG_DEF_METHOD(get_monitor, -1);
|
416
|
+
/* deprecated
|
417
|
+
RG_DEF_METHOD(broadcast_client_message, 1);
|
418
|
+
*/
|
419
|
+
RG_DEF_METHOD(get_setting, -1);
|
420
|
+
#ifdef HAVE_RB_CAIRO_H
|
421
|
+
G_REPLACE_GET_PROPERTY(RG_TARGET_NAMESPACE, "font_options", gdkscreen_get_font_options, 0);
|
422
|
+
G_REPLACE_SET_PROPERTY(RG_TARGET_NAMESPACE, "font_options", gdkscreen_set_font_options, 1);
|
423
|
+
#endif
|
424
|
+
RG_DEF_METHOD(active_window, 0);
|
425
|
+
RG_DEF_METHOD(window_stack, 0);
|
426
|
+
|
427
|
+
/* deprecated
|
428
|
+
RG_DEF_METHOD(spawn_on_screen, 4);
|
429
|
+
RG_DEF_METHOD(spawn_on_screen_with_pipes, 4);
|
430
|
+
*/
|
431
|
+
RG_DEF_METHOD(spawn_command_line_on_screen, 1);
|
432
|
+
|
433
|
+
#ifdef GDK_WINDOWING_X11
|
434
|
+
RG_DEF_METHOD(xnumber, 0);
|
435
|
+
RG_DEF_METHOD_P(supports_net_wm_hint, 0);
|
436
|
+
RG_DEF_METHOD(window_manager_name, 0);
|
437
|
+
RG_DEF_METHOD(screen_number, 0);
|
438
|
+
#endif
|
439
|
+
|
440
|
+
#ifdef GDK_WINDOWING_X11
|
441
|
+
G_DEF_CLASS3("GdkScreenX11", "ScreenX11", mGdk);
|
442
|
+
#endif
|
443
|
+
}
|