gdk3 2.2.0 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
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,1069 +0,0 @@
1
- /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
- /*
3
- * Copyright (C) 2002-2013 Ruby-GNOME2 Project Team
4
- * Copyright (C) 1998-2000 Yukihiro Matsumoto,
5
- * Daisuke Kanda,
6
- * Hiroshi Igarashi
7
- *
8
- * This library is free software; you can redistribute it and/or
9
- * modify it under the terms of the GNU Lesser General Public
10
- * License as published by the Free Software Foundation; either
11
- * version 2.1 of the License, or (at your option) any later version.
12
- *
13
- * This library is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16
- * Lesser General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU Lesser General Public
19
- * License along with this library; if not, write to the Free Software
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
21
- * MA 02110-1301 USA
22
- */
23
-
24
- #include "rbgdk3private.h"
25
-
26
- #ifdef HAVE_RB_CAIRO_H
27
- #include <rb_cairo.h>
28
- #endif
29
-
30
- #define RG_TARGET_NAMESPACE cWindow
31
- #define _SELF(s) RVAL2GDKWINDOW(s)
32
-
33
- static VALUE
34
- rg_initialize(VALUE self, VALUE parent, VALUE attributes, VALUE attributes_mask)
35
- {
36
- GdkWindow *win;
37
- win = gdk_window_new(NIL_P(parent) ? NULL : _SELF(parent),
38
- RVAL2GDKWINDOWATTR(attributes),
39
- RVAL2GDKWINDOWATTRIBUTESTYPE(attributes_mask));
40
- G_INITIALIZE(self, win);
41
-
42
- return Qnil;
43
- }
44
-
45
- static VALUE
46
- rg_destroy(VALUE self)
47
- {
48
- gdk_window_destroy(_SELF(self));
49
- return Qnil;
50
- }
51
-
52
- static VALUE
53
- rg_window_type(VALUE self)
54
- {
55
- return GDKWINDOWTYPE2RVAL(gdk_window_get_window_type(_SELF(self)));
56
- }
57
-
58
- static VALUE
59
- rg_display(VALUE self)
60
- {
61
- return GOBJ2RVAL(gdk_window_get_display(_SELF(self)));
62
- }
63
-
64
- static VALUE
65
- rg_show(VALUE self)
66
- {
67
- gdk_window_show(_SELF(self));
68
- return self;
69
- }
70
-
71
- static VALUE
72
- rg_show_unraised(VALUE self)
73
- {
74
- gdk_window_show_unraised(_SELF(self));
75
- return self;
76
- }
77
-
78
- static VALUE
79
- rg_hide(VALUE self)
80
- {
81
- gdk_window_hide(_SELF(self));
82
- return Qnil;
83
- }
84
-
85
- static VALUE
86
- rg_visible_p(VALUE self)
87
- {
88
- return CBOOL2RVAL(gdk_window_is_visible(_SELF(self)));
89
- }
90
-
91
- static VALUE
92
- rg_viewable_p(VALUE self)
93
- {
94
- return CBOOL2RVAL(gdk_window_is_viewable(_SELF(self)));
95
- }
96
-
97
- static VALUE
98
- rg_state(VALUE self)
99
- {
100
- return GDKWINDOWSTATE2RVAL(gdk_window_get_state(_SELF(self)));
101
- }
102
-
103
- static VALUE
104
- rg_withdraw(VALUE self)
105
- {
106
- gdk_window_withdraw(_SELF(self));
107
- return Qnil;
108
- }
109
-
110
- static VALUE
111
- rg_iconify(VALUE self)
112
- {
113
- gdk_window_iconify(_SELF(self));
114
- return self;
115
- }
116
-
117
- static VALUE
118
- rg_deiconify(VALUE self)
119
- {
120
- gdk_window_deiconify(_SELF(self));
121
- return self;
122
- }
123
-
124
- static VALUE
125
- rg_stick(VALUE self)
126
- {
127
- gdk_window_stick(_SELF(self));
128
- return self;
129
- }
130
-
131
- static VALUE
132
- rg_unstick(VALUE self)
133
- {
134
- gdk_window_unstick(_SELF(self));
135
- return self;
136
- }
137
-
138
- static VALUE
139
- rg_maximize(VALUE self)
140
- {
141
- gdk_window_maximize(_SELF(self));
142
- return self;
143
- }
144
-
145
- static VALUE
146
- rg_unmaximize(VALUE self)
147
- {
148
- gdk_window_unmaximize(_SELF(self));
149
- return self;
150
- }
151
-
152
- static VALUE
153
- rg_fullscreen(VALUE self)
154
- {
155
- gdk_window_fullscreen(_SELF(self));
156
- return self;
157
- }
158
-
159
- static VALUE
160
- rg_unfullscreen(VALUE self)
161
- {
162
- gdk_window_unfullscreen(_SELF(self));
163
- return self;
164
- }
165
-
166
- static VALUE
167
- rg_set_keep_above(VALUE self, VALUE setting)
168
- {
169
- gdk_window_set_keep_above(_SELF(self), RVAL2CBOOL(setting));
170
- return self;
171
- }
172
-
173
- static VALUE
174
- rg_set_keep_below(VALUE self, VALUE setting)
175
- {
176
- gdk_window_set_keep_below(_SELF(self), RVAL2CBOOL(setting));
177
- return self;
178
- }
179
-
180
- static VALUE
181
- rg_move(VALUE self, VALUE x, VALUE y)
182
- {
183
- gdk_window_move(_SELF(self), NUM2INT(x), NUM2INT(y));
184
- return self;
185
- }
186
-
187
- static VALUE
188
- rg_resize(VALUE self, VALUE w, VALUE h)
189
- {
190
- gdk_window_resize(_SELF(self), NUM2INT(w), NUM2INT(h));
191
- return self;
192
- }
193
-
194
- static VALUE
195
- rg_move_resize(VALUE self, VALUE x, VALUE y, VALUE w, VALUE h)
196
- {
197
- gdk_window_move_resize(_SELF(self), NUM2INT(x), NUM2INT(y), NUM2INT(w), NUM2INT(h));
198
- return self;
199
- }
200
-
201
- static VALUE
202
- rg_scroll(VALUE self, VALUE dx, VALUE dy)
203
- {
204
- gdk_window_scroll(_SELF(self), NUM2INT(dx), NUM2INT(dy));
205
- return self;
206
- }
207
-
208
- static VALUE
209
- rg_move_region(VALUE self, VALUE region, VALUE dx, VALUE dy)
210
- {
211
- gdk_window_move_region(_SELF(self),
212
- RVAL2CRREGION(region),
213
- NUM2INT(dx),
214
- NUM2INT(dy));
215
- return self;
216
- }
217
-
218
- static VALUE
219
- rg_reparent(VALUE self, VALUE new_parent, VALUE x, VALUE y)
220
- {
221
- gdk_window_reparent(_SELF(self), _SELF(new_parent), NUM2INT(x), NUM2INT(y));
222
- return self;
223
- }
224
-
225
- static VALUE
226
- rg_raise(VALUE self)
227
- {
228
- gdk_window_raise(_SELF(self));
229
- return self;
230
- }
231
-
232
- static VALUE
233
- rg_lower(VALUE self)
234
- {
235
- gdk_window_lower(_SELF(self));
236
- return self;
237
- }
238
-
239
- static VALUE
240
- rg_focus(VALUE self, VALUE timestamp)
241
- {
242
- gdk_window_focus(_SELF(self), NUM2UINT(timestamp));
243
- return self;
244
- }
245
-
246
- static VALUE
247
- rg_register_dnd(VALUE self)
248
- {
249
- gdk_window_register_dnd(_SELF(self));
250
- return self;
251
- }
252
-
253
- static VALUE
254
- rg_begin_resize_drag(VALUE self, VALUE edge, VALUE button, VALUE root_x, VALUE root_y, VALUE timestamp)
255
- {
256
- gdk_window_begin_resize_drag(_SELF(self),
257
- RVAL2GDKWINDOWEDGE(edge),
258
- NUM2INT(button),
259
- NUM2INT(root_x), NUM2INT(root_y),
260
- NUM2UINT(timestamp));
261
- return self;
262
- }
263
-
264
- static VALUE
265
- rg_begin_move_drag(VALUE self, VALUE button, VALUE root_x, VALUE root_y, VALUE timestamp)
266
- {
267
- gdk_window_begin_move_drag(_SELF(self), NUM2INT(button),
268
- NUM2INT(root_x), NUM2INT(root_y),
269
- NUM2UINT(timestamp));
270
- return self;
271
- }
272
-
273
- static VALUE
274
- rg_s_constrain_size(G_GNUC_UNUSED VALUE self, VALUE geometry, VALUE flags, VALUE w, VALUE h)
275
- {
276
- gint new_width, new_height;
277
- gdk_window_constrain_size(RVAL2GDKGEOMETRY(geometry),
278
- RVAL2GDKWINDOWHINTS(flags),
279
- NUM2INT(w), NUM2INT(h), &new_width, &new_height);
280
- return rb_assoc_new(INT2NUM(new_width), INT2NUM(new_height));
281
- }
282
-
283
- static VALUE
284
- rg_beep(VALUE self)
285
- {
286
- gdk_window_beep(_SELF(self));
287
- return self;
288
- }
289
-
290
- static VALUE
291
- rg_begin_paint(VALUE self, VALUE area)
292
- {
293
- if (rb_obj_is_kind_of(area, GTYPE2CLASS(GDK_TYPE_RECTANGLE))){
294
- gdk_window_begin_paint_rect(_SELF(self),
295
- RVAL2GDKRECTANGLE(area));
296
- } else {
297
- gdk_window_begin_paint_region(_SELF(self), RVAL2CRREGION(area));
298
- }
299
- return self;
300
- }
301
-
302
- static VALUE
303
- rg_end_paint(VALUE self)
304
- {
305
- gdk_window_end_paint(_SELF(self));
306
- return self;
307
- }
308
-
309
- static VALUE
310
- rg_invalidate(VALUE self, VALUE area, VALUE invalidate_children)
311
- {
312
- if (rb_obj_is_kind_of(area, GTYPE2CLASS(GDK_TYPE_RECTANGLE))){
313
- gdk_window_invalidate_rect(_SELF(self),
314
- RVAL2GDKRECTANGLE(area),
315
- RVAL2CBOOL(invalidate_children));
316
- } else {
317
- gdk_window_invalidate_region(_SELF(self),
318
- RVAL2CRREGION(area),
319
- RVAL2CBOOL(invalidate_children));
320
- }
321
- return self;
322
- }
323
-
324
- static gboolean
325
- invalidate_child_func_wrap(GdkWindow *window, VALUE func)
326
- {
327
- VALUE result = rb_funcall(func, id_call, 1, GOBJ2RVAL(window));
328
- return RVAL2CBOOL(result);
329
- }
330
-
331
- static VALUE
332
- rg_invalidate_maybe_recurse(VALUE self, VALUE region)
333
- {
334
- VALUE func = (VALUE)NULL;
335
- if (rb_block_given_p()){
336
- func = rb_block_proc();
337
- G_RELATIVE(self, func);
338
- }
339
- gdk_window_invalidate_maybe_recurse(_SELF(self),
340
- RVAL2CRREGION(region),
341
- (GdkWindowChildFunc)invalidate_child_func_wrap,
342
- (gpointer)func);
343
- return self;
344
- }
345
-
346
- static VALUE
347
- rg_update_area(VALUE self)
348
- {
349
- return CRREGION2RVAL(gdk_window_get_update_area(_SELF(self)));
350
- }
351
-
352
- static VALUE
353
- rg_freeze_updates(VALUE self)
354
- {
355
- gdk_window_freeze_updates(_SELF(self));
356
- return self;
357
- }
358
-
359
- static VALUE
360
- rg_thaw_updates(VALUE self)
361
- {
362
- gdk_window_thaw_updates(_SELF(self));
363
- return self;
364
- }
365
-
366
- static VALUE
367
- rg_s_process_all_updates(VALUE self)
368
- {
369
- gdk_window_process_all_updates();
370
- return self;
371
- }
372
-
373
- static VALUE
374
- rg_process_updates(VALUE self, VALUE update_children)
375
- {
376
- gdk_window_process_updates(_SELF(self), RVAL2CBOOL(update_children));
377
- return self;
378
- }
379
-
380
- static VALUE
381
- rg_s_set_debug_updates(VALUE self, VALUE setting)
382
- {
383
- gdk_window_set_debug_updates(RVAL2CBOOL(setting));
384
- return self;
385
- }
386
-
387
- static VALUE
388
- rg_configure_finished(VALUE self)
389
- {
390
- gdk_window_configure_finished(_SELF(self));
391
- return self;
392
- }
393
-
394
- static VALUE
395
- rg_enable_synchronized_configure(VALUE self)
396
- {
397
- gdk_window_enable_synchronized_configure(_SELF(self));
398
-
399
- if (rb_block_given_p()) {
400
- rb_ensure(rb_yield, self, rg_configure_finished, self);
401
- }
402
- return self;
403
- }
404
-
405
- static VALUE
406
- rg_set_user_data(VALUE self, VALUE user_data)
407
- {
408
- gdk_window_set_user_data(_SELF(self), (gpointer)RVAL2GOBJ(user_data));
409
- return self;
410
- }
411
-
412
- static VALUE
413
- rg_set_override_redirect(VALUE self, VALUE override_redirect)
414
- {
415
- gdk_window_set_override_redirect(_SELF(self),
416
- RVAL2CBOOL(override_redirect));
417
- return self;
418
- }
419
-
420
- static VALUE
421
- rg_set_accept_focus(VALUE self, VALUE accept_focus)
422
- {
423
- gdk_window_set_accept_focus(_SELF(self), RVAL2CBOOL(accept_focus));
424
- return self;
425
- }
426
-
427
- static VALUE
428
- rg_set_focus_on_map(VALUE self, VALUE focus_on_map)
429
- {
430
- gdk_window_set_focus_on_map(_SELF(self), RVAL2CBOOL(focus_on_map));
431
- return self;
432
- }
433
-
434
- static VALUE
435
- rg_shape_combine_region(VALUE self, VALUE shape_region, VALUE offset_x, VALUE offset_y)
436
- {
437
- gdk_window_shape_combine_region(_SELF(self),
438
- NIL_P(shape_region) ? NULL : RVAL2CRREGION(shape_region),
439
- INT2NUM(offset_x), INT2NUM(offset_y));
440
- return self;
441
- }
442
-
443
- static VALUE
444
- rg_set_child_shapes(VALUE self)
445
- {
446
- gdk_window_set_child_shapes(_SELF(self));
447
- return self;
448
- }
449
-
450
- static VALUE
451
- rg_merge_child_shapes(VALUE self)
452
- {
453
- gdk_window_merge_child_shapes(_SELF(self));
454
- return self;
455
- }
456
-
457
- static VALUE
458
- rg_input_shape_combine_region(VALUE self, VALUE shape_region, VALUE offset_x, VALUE offset_y)
459
- {
460
- gdk_window_input_shape_combine_region(_SELF(self),
461
- RVAL2CRREGION(shape_region),
462
- NUM2INT(offset_x),
463
- NUM2INT(offset_y));
464
- return self;
465
- }
466
-
467
- static VALUE
468
- rg_set_child_input_shapes(VALUE self)
469
- {
470
- gdk_window_set_child_input_shapes(_SELF(self));
471
- return self;
472
- }
473
-
474
- static VALUE
475
- rg_merge_child_input_shapes(VALUE self)
476
- {
477
- gdk_window_merge_child_input_shapes(_SELF(self));
478
- return self;
479
- }
480
-
481
- static VALUE
482
- rg_set_static_gravities(VALUE self, VALUE use_static)
483
- {
484
- gboolean ret = gdk_window_set_static_gravities(_SELF(self),
485
- RVAL2CBOOL(use_static));
486
- if (! ret)
487
- rb_raise(rb_eRuntimeError, "couldn't turn on static gravity");
488
-
489
- return self;
490
- }
491
-
492
- static VALUE
493
- rg_set_title(VALUE self, VALUE title)
494
- {
495
- gdk_window_set_title(_SELF(self),RVAL2CSTR(title));
496
- return self;
497
- }
498
-
499
- static VALUE
500
- rg_set_background(VALUE self, VALUE color)
501
- {
502
- gdk_window_set_background(_SELF(self), RVAL2GDKCOLOR(color));
503
- return self;
504
- }
505
-
506
- static VALUE
507
- rg_user_data(VALUE self)
508
- {
509
- GObject *data = NULL;
510
- gdk_window_get_user_data(_SELF(self), (gpointer)&data);
511
- return GOBJ2RVAL(data);
512
- }
513
-
514
- static VALUE
515
- rg_geometry(VALUE self)
516
- {
517
- gint x, y, w, h;
518
- gdk_window_get_geometry(_SELF(self), &x, &y, &w, &h);
519
- return rb_ary_new3(4, INT2NUM(x), INT2NUM(y),
520
- INT2NUM(w), INT2NUM(h));
521
- }
522
-
523
- static VALUE
524
- rg_set_geometry_hints(VALUE self, VALUE geometry, VALUE geom_mask)
525
- {
526
- gdk_window_set_geometry_hints(_SELF(self),
527
- NIL_P(geometry) ? (GdkGeometry*)NULL : RVAL2GDKGEOMETRY(geometry),
528
- RVAL2GDKWINDOWHINTS(geom_mask));
529
- return self;
530
- }
531
-
532
- static VALUE
533
- rg_width(VALUE self)
534
- {
535
- return INT2NUM(gdk_window_get_width(_SELF(self)));
536
- }
537
-
538
- static VALUE
539
- rg_height(VALUE self)
540
- {
541
- return INT2NUM(gdk_window_get_height(_SELF(self)));
542
- }
543
-
544
- static VALUE
545
- rg_set_icon_list(VALUE self, VALUE rbpixbufs)
546
- {
547
- GdkWindow *window = _SELF(self);
548
- GList *pixbufs = RVAL2GDKPIXBUFGLIST(rbpixbufs);
549
-
550
- gdk_window_set_icon_list(window, pixbufs);
551
-
552
- g_list_free(pixbufs);
553
-
554
- return self;
555
- }
556
-
557
- static VALUE
558
- rg_set_modal_hint(VALUE self, VALUE modal)
559
- {
560
- gdk_window_set_modal_hint(_SELF(self), RVAL2CBOOL(modal));
561
- return self;
562
- }
563
-
564
- static VALUE
565
- rg_set_type_hint(VALUE self, VALUE hint)
566
- {
567
- gdk_window_set_type_hint(_SELF(self), RVAL2GDKWINDOWHINT(hint));
568
- return self;
569
- }
570
-
571
- static VALUE
572
- rg_type_hint(VALUE self)
573
- {
574
- return GDKWINDOWHINT2RVAL(gdk_window_get_type_hint(_SELF(self)));
575
- }
576
-
577
- static VALUE
578
- rg_set_skip_taskbar_hint(VALUE self, VALUE hint)
579
- {
580
- gdk_window_set_skip_taskbar_hint(_SELF(self), RVAL2CBOOL(hint));
581
- return self;
582
- }
583
-
584
- static VALUE
585
- rg_set_skip_pager_hint(VALUE self, VALUE hint)
586
- {
587
- gdk_window_set_skip_pager_hint(_SELF(self), RVAL2CBOOL(hint));
588
- return self;
589
- }
590
-
591
- static VALUE
592
- rg_set_urgency_hint(VALUE self, VALUE hint)
593
- {
594
- gdk_window_set_urgency_hint(_SELF(self), RVAL2CBOOL(hint));
595
- return self;
596
- }
597
-
598
- static VALUE
599
- rg_position(VALUE self)
600
- {
601
- gint x, y;
602
- gdk_window_get_position(_SELF(self), &x, &y);
603
- return rb_assoc_new(INT2NUM(x), INT2NUM(y));
604
- }
605
-
606
- static VALUE
607
- rg_root_origin(VALUE self)
608
- {
609
- int x, y;
610
- gdk_window_get_root_origin(_SELF(self), &x, &y);
611
- return rb_assoc_new(INT2FIX(x), INT2FIX(y));
612
- }
613
-
614
- static VALUE
615
- rg_frame_extents(VALUE self)
616
- {
617
- GdkRectangle rect;
618
- gdk_window_get_frame_extents(_SELF(self), &rect);
619
- return GDKRECTANGLE2RVAL(&rect);
620
- }
621
-
622
- static VALUE
623
- rg_origin(VALUE self)
624
- {
625
- gint x, y;
626
- gdk_window_get_origin(_SELF(self), &x, &y);
627
- return rb_assoc_new(INT2NUM(x), INT2NUM(y));
628
- }
629
-
630
- static VALUE
631
- rg_parent(VALUE self)
632
- {
633
- return GOBJ2RVAL(gdk_window_get_parent(_SELF(self)));
634
- }
635
-
636
- static VALUE
637
- rg_toplevel(VALUE self)
638
- {
639
- return GOBJ2RVAL(gdk_window_get_toplevel(_SELF(self)));
640
- }
641
-
642
- static VALUE
643
- rg_children(VALUE self)
644
- {
645
- /* Don't use gdk_window_get_children() here */
646
- GList *list = gdk_window_peek_children(_SELF(self));
647
- VALUE ary = rb_ary_new();
648
- while (list) {
649
- rb_ary_push(ary, GOBJ2RVAL(list->data));
650
- list = list->next;
651
- }
652
- return ary;
653
- }
654
-
655
- static VALUE
656
- rg_events(VALUE self)
657
- {
658
- return GDKEVENTMASK2RVAL(gdk_window_get_events(_SELF(self)));
659
- }
660
-
661
- static VALUE
662
- rg_set_events(VALUE self, VALUE mask)
663
- {
664
- gdk_window_set_events(_SELF(self), RVAL2GDKEVENTMASK(mask));
665
- return self;
666
- }
667
-
668
- /* deprecated
669
- static VALUE
670
- rg_set_icon(VALUE self, VALUE icon, VALUE pixmap, VALUE mask)
671
- {
672
- gdk_window_set_icon(_SELF(self), NIL_P(icon) ? NULL :_SELF(icon),
673
- NIL_P(pixmap) ? NULL : RVAL2GDKPIXMAP(pixmap),
674
- NIL_P(mask) ? NULL : RVAL2GDKBITMAP(mask));
675
- return self;
676
- }
677
- */
678
-
679
- static VALUE
680
- rg_set_icon_name(VALUE self, VALUE name)
681
- {
682
- gdk_window_set_icon_name(_SELF(self), RVAL2CSTR(name));
683
- return self;
684
- }
685
-
686
- static VALUE
687
- rg_set_transient_for(VALUE self, VALUE parent)
688
- {
689
- gdk_window_set_transient_for(_SELF(self), _SELF(parent));
690
- return self;
691
- }
692
-
693
- static VALUE
694
- rg_set_role(VALUE self, VALUE role)
695
- {
696
- gdk_window_set_role(_SELF(self), RVAL2CSTR(role));
697
- return self;
698
- }
699
-
700
- static VALUE
701
- rg_set_group(VALUE self, VALUE leader)
702
- {
703
- gdk_window_set_group(_SELF(self), _SELF(leader));
704
- return self;
705
- }
706
-
707
- static VALUE
708
- rg_group(VALUE self)
709
- {
710
- return GOBJ2RVAL(gdk_window_get_group(_SELF(self)));
711
- }
712
-
713
- static VALUE
714
- rg_set_decorations(VALUE self, VALUE decor)
715
- {
716
- gdk_window_set_decorations(_SELF(self), RVAL2GDKWMDECORATION(decor));
717
- return self;
718
- }
719
-
720
- static VALUE
721
- rg_decorations(VALUE self)
722
- {
723
- GdkWMDecoration decorations;
724
- gboolean ret = gdk_window_get_decorations(_SELF(self), &decorations);
725
- return ret ? GDKWMDECORATION2RVAL(decorations) : Qnil;
726
- }
727
-
728
- static VALUE
729
- rg_set_functions(VALUE self, VALUE func)
730
- {
731
- gdk_window_set_functions(_SELF(self), RVAL2GDKWMFUNCTION(func));
732
- return self;
733
- }
734
-
735
- static VALUE
736
- rg_set_composited(VALUE self, VALUE composited)
737
- {
738
- gdk_window_set_composited(_SELF(self), RVAL2CBOOL(composited));
739
- return self;
740
- }
741
-
742
- static VALUE
743
- rg_set_opacity(VALUE self, VALUE opacity)
744
- {
745
- gdk_window_set_opacity(_SELF(self), NUM2DBL(opacity));
746
- return self;
747
- }
748
-
749
- static VALUE
750
- rg_set_startup_id(VALUE self, VALUE startup_id)
751
- {
752
- gdk_window_set_startup_id(_SELF(self), RVAL2CSTR_ACCEPT_NIL(startup_id));
753
- return self;
754
- }
755
-
756
- /* deprecated
757
- static VALUE
758
- rg_s_toplevels(G_GNUC_UNUSED VALUE self)
759
- {
760
- return GOBJGLIST2RVAL_FREE(gdk_window_get_toplevels(), g_list_free, NULL);
761
- }
762
- */
763
-
764
- static VALUE
765
- rg_s_default_root_window(G_GNUC_UNUSED VALUE self)
766
- {
767
- return GOBJ2RVAL(gdk_get_default_root_window());
768
- }
769
-
770
- /* Would you need this?
771
- GdkPointerHooks* gdk_set_pointer_hooks (const GdkPointerHooks *new_hooks);
772
- */
773
-
774
- /* From X Window System Interaction */
775
- /* deprecated
776
- static VALUE
777
- rg_s_foreign_new(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
778
- {
779
- VALUE arg[2];
780
- GdkWindow * win = NULL;
781
-
782
- rb_scan_args(argc, argv, "11", &arg[0], &arg[1]);
783
-
784
- switch(argc)
785
- {
786
- case 1:
787
- win = gdk_window_foreign_new(RVAL2GDKNATIVEWINDOW(arg[0]));
788
- break;
789
- case 2:
790
- win = gdk_window_foreign_new_for_display(RVAL2GOBJ(arg[0]),
791
- RVAL2GDKNATIVEWINDOW(arg[1]));
792
- break;
793
- default:
794
- break;
795
- }
796
- if (win == NULL)
797
- return Qnil;
798
- else {
799
- return GOBJ2RVAL(win);
800
- }
801
- }
802
-
803
- static VALUE
804
- rg_s_lookup(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
805
- {
806
- VALUE arg[2];
807
- GdkWindow * win = NULL;
808
-
809
- rb_scan_args(argc, argv, "11", &arg[0], &arg[1]);
810
-
811
- switch(argc)
812
- {
813
- case 1:
814
- win = gdk_window_lookup(RVAL2GDKNATIVEWINDOW(arg[0]));
815
- break;
816
- case 2:
817
- win = gdk_window_lookup_for_display(RVAL2GOBJ(arg[0]), RVAL2GDKNATIVEWINDOW(arg[1]));
818
- break;
819
- default:
820
- break;
821
- }
822
- if (win == NULL)
823
- return Qnil;
824
- else {
825
- return GOBJ2RVAL(win);
826
- }
827
- }
828
- */
829
-
830
- struct rbgdk_rval2gdkatomglist_args {
831
- VALUE ary;
832
- long n;
833
- GList *result;
834
- };
835
-
836
- static VALUE
837
- rbgdk_rval2gdkatomglist_body(VALUE value)
838
- {
839
- long i;
840
- struct rbgdk_rval2gdkatomglist_args *args = (struct rbgdk_rval2gdkatomglist_args *)value;
841
-
842
- for (i = 0; i < args->n; i++)
843
- args->result = g_list_append(args->result, GINT_TO_POINTER(RVAL2ATOM(RARRAY_PTR(args->ary)[i])));
844
-
845
- return Qnil;
846
- }
847
-
848
- static G_GNUC_NORETURN VALUE
849
- rbgdk_rval2gdkatomglist_rescue(VALUE value)
850
- {
851
- g_free(((struct rbgdk_rval2gdkatomglist_args *)value)->result);
852
-
853
- rb_exc_raise(rb_errinfo());
854
- }
855
-
856
- static GList *
857
- rbgdk_rval2gdkatomglist(VALUE value)
858
- {
859
- struct rbgdk_rval2gdkatomglist_args args;
860
-
861
- args.ary = rb_ary_to_ary(value);
862
- args.n = RARRAY_LEN(args.ary);
863
- args.result = NULL;
864
-
865
- rb_rescue(rbgdk_rval2gdkatomglist_body, (VALUE)&args,
866
- rbgdk_rval2gdkatomglist_rescue, (VALUE)&args);
867
-
868
- return args.result;
869
- }
870
-
871
- #define RVAL2GDKATOMGLIST(value) rbgdk_rval2gdkatomglist(value)
872
-
873
- static VALUE
874
- rg_drag_begin(VALUE self, VALUE targets)
875
- {
876
- GList *list = RVAL2GDKATOMGLIST(targets);
877
- GdkDragContext *result = gdk_drag_begin(_SELF(self), list);
878
- g_list_free(list);
879
-
880
- return GOBJ2RVAL(result);
881
- }
882
-
883
- static VALUE
884
- rg_drag_protocol(VALUE self)
885
- {
886
- GdkWindow *target;
887
- GdkWindow **p;
888
- GdkDragProtocol prot;
889
- VALUE ary = rb_ary_new();
890
-
891
- prot = gdk_window_get_drag_protocol(_SELF(self), &target);
892
- for (p = &target; *p; p++)
893
- rb_ary_push(ary, GOBJ2RVAL(*p));
894
-
895
- return rb_ary_new3(2, GDKDRAGPROTOCOL2RVAL(prot), ary);
896
- }
897
-
898
- static VALUE
899
- rg_get_device_position(VALUE self, VALUE device)
900
- {
901
- gint x, y;
902
- GdkModifierType state;
903
- GdkWindow *underneath_window;
904
-
905
- underneath_window =
906
- gdk_window_get_device_position(_SELF(self),
907
- RVAL2GDKDEVICE(device),
908
- &x, &y, &state);
909
- return rb_ary_new3(4,
910
- GOBJ2RVAL(underneath_window),
911
- INT2NUM(x), INT2NUM(y), GDKMODIFIERTYPE2RVAL(state));
912
- }
913
-
914
- #ifdef HAVE_RB_CAIRO_H
915
- static VALUE
916
- rg_create_cairo_context(VALUE self)
917
- {
918
- VALUE rb_cr;
919
- cairo_t *cr;
920
- cr = gdk_cairo_create(_SELF(self));
921
- rb_cairo_check_status(cairo_status(cr));
922
- rb_cr = CRCONTEXT2RVAL(cr);
923
- cairo_destroy (cr);
924
- return rb_cr;
925
- }
926
- #endif
927
-
928
- void
929
- Init_gdk_window(VALUE mGdk)
930
- {
931
- GObjectClass *g_class;
932
- VALUE RG_TARGET_NAMESPACE = G_DEF_CLASS(GDK_TYPE_WINDOW, "Window", mGdk);
933
-
934
- g_class = g_type_class_peek(GDK_TYPE_WINDOW);
935
-
936
- RG_DEF_METHOD(initialize, 3);
937
- RG_DEF_METHOD(destroy, 0);
938
- RG_DEF_METHOD(window_type, 0);
939
- RG_DEF_METHOD(display, 0);
940
- RG_DEF_SMETHOD(constrain_size, 4);
941
- RG_DEF_SMETHOD(process_all_updates, 0);
942
- RG_DEF_SMETHOD(set_debug_updates, 1);
943
- RG_DEF_METHOD(show, 0);
944
- RG_DEF_METHOD(show_unraised, 0);
945
- RG_DEF_METHOD(hide, 0);
946
- RG_DEF_METHOD_P(visible, 0);
947
- RG_DEF_METHOD_P(viewable, 0);
948
- RG_DEF_METHOD(withdraw, 0);
949
- RG_DEF_METHOD(state, 0);
950
- RG_DEF_METHOD(iconify, 0);
951
- RG_DEF_METHOD(deiconify, 0);
952
- RG_DEF_METHOD(stick, 0);
953
- RG_DEF_METHOD(unstick, 0);
954
- RG_DEF_METHOD(maximize, 0);
955
- RG_DEF_METHOD(unmaximize, 0);
956
- RG_DEF_METHOD(fullscreen, 0);
957
- RG_DEF_METHOD(unfullscreen, 0);
958
- RG_DEF_METHOD(set_keep_above, 1);
959
- RG_DEF_METHOD(set_keep_below, 1);
960
- RG_DEF_METHOD(move, 2);
961
- RG_DEF_METHOD(resize, 2);
962
- RG_DEF_METHOD(move_resize, 4);
963
- RG_DEF_METHOD(scroll, 2);
964
- RG_DEF_METHOD(move_region, 3);
965
- RG_DEF_METHOD(reparent, 3);
966
- RG_DEF_METHOD(raise, 0);
967
- RG_DEF_METHOD(lower, 0);
968
- RG_DEF_METHOD(focus, 1);
969
- RG_DEF_METHOD(register_dnd, 0);
970
- RG_DEF_METHOD(beep, 0);
971
- RG_DEF_METHOD(begin_resize_drag, 5);
972
- RG_DEF_METHOD(begin_move_drag, 4);
973
- RG_DEF_METHOD(begin_paint, 1);
974
- RG_DEF_METHOD(end_paint, 0);
975
- RG_DEF_METHOD(invalidate, 2);
976
- RG_DEF_METHOD(invalidate_maybe_recurse, 1);
977
- RG_DEF_METHOD(update_area, 0);
978
- RG_DEF_METHOD(freeze_updates, 0);
979
- RG_DEF_METHOD(thaw_updates, 0);
980
- RG_DEF_METHOD(process_updates, 1);
981
- RG_DEF_METHOD(configure_finished, 0);
982
- RG_DEF_METHOD(enable_synchronized_configure, 0);
983
- RG_DEF_METHOD(set_user_data, 1);
984
- RG_DEF_METHOD(set_override_redirect, 1);
985
- RG_DEF_METHOD(set_accept_focus, 1);
986
- RG_DEF_METHOD(set_focus_on_map, 1);
987
- RG_DEF_METHOD(shape_combine_region, 3);
988
- RG_DEF_METHOD(set_child_shapes, 0);
989
- RG_DEF_METHOD(merge_child_shapes, 0);
990
- RG_DEF_METHOD(input_shape_combine_region, 3);
991
- RG_DEF_METHOD(set_child_input_shapes, 0);
992
- RG_DEF_METHOD(merge_child_input_shapes, 0);
993
- RG_DEF_METHOD(set_static_gravities, 1);
994
- RG_DEF_METHOD(set_title, 1);
995
- RG_DEF_METHOD(set_background, 1);
996
- RG_DEF_METHOD(user_data, 0);
997
- RG_DEF_METHOD(geometry, 0);
998
- RG_DEF_METHOD(set_geometry_hints, 2);
999
- RG_DEF_METHOD(width, 0);
1000
- RG_DEF_METHOD(height, 0);
1001
- RG_DEF_METHOD(set_icon_list, 1);
1002
- RG_DEF_METHOD(set_modal_hint, 1);
1003
- RG_DEF_METHOD(set_type_hint, 1);
1004
- RG_DEF_METHOD(type_hint, 0);
1005
-
1006
- RG_DEF_METHOD(set_skip_taskbar_hint, 1);
1007
- RG_DEF_METHOD(set_skip_pager_hint, 1);
1008
- RG_DEF_METHOD(set_urgency_hint, 1);
1009
- RG_DEF_METHOD(position, 0);
1010
- RG_DEF_METHOD(root_origin, 0);
1011
- RG_DEF_METHOD(frame_extents, 0);
1012
- RG_DEF_METHOD(origin, 0);
1013
- RG_DEF_METHOD(parent, 0);
1014
- RG_DEF_METHOD(toplevel, 0);
1015
- RG_DEF_SMETHOD(default_root_window, 0);
1016
- RG_DEF_METHOD(children, 0);
1017
- RG_DEF_METHOD(events, 0);
1018
- RG_DEF_METHOD(set_events, 1);
1019
- /* deprecated
1020
- RG_DEF_METHOD(set_icon, 3);
1021
- */
1022
- RG_DEF_METHOD(set_icon_name, 1);
1023
- RG_DEF_METHOD(set_transient_for, 1);
1024
- RG_DEF_METHOD(set_role, 1);
1025
- RG_DEF_METHOD(set_group, 1);
1026
- RG_DEF_METHOD(group, 0);
1027
- RG_DEF_METHOD(set_decorations, 1);
1028
- RG_DEF_METHOD(decorations, 0);
1029
- RG_DEF_METHOD(set_functions, 1);
1030
- RG_DEF_METHOD(set_composited, 1);
1031
- RG_DEF_METHOD(set_opacity, 1);
1032
- RG_DEF_METHOD(set_startup_id, 1);
1033
- /* deprecated
1034
- RG_DEF_SMETHOD(toplevels, 0);
1035
-
1036
- RG_DEF_SMETHOD(foreign_new, -1);
1037
- RG_DEF_SMETHOD(lookup, -1);
1038
- */
1039
- RG_DEF_METHOD(drag_begin, 1);
1040
- RG_DEF_METHOD(drag_protocol, 0);
1041
- RG_DEF_METHOD(get_device_position, 1);
1042
-
1043
- #ifdef HAVE_RB_CAIRO_H
1044
- RG_DEF_METHOD(create_cairo_context, 0);
1045
- #endif
1046
-
1047
- G_DEF_CLASS(GDK_TYPE_WINDOW_TYPE, "Type", RG_TARGET_NAMESPACE);
1048
- G_DEF_CLASS(GDK_TYPE_WINDOW_WINDOW_CLASS, "WindowClass",
1049
- RG_TARGET_NAMESPACE);
1050
- G_DEF_CLASS(GDK_TYPE_WINDOW_HINTS, "Hints", RG_TARGET_NAMESPACE);
1051
- G_DEF_CLASS(GDK_TYPE_GRAVITY, "Gravity", RG_TARGET_NAMESPACE);
1052
- G_DEF_CLASS(GDK_TYPE_WINDOW_EDGE, "Edge", RG_TARGET_NAMESPACE);
1053
- G_DEF_CLASS(GDK_TYPE_WINDOW_TYPE_HINT, "TypeHint", RG_TARGET_NAMESPACE);
1054
- G_DEF_CLASS(GDK_TYPE_WINDOW_ATTRIBUTES_TYPE, "AttributesType", RG_TARGET_NAMESPACE);
1055
- G_DEF_CLASS(GDK_TYPE_FILTER_RETURN, "FilterReturn", RG_TARGET_NAMESPACE);
1056
- G_DEF_CLASS(GDK_TYPE_MODIFIER_TYPE, "ModifierType", RG_TARGET_NAMESPACE);
1057
- G_DEF_CLASS(GDK_TYPE_WM_DECORATION, "WMDecoration", RG_TARGET_NAMESPACE);
1058
- G_DEF_CLASS(GDK_TYPE_WM_FUNCTION, "WMFunction", RG_TARGET_NAMESPACE);
1059
-
1060
- rb_define_const(RG_TARGET_NAMESPACE, "PARENT_RELATIVE", INT2FIX(GDK_PARENT_RELATIVE));
1061
-
1062
- #ifdef GDK_WINDOWING_X11
1063
- G_DEF_CLASS3("GdkWindowImplX11", "WindowImplX11", mGdk);
1064
- #elif defined(GDK_WINDOWING_WIN32)
1065
- G_DEF_CLASS3("GdkWindowImplWin32", "WindowImplWin32", mGdk);
1066
- #elif defined(GDK_WINDOWING_FB)
1067
- G_DEF_CLASS3("GdkWindowFB", "WindowFB", mGdk);
1068
- #endif
1069
- }