gdk3 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +18 -4
  3. data/lib/gdk3/atom.rb +26 -0
  4. data/lib/gdk3/cairo.rb +60 -0
  5. data/lib/gdk3/color.rb +27 -0
  6. data/lib/gdk3/deprecated.rb +14 -16
  7. data/lib/gdk3/event.rb +38 -0
  8. data/lib/gdk3/loader.rb +266 -0
  9. data/lib/gdk3/rectangle.rb +38 -0
  10. data/lib/gdk3/rgba.rb +32 -0
  11. data/lib/gdk3/window-attr.rb +28 -0
  12. data/lib/gdk3/window.rb +21 -0
  13. data/lib/gdk3.rb +61 -2
  14. data/test/run-test.rb +15 -6
  15. data/test/test-gdk-cairo.rb +41 -0
  16. data/test/test-gdk-event-type.rb +25 -0
  17. data/test/test-gdk-event.rb +47 -49
  18. data/test/test-gdk-keyval.rb +21 -0
  19. data/test/test-gdk-pixbuf.rb +49 -0
  20. data/test/test-gdk-rectangle.rb +35 -4
  21. data/test/test-gdk-rgba.rb +6 -1
  22. data/test/test-gdk-window-attr.rb +1 -1
  23. metadata +23 -51
  24. data/ext/gdk3/depend +0 -11
  25. data/ext/gdk3/extconf.rb +0 -130
  26. data/ext/gdk3/gdk3.def +0 -12
  27. data/ext/gdk3/init.c +0 -35
  28. data/ext/gdk3/rbgdk.c +0 -491
  29. data/ext/gdk3/rbgdk3.h +0 -73
  30. data/ext/gdk3/rbgdk3conversions.h +0 -121
  31. data/ext/gdk3/rbgdk3private.h +0 -85
  32. data/ext/gdk3/rbgdkatom.c +0 -122
  33. data/ext/gdk3/rbgdkcairo.c +0 -91
  34. data/ext/gdk3/rbgdkcolor.c +0 -137
  35. data/ext/gdk3/rbgdkconst.c +0 -33
  36. data/ext/gdk3/rbgdkcursor.c +0 -92
  37. data/ext/gdk3/rbgdkdevice.c +0 -253
  38. data/ext/gdk3/rbgdkdevicemanager.c +0 -39
  39. data/ext/gdk3/rbgdkdisplay.c +0 -434
  40. data/ext/gdk3/rbgdkdisplaymanager.c +0 -55
  41. data/ext/gdk3/rbgdkdragcontext.c +0 -191
  42. data/ext/gdk3/rbgdkevent.c +0 -1173
  43. data/ext/gdk3/rbgdkgeometry.c +0 -253
  44. data/ext/gdk3/rbgdkkeymap.c +0 -151
  45. data/ext/gdk3/rbgdkkeyval.c +0 -108
  46. data/ext/gdk3/rbgdkpango.c +0 -197
  47. data/ext/gdk3/rbgdkpangorenderer.c +0 -144
  48. data/ext/gdk3/rbgdkpixbuf.c +0 -176
  49. data/ext/gdk3/rbgdkproperty.c +0 -305
  50. data/ext/gdk3/rbgdkrectangle.c +0 -140
  51. data/ext/gdk3/rbgdkrgb.c +0 -199
  52. data/ext/gdk3/rbgdkrgba.c +0 -142
  53. data/ext/gdk3/rbgdkscreen.c +0 -443
  54. data/ext/gdk3/rbgdkselection.c +0 -146
  55. data/ext/gdk3/rbgdkthreads.c +0 -77
  56. data/ext/gdk3/rbgdktimecoord.c +0 -133
  57. data/ext/gdk3/rbgdkvisual.c +0 -251
  58. data/ext/gdk3/rbgdkwindow.c +0 -1069
  59. data/ext/gdk3/rbgdkwindowattr.c +0 -191
  60. data/ext/gdk3/rbgdkx11.c +0 -102
  61. data/ext/gdk3/rbgdkx11x11window.c +0 -66
  62. data/extconf.rb +0 -49
  63. data/lib/gdk3/base.rb +0 -59
