gdk3 1.2.0

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