@@ -1,253 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011-2013 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2003-2006 Masao Mutoh
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License, or (at your option) any later version.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
- * MA 02110-1301 USA
20
- */
21
-
22
- #include "rbgdk3private.h"
23
-
24
- #define RG_TARGET_NAMESPACE cDevice
25
- #define _SELF(self) (RVAL2GDKDEVICE(self))
26
-
27
- /* deprecated
28
- static VALUE
29
- rg_s_list(G_GNUC_UNUSED VALUE self)
30
- {
31
- return GOBJGLIST2RVAL(gdk_devices_list());
32
- }
33
-
34
- static VALUE
35
- rg_s_set_extension_events(G_GNUC_UNUSED VALUE self, VALUE window, VALUE mask, VALUE mode)
36
- {
37
- gdk_input_set_extension_events(RVAL2GDKWINDOW(window),
38
- NUM2INT(mask), FIX2INT(mode));
39
- return Qnil;
40
- }
41
-
42
- static VALUE
43
- rg_s_core_pointer(G_GNUC_UNUSED VALUE self)
44
- {
45
- return GOBJ2RVAL(gdk_device_get_core_pointer());
46
- }
47
-
48
- static VALUE
49
- rg_set_source(VALUE self, VALUE source)
50
- {
51
- gdk_device_set_source(_SELF(self), RVAL2GDKINPUTSOURCE(source));
52
- return self;
53
- }
54
- */
55
-
56
- static VALUE
57
- rg_set_mode(VALUE self, VALUE mode)
58
- {
59
- return CBOOL2RVAL(gdk_device_set_mode(_SELF(self), RVAL2GDKINPUTMODE(mode)));
60
- }
61
-
62
- static VALUE
63
- rg_set_key(VALUE self, VALUE index, VALUE keyval, VALUE modifiers)
64
- {
65
- gdk_device_set_key(_SELF(self), NUM2UINT(index), NUM2UINT(keyval),
66
- RVAL2GDKMODIFIERTYPE(modifiers));
67
- return self;
68
- }
69
-
70
- static VALUE
71
- rg_set_axis_use(VALUE self, VALUE index, VALUE use)
72
- {
73
- gdk_device_set_axis_use(_SELF(self), NUM2UINT(index),
74
- RVAL2GDKAXISUSE(use));
75
- return self;
76
- }
77
-
78
- static VALUE
79
- rg_get_state(VALUE self, VALUE window)
80
- {
81
- gdouble axes[2];
82
- GdkModifierType mask;
83
-
84
- gdk_device_get_state(_SELF(self), RVAL2GDKWINDOW(window),
85
- axes, &mask);
86
- return rb_ary_new3(3, rb_float_new(axes[0]), rb_float_new(axes[1]),
87
- GDKMODIFIERTYPE2RVAL(mask));
88
- }
89
-
90
- static VALUE
91
- rg_get_history(VALUE self, VALUE window, VALUE start, VALUE stop)
92
- {
93
- gboolean ret;
94
- GdkTimeCoord** events;
95
- gint i, n_events;
96
- VALUE ary = Qnil;
97
- ret = gdk_device_get_history(_SELF(self),
98
- RVAL2GDKWINDOW(window),
99
- NUM2UINT(start), NUM2UINT(stop),
100
- &events, &n_events);
101
- if (ret){
102
- ary = rb_ary_new();
103
- for (i = 0; i < n_events; i++){
104
- rb_ary_push(ary, GDKTIMECOORD2RVAL(events));
105
- }
106
- gdk_device_free_history(events, n_events);
107
- }
108
- return ary;
109
- }
110
-
111
- static VALUE
112
- rg_get_axis(VALUE self, VALUE rbaxes, VALUE rbuse)
113
- {
114
- GdkDevice *device = _SELF(self);
115
- GdkAxisUse use = RVAL2GDKAXISUSE(rbuse);
116
- long n;
117
- gdouble *axes = RVAL2GDOUBLES(rbaxes, n);
118
- gint device_n_axes = gdk_device_get_n_axes(device);
119
- gdouble value;
120
- gboolean found;
121
-
122
- if (n != device_n_axes)
123
- rb_raise(rb_eArgError,
124
- "unexpected number of axes: %ld != %d",
125
- n, device_n_axes);
126
-
127
- found = gdk_device_get_axis(device, axes, use, &value);
128
-
129
- g_free(axes);
130
-
131
- return found ? DBL2NUM(value) : Qnil;
132
- }
133
-
134
- static VALUE
135
- rg_mode(VALUE self)
136
- {
137
- return GDKINPUTMODE2RVAL(gdk_device_get_mode(_SELF(self)));
138
- }
139
-
140
- static VALUE
141
- rg_get_window_at_position(G_GNUC_UNUSED VALUE self)
142
- {
143
- gint x, y;
144
- GdkWindow *win = gdk_device_get_window_at_position(_SELF(self), &x ,&y);
145
- return rb_ary_new3(3, GOBJ2RVAL(win), INT2FIX(x), INT2FIX(y));
146
- }
147
-
148
- static VALUE
149
- rg_ungrab(int argc, VALUE *argv, VALUE self)
150
- {
151
- VALUE rb_time;
152
- guint32 time = GDK_CURRENT_TIME;
153
-
154
- rb_scan_args(argc, argv, "01", &rb_time);
155
- if (!NIL_P(rb_time)) {
156
- time = NUM2UINT(GDK_CURRENT_TIME);
157
- }
158
- gdk_device_ungrab(_SELF(self), time);
159
- return self;
160
- }
161
-
162
- static VALUE
163
- rg_get_position(VALUE self)
164
- {
165
- GdkScreen *screen;
166
- gint x, y;
167
- gdk_device_get_position(_SELF(self), &screen, &x, &y);
168
- return rb_ary_new3(3, GOBJ2RVAL(screen), INT2NUM(x), INT2NUM(y));
169
- }
170
-
171
- static VALUE
172
- rg_warp(VALUE self, VALUE screen, VALUE x, VALUE y)
173
- {
174
- gdk_device_warp(_SELF(self), RVAL2GDKSCREEN(screen), NUM2INT(x), NUM2INT(y));
175
- return self;
176
- }
177
-
178
- static VALUE
179
- rg_grab(VALUE self, VALUE win, VALUE grab_ownership, VALUE owner_events, VALUE event_mask, VALUE cursor, VALUE time)
180
- {
181
- return GDKGRABSTATUS2RVAL(gdk_device_grab(_SELF(self),
182
- RVAL2GDKWINDOW(win),
183
- RVAL2GDKGRABOWNERSHIP(grab_ownership),
184
- RVAL2CBOOL(owner_events),
185
- RVAL2GDKEVENTMASK(event_mask),
186
- RVAL2GDKCURSOR(cursor),
187
- NUM2INT(time)));
188
- }
189
-
190
- /* deprecated
191
- static VALUE
192
- rg_axes(VALUE self)
193
- {
194
- gint i;
195
- VALUE ary = rb_ary_new();
196
- GdkDeviceAxis* axes = _SELF(self)->axes;
197
-
198
- for (i = 0; i < _SELF(self)->num_axes; i++){
199
- rb_ary_push(ary, rb_ary_new3(3, GDKAXISUSE2RVAL(axes[i].use),
200
- rb_float_new(axes[i].min), rb_float_new(axes[i].max)));
201
- }
202
- return ary;
203
- }
204
-
205
- static VALUE
206
- rg_keys(VALUE self)
207
- {
208
- gint i;
209
- VALUE ary = rb_ary_new();
210
- GdkDeviceKey* keys = _SELF(self)->keys;
211
-
212
- for (i = 0; i < _SELF(self)->num_keys; i++){
213
- rb_ary_push(ary, rb_ary_new3(2, UINT2NUM(keys[i].keyval),
214
- GDKMODIFIERTYPE2RVAL(keys[i].modifiers)));
215
- }
216
- return ary;
217
- }
218
- */
219
-
220
- void
221
- Init_gdk_device(VALUE mGdk)
222
- {
223
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_DEVICE, "Device", mGdk);
224
-
225
- /* deprecated
226
- RG_DEF_SMETHOD(list, 0);
227
- RG_DEF_SMETHOD(set_extension_events, 3);
228
- RG_DEF_SMETHOD(core_pointer, 0);
229
-
230
- RG_DEF_METHOD(set_source, 1);
231
- */
232
- RG_DEF_METHOD(set_mode, 1);
233
- RG_DEF_METHOD(set_key, 3);
234
- RG_DEF_METHOD(set_axis_use, 2);
235
- RG_DEF_METHOD(get_state, 1);
236
- RG_DEF_METHOD(get_history, 3);
237
- RG_DEF_METHOD(get_axis, 2);
238
- RG_DEF_METHOD(mode, 0);
239
- RG_DEF_METHOD(get_window_at_position, 0);
240
- RG_DEF_METHOD(ungrab, -1);
241
- RG_DEF_METHOD(get_position, 0);
242
- RG_DEF_METHOD(warp, 3);
243
- RG_DEF_METHOD(grab, 6);
244
-
245
- /* deprecated
246
- RG_DEF_METHOD(axes, 0);
247
- RG_DEF_METHOD(keys, 0);
248
- */
249
-
250
- G_DEF_CLASS(GDK_TYPE_INPUT_SOURCE, "InputSource", RG_TARGET_NAMESPACE);
251
- G_DEF_CLASS(GDK_TYPE_INPUT_MODE, "InputMode", RG_TARGET_NAMESPACE);
252
- G_DEF_CLASS(GDK_TYPE_AXIS_USE, "AxisUse", RG_TARGET_NAMESPACE);
253
- }
@@ -1,39 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2013-2014 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 cDeviceManager
24
- #define _SELF(obj) RVAL2GDKDEVICEMANAGER(obj)
25
-
26
- static VALUE
27
- rg_devices(VALUE self)
28
- {
29
- return GOBJGLIST2RVAL_FREE(gdk_device_manager_list_devices(_SELF(self), GDK_TYPE_DEVICE),
30
- g_list_free, NULL);
31
- }
32
-
33
- void
34
- Init_gdk_device_manager(VALUE mGdk)
35
- {
36
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_DEVICE_MANAGER, "DeviceManager", mGdk);
37
-
38
- RG_DEF_METHOD(devices, 0);
39
- }
@@ -1,434 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2002-2005 Ruby-GNOME2 Project Team
5
- *
6
- * This library is free software; you can redistribute it and/or
7
- * modify it under the terms of the GNU Lesser General Public
8
- * License as published by the Free Software Foundation; either
9
- * version 2.1 of the License, or (at your option) any later version.
10
- *
11
- * This library is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
- * Lesser General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Lesser General Public
17
- * License along with this library; if not, write to the Free Software
18
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19
- * MA 02110-1301 USA
20
- */
21
-
22
- #include "rbgdk3private.h"
23
-
24
- #define RG_TARGET_NAMESPACE cDisplay
25
- #define _SELF(i) RVAL2GDKDISPLAYOBJECT(i)
26
-
27
- static VALUE
28
- rg_close(VALUE self)
29
- {
30
- gdk_display_close(_SELF(self));
31
- return self;
32
- }
33
-
34
- static VALUE
35
- rg_s_open(G_GNUC_UNUSED VALUE self, VALUE display_name)
36
- {
37
- GdkDisplay* gdisplay = gdk_display_open(RVAL2CSTR(display_name));
38
- if (! gdisplay) {
39
- rb_raise(rb_eRuntimeError, "The display `%s' could not be opened.",
40
- RVAL2CSTR(display_name));
41
- } else {
42
- VALUE display;
43
- g_object_ref(gdisplay);
44
- display = GOBJ2RVAL(gdisplay);
45
-
46
- if (rb_block_given_p()) {
47
- rb_ensure(rb_yield, display, rg_close, display);
48
- return Qnil;
49
- } else {
50
- return display;
51
- }
52
- }
53
- }
54
-
55
- static VALUE
56
- rg_s_default(G_GNUC_UNUSED VALUE self)
57
- {
58
- GdkDisplay* gdisplay = gdk_display_get_default();
59
- if (! gdisplay)
60
- rb_raise(rb_eRuntimeError, "No default display is found.");
61
-
62
- return GOBJ2RVAL(gdisplay);
63
- }
64
-
65
- static VALUE
66
- rg_name(VALUE self)
67
- {
68
- return CSTR2RVAL(gdk_display_get_name(_SELF(self)));
69
- }
70
-
71
- static VALUE
72
- rg_n_screens(VALUE self)
73
- {
74
- return INT2NUM(gdk_display_get_n_screens(_SELF(self)));
75
- }
76
-
77
- static VALUE
78
- rg_get_screen(VALUE self, VALUE num)
79
- {
80
- return GOBJ2RVAL(gdk_display_get_screen(_SELF(self), NUM2INT(num)));
81
- }
82
-
83
- static VALUE
84
- rg_default_screen(VALUE self)
85
- {
86
- return GOBJ2RVAL(gdk_display_get_default_screen(_SELF(self)));
87
- }
88
-
89
- static VALUE
90
- rg_device_manager(VALUE self)
91
- {
92
- return GOBJ2RVAL(gdk_display_get_device_manager(_SELF(self)));
93
- }
94
-
95
- static VALUE
96
- rg_device_is_grabbed_p(VALUE self, VALUE device)
97
- {
98
- return CBOOL2RVAL(gdk_display_device_is_grabbed(_SELF(self), RVAL2GDKDEVICE(device)));
99
- }
100
-
101
- static VALUE
102
- rg_beep(VALUE self)
103
- {
104
- gdk_display_beep(_SELF(self));
105
- return self;
106
- }
107
-
108
- static VALUE
109
- rg_sync(VALUE self)
110
- {
111
- gdk_display_sync(_SELF(self));
112
- return self;
113
- }
114
-
115
- static VALUE
116
- rg_flush(VALUE self)
117
- {
118
- gdk_display_flush(_SELF(self));
119
- return self;
120
- }
121
-
122
- static VALUE
123
- rg_event(VALUE self)
124
- {
125
- return GEV2RVAL(gdk_display_get_event(_SELF(self)));
126
- }
127
-
128
- static VALUE
129
- rg_peek_event(VALUE self)
130
- {
131
- return GEV2RVAL(gdk_display_peek_event(_SELF(self)));
132
- }
133
-
134
- static VALUE
135
- rg_put_event(VALUE self, VALUE event)
136
- {
137
- gdk_display_put_event(_SELF(self), RVAL2GEV(event));
138
- return self;
139
- }
140
-
141
- /* Don't implement this.
142
- static GdkFilterReturn
143
- filter_func(GdkXEvent xevent, GdkEvent event, gpointer func)
144
- {
145
- return GENUM2RVAL(rb_funcall((VALUE)func, id_call, 2,
146
- ????, GEV2RVAL(event)),
147
- GDK_TYPE_FILTER_RETURN);
148
- }
149
-
150
- static VALUE
151
- gdkdisplay_add_client_message_filter(VALUE self, VALUE message_type)
152
- {
153
- VALUE func = RB_BLOCK_PROC();
154
- G_RELATIVE(self, func);
155
- gdk_display_add_client_message_filter(_SELF(self), RVAL2ATOM(message_type),
156
- filter_func, func);
157
- return self;
158
- }
159
- */
160
-
161
- static VALUE
162
- rg_set_double_click_time(VALUE self, VALUE msec)
163
- {
164
- gdk_display_set_double_click_time(_SELF(self), NUM2UINT(msec));
165
- return self;
166
- }
167
-
168
- static VALUE
169
- rg_closed_p(VALUE self)
170
- {
171
- return CBOOL2RVAL(gdk_display_is_closed(_SELF(self)));
172
- }
173
-
174
- static VALUE
175
- rg_set_double_click_distance(VALUE self, VALUE distance)
176
- {
177
- gdk_display_set_double_click_distance(_SELF(self), NUM2UINT(distance));
178
- return self;
179
- }
180
-
181
- /* Don't implement this.
182
- GdkDisplayPointerHooks* gdk_display_set_pointer_hooks
183
- (GdkDisplay *display,
184
- const GdkDisplayPointerHooks *new_hooks);
185
- */
186
-
187
- static VALUE
188
- rg_supports_cursor_color_p(VALUE self)
189
- {
190
- return CBOOL2RVAL(gdk_display_supports_cursor_color(_SELF(self)));
191
- }
192
-
193
- static VALUE
194
- rg_supports_cursor_alpha_p(VALUE self)
195
- {
196
- return CBOOL2RVAL(gdk_display_supports_cursor_alpha(_SELF(self)));
197
- }
198
-
199
- static VALUE
200
- rg_default_cursor_size(VALUE self)
201
- {
202
- return UINT2NUM(gdk_display_get_default_cursor_size(_SELF(self)));
203
- }
204
-
205
- static VALUE
206
- rg_maximal_cursor_size(VALUE self)
207
- {
208
- guint width, height;
209
- gdk_display_get_maximal_cursor_size(_SELF(self), &width, &height);
210
- return rb_assoc_new(UINT2NUM(width), UINT2NUM(height));
211
- }
212
-
213
- static VALUE
214
- rg_default_group(VALUE self)
215
- {
216
- return GOBJ2RVAL(gdk_display_get_default_group(_SELF(self)));
217
- }
218
-
219
- static VALUE
220
- rg_supports_selection_notification_p(VALUE self)
221
- {
222
- return CBOOL2RVAL(gdk_display_supports_selection_notification(_SELF(self)));
223
- }
224
-
225
- static VALUE
226
- rg_request_selection_notification_p(VALUE self, VALUE selection)
227
- {
228
- return CBOOL2RVAL(gdk_display_request_selection_notification(_SELF(self),
229
- RVAL2ATOM(selection)));
230
- }
231
-
232
- static VALUE
233
- rg_supports_clipboard_persistence_p(VALUE self)
234
- {
235
- return CBOOL2RVAL(gdk_display_supports_clipboard_persistence(_SELF(self)));
236
- }
237
-
238
- static VALUE
239
- rg_store_clipboard(VALUE self, VALUE rbclipboard_window, VALUE rbtime_, VALUE rbtargets)
240
- {
241
- GdkDisplay *display = _SELF(self);
242
- GdkWindow *clipboard_window = RVAL2GDKWINDOW(rbclipboard_window);
243
- guint32 time_ = NUM2UINT(rbtime_);
244
- long n;
245
- GdkAtom *targets = RVAL2GDKATOMS(rbtargets, &n);
246
-
247
- gdk_display_store_clipboard(display, clipboard_window, time_, targets, n);
248
-
249
- g_free(targets);
250
-
251
- return self;
252
- }
253
-
254
- /* deprecated
255
- static VALUE
256
- rg_core_pointer(VALUE self)
257
- {
258
- return GOBJ2RVAL(gdk_display_get_core_pointer(_SELF(self)));
259
- }
260
- */
261
-
262
- #ifdef GDK_WINDOWING_X11
263
- static VALUE
264
- rg_grab(VALUE self)
265
- {
266
- gdk_x11_display_grab(_SELF(self));
267
- return self;
268
- }
269
- static VALUE
270
- rg_ungrab(VALUE self)
271
- {
272
- gdk_x11_display_ungrab(_SELF(self));
273
- return self;
274
- }
275
-
276
- static VALUE
277
- rg_register_standard_event_type(VALUE self, VALUE event_base, VALUE n_events)
278
- {
279
- gdk_x11_register_standard_event_type(_SELF(self),
280
- NUM2INT(event_base), NUM2INT(n_events));
281
- return self;
282
- }
283
-
284
- static VALUE
285
- rg_user_time(VALUE self)
286
- {
287
- return UINT2NUM(gdk_x11_display_get_user_time(_SELF(self)));
288
- }
289
-
290
- static VALUE
291
- rg_set_cursor_theme(VALUE self, VALUE theme, VALUE size)
292
- {
293
- gdk_x11_display_set_cursor_theme(_SELF(self), RVAL2CSTR(theme), NUM2INT(size));
294
- return self;
295
- }
296
-
297
- /*
298
- *** need gdk_x11_display_broadcast_startup_messagev() ***
299
-
300
- typedef struct _StartupMessageParameterData {
301
- gchar **parameters;
302
- guint i;
303
- } StartupMessageParameterData;
304
-
305
- static int
306
- collect_parameter(VALUE key, VALUE value, VALUE data)
307
- {
308
- StartupMessageParameterData *parameter_data;
309
- parameter_data = (StartupMessageParameterData *)data;
310
-
311
- parameter_data->parameters[parameter_data->i] = RVAL2CSTR(key);
312
- parameter_data->i++;
313
- parameter_data->parameters[parameter_data->i] = RVAL2CSTR(value);
314
- parameter_data->i++;
315
-
316
- return ST_CONTINUE;
317
- }
318
-
319
- static VALUE
320
- rg_broadcast_startup_message(int argc, VALUE *argv, VALUE self)
321
- {
322
- VALUE rb_message_type, rb_parameters;
323
- char *message_type;
324
- guint n_parameters;
325
- gchar **parameters;
326
-
327
- rb_scan_args(argc, argv, "11", &rb_message_type, &rb_parameters);
328
-
329
- message_type = RVAL2CSTR(rb_message_type);
330
- if (NIL_P(rb_parameters)) {
331
- n_parameters = 0;
332
- parameters = NULL;
333
- }
334
- else {
335
- StartupMessageParameterData data;
336
-
337
- Check_Type(rb_parameters, T_HASH);
338
- n_parameters = NUM2UINT(rb_funcall(rb_parameters, rb_intern("size"), 0));
339
- parameters = ALLOCA_N(gchar *, n_parameters * 2);
340
- data.i = 0;
341
- data.parameters = parameters;
342
- rb_hash_foreach(rb_parameters, collect_parameter, (VALUE)&data);
343
- }
344
-
345
- gdk_x11_display_broadcast_startup_messagev(_SELF(self),
346
- message_type,
347
- n_parameters,
348
- parameters);
349
-
350
- return self;
351
- }
352
- */
353
-
354
- static VALUE
355
- rg_startup_notification_id(VALUE self)
356
- {
357
- return CSTR2RVAL(gdk_x11_display_get_startup_notification_id(_SELF(self)));
358
- }
359
- #endif
360
-
361
- static VALUE
362
- rg_supports_shapes_p(VALUE self)
363
- {
364
- return CBOOL2RVAL(gdk_display_supports_shapes(_SELF(self)));
365
- }
366
-
367
- static VALUE
368
- rg_supports_input_shapes_p(VALUE self)
369
- {
370
- return CBOOL2RVAL(gdk_display_supports_input_shapes(_SELF(self)));
371
- }
372
-
373
- static VALUE
374
- rg_supports_composite_p(VALUE self)
375
- {
376
- return CBOOL2RVAL(gdk_display_supports_composite(_SELF(self)));
377
- }
378
-
379
- void
380
- Init_gdk_display(VALUE mGdk)
381
- {
382
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_DISPLAY, "Display", mGdk);
383
-
384
- RG_DEF_SMETHOD(open, 1);
385
- RG_DEF_SMETHOD(default, 0);
386
- RG_DEF_METHOD(name, 0);
387
- RG_DEF_METHOD(n_screens, 0);
388
- RG_DEF_METHOD(get_screen, 1);
389
- RG_DEF_ALIAS("[]", "get_screen");
390
- RG_DEF_METHOD(default_screen, 0);
391
- RG_DEF_METHOD(device_manager, 0);
392
-
393
- RG_DEF_METHOD_P(device_is_grabbed, 1);
394
-
395
- RG_DEF_METHOD(beep, 0);
396
- RG_DEF_METHOD(sync, 0);
397
- RG_DEF_METHOD(flush, 0);
398
- RG_DEF_METHOD(close, 0);
399
-
400
- RG_DEF_METHOD(event, 0);
401
- RG_DEF_METHOD(peek_event, 0);
402
- RG_DEF_METHOD(put_event, 1);
403
- RG_DEF_METHOD(set_double_click_time, 1);
404
- RG_DEF_METHOD_P(closed, 0);
405
- RG_DEF_METHOD(set_double_click_distance, 1);
406
- RG_DEF_METHOD_P(supports_cursor_color, 0);
407
- RG_DEF_METHOD_P(supports_cursor_alpha, 0);
408
- RG_DEF_METHOD(default_cursor_size, 0);
409
- RG_DEF_METHOD(maximal_cursor_size, 0);
410
- RG_DEF_METHOD(default_group, 0);
411
- RG_DEF_METHOD_P(supports_selection_notification, 0);
412
- RG_DEF_METHOD_P(request_selection_notification, 1);
413
- RG_DEF_METHOD_P(supports_clipboard_persistence, 0);
414
- RG_DEF_METHOD(store_clipboard, 3);
415
- /* deprecated
416
- RG_DEF_METHOD(core_pointer, 0);
417
- */
418
- #ifdef GDK_WINDOWING_X11
419
- RG_DEF_METHOD(grab, 0);
420
- RG_DEF_METHOD(ungrab, 0);
421
- RG_DEF_METHOD(register_standard_event_type, 2);
422
- RG_DEF_METHOD(user_time, 0);
423
- RG_DEF_METHOD(set_cursor_theme, 2);
424
- /*
425
- RG_DEF_METHOD(broadcast_startup_message, -1);
426
- */
427
- RG_DEF_METHOD(startup_notification_id, 0);
428
- G_DEF_CLASS3("GdkDisplayX11", "DisplayX11", mGdk);
429
- #endif
430
-
431
- RG_DEF_METHOD_P(supports_shapes, 0);
432
- RG_DEF_METHOD_P(supports_input_shapes, 0);
433
- RG_DEF_METHOD_P(supports_composite, 0);
434
- }