gdk3 2.0.2 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,6 @@
1
1
  /* -*- c-file-style: "ruby"; indent-tabs-mode: nil -*- */
2
2
  /*
3
- * Copyright (C) 2011 Ruby-GNOME2 Project Team
4
- * Copyright (C) 2002-2006 Ruby-GNOME2 Project Team
3
+ * Copyright (C) 2002-2013 Ruby-GNOME2 Project Team
5
4
  * Copyright (C) 1998-2000 Yukihiro Matsumoto,
6
5
  * Daisuke Kanda,
7
6
  * Hiroshi Igarashi
@@ -34,7 +33,7 @@
34
33
  static VALUE
35
34
  rg_initialize(VALUE self, VALUE parent, VALUE attributes, VALUE attributes_mask)
36
35
  {
37
- GdkWindow* win;
36
+ GdkWindow *win;
38
37
  win = gdk_window_new(NIL_P(parent) ? NULL : _SELF(parent),
39
38
  RVAL2GDKWINDOWATTR(attributes),
40
39
  RVAL2GDKWINDOWATTRIBUTESTYPE(attributes_mask));
@@ -56,14 +55,6 @@ rg_window_type(VALUE self)
56
55
  return GDKWINDOWTYPE2RVAL(gdk_window_get_window_type(_SELF(self)));
57
56
  }
58
57
 
59
- static VALUE
60
- rg_s_at_pointer(G_GNUC_UNUSED VALUE self)
61
- {
62
- gint x, y;
63
- GdkWindow* win = gdk_window_at_pointer(&x, &y);
64
- return rb_ary_new3(3, GOBJ2RVAL(win), INT2FIX(x), INT2FIX(y));
65
- }
66
-
67
58
  static VALUE
68
59
  rg_show(VALUE self)
69
60
  {
@@ -284,7 +275,7 @@ rg_s_constrain_size(G_GNUC_UNUSED VALUE self, VALUE geometry, VALUE flags, VALUE
284
275
  }
285
276
 
286
277
  static VALUE
287
- rg_beep(VALUE self)
278
+ rg_beep(VALUE self)
288
279
  {
289
280
  gdk_window_beep(_SELF(self));
290
281
  return self;
@@ -294,7 +285,7 @@ static VALUE
294
285
  rg_begin_paint(VALUE self, VALUE area)
295
286
  {
296
287
  if (rb_obj_is_kind_of(area, GTYPE2CLASS(GDK_TYPE_RECTANGLE))){
297
- gdk_window_begin_paint_rect(_SELF(self),
288
+ gdk_window_begin_paint_rect(_SELF(self),
298
289
  RVAL2GDKRECTANGLE(area));
299
290
  } else {
300
291
  gdk_window_begin_paint_region(_SELF(self), RVAL2CRREGION(area));
@@ -349,7 +340,7 @@ rg_invalidate_maybe_recurse(VALUE self, VALUE region)
349
340
  static VALUE
350
341
  rg_update_area(VALUE self)
351
342
  {
352
- return CRREGION2RVAL(gdk_window_get_update_area(_SELF(self)));
343
+ return CRREGION2RVAL(gdk_window_get_update_area(_SELF(self)));
353
344
  }
354
345
 
355
346
  static VALUE
@@ -415,7 +406,7 @@ rg_set_user_data(VALUE self, VALUE user_data)
415
406
  static VALUE
416
407
  rg_set_override_redirect(VALUE self, VALUE override_redirect)
417
408
  {
418
- gdk_window_set_override_redirect(_SELF(self),
409
+ gdk_window_set_override_redirect(_SELF(self),
419
410
  RVAL2CBOOL(override_redirect));
420
411
  return self;
421
412
  }
@@ -455,7 +446,7 @@ rg_merge_child_shapes(VALUE self)
455
446
  {
456
447
  gdk_window_merge_child_shapes(_SELF(self));
457
448
  return self;
458
- }
449
+ }
459
450
 
460
451
  static VALUE
461
452
  rg_input_shape_combine_region(VALUE self, VALUE shape_region, VALUE offset_x, VALUE offset_y)
@@ -526,7 +517,7 @@ rg_geometry(VALUE self)
526
517
  static VALUE
527
518
  rg_set_geometry_hints(VALUE self, VALUE geometry, VALUE geom_mask)
528
519
  {
529
- gdk_window_set_geometry_hints(_SELF(self),
520
+ gdk_window_set_geometry_hints(_SELF(self),
530
521
  NIL_P(geometry) ? (GdkGeometry*)NULL : RVAL2GDKGEOMETRY(geometry),
531
522
  RVAL2GDKWINDOWHINTS(geom_mask));
532
523
  return self;
@@ -630,15 +621,6 @@ rg_origin(VALUE self)
630
621
  return rb_assoc_new(INT2NUM(x), INT2NUM(y));
631
622
  }
632
623
 
633
- static VALUE
634
- rg_pointer(VALUE self)
635
- {
636
- gint x, y;
637
- GdkModifierType state;
638
- GdkWindow* ret = gdk_window_get_pointer(_SELF(self), &x, &y, &state);
639
- return rb_ary_new3(4, GOBJ2RVAL(ret), INT2NUM(x), INT2NUM(y), GDKMODIFIERTYPE2RVAL(state));
640
- }
641
-
642
624
  static VALUE
643
625
  rg_parent(VALUE self)
644
626
  {
@@ -655,7 +637,7 @@ static VALUE
655
637
  rg_children(VALUE self)
656
638
  {
657
639
  /* Don't use gdk_window_get_children() here */
658
- GList* list = gdk_window_peek_children(_SELF(self));
640
+ GList *list = gdk_window_peek_children(_SELF(self));
659
641
  VALUE ary = rb_ary_new();
660
642
  while (list) {
661
643
  rb_ary_push(ary, GOBJ2RVAL(list->data));
@@ -800,7 +782,7 @@ rg_s_foreign_new(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
800
782
  break;
801
783
  case 2:
802
784
  win = gdk_window_foreign_new_for_display(RVAL2GOBJ(arg[0]),
803
- RVAL2GDKNATIVEWINDOW(arg[1]));
785
+ RVAL2GDKNATIVEWINDOW(arg[1]));
804
786
  break;
805
787
  default:
806
788
  break;
@@ -826,7 +808,7 @@ rg_s_lookup(int argc, VALUE *argv, G_GNUC_UNUSED VALUE self)
826
808
  win = gdk_window_lookup(RVAL2GDKNATIVEWINDOW(arg[0]));
827
809
  break;
828
810
  case 2:
829
- win = gdk_window_lookup_for_display(RVAL2GOBJ(arg[0]), RVAL2GDKNATIVEWINDOW(arg[1]));
811
+ win = gdk_window_lookup_for_display(RVAL2GOBJ(arg[0]), RVAL2GDKNATIVEWINDOW(arg[1]));
830
812
  break;
831
813
  default:
832
814
  break;
@@ -907,6 +889,22 @@ rg_drag_protocol(VALUE self)
907
889
  return rb_ary_new3(2, GDKDRAGPROTOCOL2RVAL(prot), ary);
908
890
  }
909
891
 
892
+ static VALUE
893
+ rg_get_device_position(VALUE self, VALUE device)
894
+ {
895
+ gint x, y;
896
+ GdkModifierType state;
897
+ GdkWindow *underneath_window;
898
+
899
+ underneath_window =
900
+ gdk_window_get_device_position(_SELF(self),
901
+ RVAL2GDKDEVICE(device),
902
+ &x, &y, &state);
903
+ return rb_ary_new3(4,
904
+ GOBJ2RVAL(underneath_window),
905
+ INT2NUM(x), INT2NUM(y), GDKMODIFIERTYPE2RVAL(state));
906
+ }
907
+
910
908
  #ifdef HAVE_RB_CAIRO_H
911
909
  static VALUE
912
910
  rg_create_cairo_context(VALUE self)
@@ -932,7 +930,6 @@ Init_gdk_window(VALUE mGdk)
932
930
  RG_DEF_METHOD(initialize, 3);
933
931
  RG_DEF_METHOD(destroy, 0);
934
932
  RG_DEF_METHOD(window_type, 0);
935
- RG_DEF_SMETHOD(at_pointer, 0);
936
933
  RG_DEF_SMETHOD(constrain_size, 4);
937
934
  RG_DEF_SMETHOD(process_all_updates, 0);
938
935
  RG_DEF_SMETHOD(set_debug_updates, 1);
@@ -1006,7 +1003,6 @@ Init_gdk_window(VALUE mGdk)
1006
1003
  RG_DEF_METHOD(root_origin, 0);
1007
1004
  RG_DEF_METHOD(frame_extents, 0);
1008
1005
  RG_DEF_METHOD(origin, 0);
1009
- RG_DEF_METHOD(pointer, 0);
1010
1006
  RG_DEF_METHOD(parent, 0);
1011
1007
  RG_DEF_METHOD(toplevel, 0);
1012
1008
  RG_DEF_SMETHOD(default_root_window, 0);
@@ -1035,6 +1031,7 @@ Init_gdk_window(VALUE mGdk)
1035
1031
  */
1036
1032
  RG_DEF_METHOD(drag_begin, 1);
1037
1033
  RG_DEF_METHOD(drag_protocol, 0);
1034
+ RG_DEF_METHOD(get_device_position, 1);
1038
1035
 
1039
1036
  #ifdef HAVE_RB_CAIRO_H
1040
1037
  RG_DEF_METHOD(create_cairo_context, 0);
@@ -1053,7 +1050,7 @@ Init_gdk_window(VALUE mGdk)
1053
1050
  G_DEF_CLASS(GDK_TYPE_WM_DECORATION, "WMDecoration", RG_TARGET_NAMESPACE);
1054
1051
  G_DEF_CLASS(GDK_TYPE_WM_FUNCTION, "WMFunction", RG_TARGET_NAMESPACE);
1055
1052
 
1056
- rb_define_const(RG_TARGET_NAMESPACE, "PARENT_RELATIVE", INT2FIX(GDK_PARENT_RELATIVE));
1053
+ rb_define_const(RG_TARGET_NAMESPACE, "PARENT_RELATIVE", INT2FIX(GDK_PARENT_RELATIVE));
1057
1054
 
1058
1055
  #ifdef GDK_WINDOWING_X11
1059
1056
  G_DEF_CLASS3("GdkWindowImplX11", "WindowImplX11", mGdk);
@@ -6,6 +6,11 @@ module Gdk
6
6
  define_deprecated_const :Colormap, :raise => "Use 'Gdk::Visual' instead."
7
7
  define_deprecated_const :Input, :raise => "Use 'GLib::IOChannel' instead."
8
8
  define_deprecated_const :X11, 'GdkX11'
9
+ define_deprecated_singleton_method :pointer_grab, :raise => "Use 'Gdk::Device#grab'."
10
+ define_deprecated_singleton_method :pointer_ungrab, :raise => "Use 'Gdk::Device#ungrab'."
11
+ define_deprecated_singleton_method :keyboard_grab, :raise => "Use 'Gdk::Device#grab'."
12
+ define_deprecated_singleton_method :keyboard_ungrab, :raise => "Use 'Gdk::Device#ungrab'."
13
+ define_deprecated_singleton_method :pointer_is_grabbed?, :raise => "Use 'Gdk::Display#device_is_grabbed?'."
9
14
 
10
15
  class Cursor
11
16
  extend GLib::Deprecatable
@@ -33,6 +38,12 @@ module Gdk
33
38
  define_deprecated_method :button_number, :raise => "Don't use this method."
34
39
  define_deprecated_method :button_x, :raise => "Don't use this method."
35
40
  define_deprecated_method :button_y, :raise => "Don't use this method."
41
+ define_deprecated_method :pointer, :raise => "Use 'Gdk::Device#get_position'."
42
+ define_deprecated_method :pointer_ungrab, :raise => "Use 'Gdk::Device#ungrab'."
43
+ define_deprecated_method :pointer_grabbed_p, :raise => "Use 'Gdk::Display#device_is_grabbed?'."
44
+ define_deprecated_method :window_at_pointer, :raise => "Use 'Gdk::Device#get_window_at_position'."
45
+ define_deprecated_method :warp_pointer, :raise => "Use 'Gdk::Device#warp'."
46
+ define_deprecated_method :devices, :raise => "Use 'Gdk::DeviceManager#devices'."
36
47
  end
37
48
 
38
49
  class DragContext
@@ -141,6 +152,8 @@ module Gdk
141
152
  define_deprecated_method :shape_combine_mask, :warn => "Don't use this method."
142
153
  define_deprecated_method :input_shape_combine_mask, :warn => "Don't use this method."
143
154
  define_deprecated_method :set_back_pixmap, :warn => "Don't use this method."
155
+ define_deprecated_singleton_method :at_pointer, :raise => "Use 'Gdk::Device#get_window_at_position'."
156
+ define_deprecated_method :pointer, :raise => "Use 'Gdk::Device#get_device_position'."
144
157
  end
145
158
 
146
159
  class WindowAttr
@@ -150,4 +163,3 @@ module Gdk
150
163
  alias :colormap= :set_colormap
151
164
  end
152
165
  end
153
-
@@ -0,0 +1,598 @@
1
+ # -*- coding: utf-8 -*-
2
+ #
3
+ # Copyright (C) 2013 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, MA 02110-1301 USA
18
+
19
+ class TestGdkEvent < Test::Unit::TestCase
20
+ class TestAny < self
21
+ def setup
22
+ @event = Gdk::EventAny.new(:delete)
23
+ end
24
+
25
+ def test_delete
26
+ assert_equal("GDK_DELETE",
27
+ Gdk::EventAny.new(:delete).event_type.name)
28
+ end
29
+
30
+ def test_destroy
31
+ assert_equal("GDK_DESTROY",
32
+ Gdk::EventAny.new(:destroy).event_type.name)
33
+ end
34
+
35
+ def test_window
36
+ assert_nothing_raised do
37
+ @event.window
38
+ end
39
+ end
40
+
41
+ def test_send_event
42
+ assert_false(@event.send_event?)
43
+ end
44
+ end
45
+
46
+ class TestKey < self
47
+ def setup
48
+ @key = Gdk::EventKey.new(:key_press)
49
+ end
50
+
51
+ def test_key_press
52
+ assert_equal("GDK_KEY_PRESS",
53
+ Gdk::EventKey.new(:key_press).event_type.name)
54
+ end
55
+
56
+ def test_key_release
57
+ assert_equal("GDK_KEY_RELEASE",
58
+ Gdk::EventKey.new(:key_release).event_type.name)
59
+ end
60
+
61
+ def test_time
62
+ assert_kind_of(Integer, @key.time)
63
+ end
64
+
65
+ def test_state
66
+ assert_not_nil(@key.state)
67
+ end
68
+
69
+ def test_keyval
70
+ assert_kind_of(Integer, @key.keyval)
71
+ end
72
+ end
73
+
74
+ class TestButton < self
75
+ def setup
76
+ @button = Gdk::EventButton.new(:button_press)
77
+ end
78
+
79
+ def test_button_press
80
+ assert_equal("GDK_BUTTON_PRESS",
81
+ Gdk::EventButton.new(:button_press).event_type.name)
82
+ end
83
+
84
+ def test_button2_press
85
+ assert_equal("GDK_2BUTTON_PRESS",
86
+ Gdk::EventButton.new(:button2_press).event_type.name)
87
+ end
88
+
89
+ def test_button3_press
90
+ assert_equal("GDK_3BUTTON_PRESS",
91
+ Gdk::EventButton.new(:button3_press).event_type.name)
92
+ end
93
+
94
+ def test_button_release
95
+ assert_equal("GDK_BUTTON_RELEASE",
96
+ Gdk::EventButton.new(:button_release).event_type.name)
97
+ end
98
+
99
+ def test_time
100
+ assert_kind_of(Integer, @button.time)
101
+ end
102
+
103
+ def test_x
104
+ assert_kind_of(Float, @button.x)
105
+ end
106
+
107
+ def test_y
108
+ assert_kind_of(Float, @button.y)
109
+ end
110
+
111
+ def test_state
112
+ assert_not_nil(@button.state)
113
+ end
114
+
115
+ def test_button
116
+ assert_kind_of(Integer, @button.button)
117
+ end
118
+
119
+ def test_x_root
120
+ assert_kind_of(Float, @button.x_root)
121
+ end
122
+
123
+ def test_y_root
124
+ assert_kind_of(Float, @button.y_root)
125
+ end
126
+ end
127
+
128
+ class TestTouch < self
129
+ def setup
130
+ @touch = Gdk::EventTouch.new(:touch_begin)
131
+ end
132
+
133
+ def test_window
134
+ assert_nothing_raised do
135
+ @touch.window
136
+ end
137
+ end
138
+
139
+ def test_send_event
140
+ assert_false(@touch.send_event?)
141
+ end
142
+
143
+ def test_time
144
+ assert_kind_of(Integer, @touch.time)
145
+ end
146
+
147
+ def test_x
148
+ assert_kind_of(Float, @touch.x)
149
+ end
150
+
151
+ def test_y
152
+ assert_kind_of(Float, @touch.y)
153
+ end
154
+
155
+ def test_axes
156
+ assert_nothing_raised do
157
+ @touch.axes
158
+ end
159
+ end
160
+
161
+ def test_state
162
+ assert_not_nil(@touch.state)
163
+ end
164
+
165
+ def test_touch_begin
166
+ assert_equal("GDK_TOUCH_BEGIN",
167
+ Gdk::EventTouch.new(:touch_begin).event_type.name)
168
+ end
169
+
170
+ def test_touch_update
171
+ assert_equal("GDK_TOUCH_UPDATE",
172
+ Gdk::EventTouch.new(:touch_update).event_type.name)
173
+ end
174
+
175
+ def test_touch_cancel
176
+ assert_equal("GDK_TOUCH_CANCEL",
177
+ Gdk::EventTouch.new(:touch_cancel).event_type.name)
178
+ end
179
+
180
+ def test_touch_end
181
+ assert_equal("GDK_TOUCH_END",
182
+ Gdk::EventTouch.new(:touch_end).event_type.name)
183
+ end
184
+
185
+ def test_emulating_pointer
186
+ assert_nothing_raised do
187
+ @touch.emulating_pointer
188
+ end
189
+ end
190
+
191
+ def test_device
192
+ assert_nothing_raised do
193
+ @touch.device
194
+ end
195
+ end
196
+
197
+ def test_x_root
198
+ assert_kind_of(Float, @touch.x_root)
199
+ end
200
+
201
+ def test_y_root
202
+ assert_kind_of(Float, @touch.y_root)
203
+ end
204
+ end
205
+
206
+ class TestScroll < self
207
+ def setup
208
+ @scroll = Gdk::EventScroll.new
209
+ end
210
+
211
+ def test_time
212
+ assert_kind_of(Integer, @scroll.time)
213
+ end
214
+
215
+ def test_x
216
+ assert_kind_of(Float, @scroll.x)
217
+ end
218
+
219
+ def test_y
220
+ assert_kind_of(Float, @scroll.y)
221
+ end
222
+
223
+ def test_state
224
+ assert_not_nil(@scroll.state)
225
+ end
226
+
227
+ def test_direction
228
+ assert_kind_of(Gdk::EventScroll::Direction, @scroll.direction)
229
+ end
230
+
231
+ def test_x_root
232
+ assert_kind_of(Float, @scroll.x_root)
233
+ end
234
+
235
+ def test_y_root
236
+ assert_kind_of(Float, @scroll.y_root)
237
+ end
238
+ end
239
+
240
+ class TestMotion < self
241
+ def setup
242
+ @motion = Gdk::EventMotion.new
243
+ end
244
+
245
+ def test_time
246
+ assert_kind_of(Integer, @motion.time)
247
+ end
248
+
249
+ def test_x
250
+ assert_kind_of(Float, @motion.x)
251
+ end
252
+
253
+ def test_y
254
+ assert_kind_of(Float, @motion.y)
255
+ end
256
+
257
+ def test_state
258
+ assert_not_nil(@motion.state)
259
+ end
260
+
261
+ def test_x_root
262
+ assert_kind_of(Float, @motion.x_root)
263
+ end
264
+
265
+ def test_y_root
266
+ assert_kind_of(Float, @motion.y_root)
267
+ end
268
+
269
+ def test_request
270
+ assert_nothing_raised do
271
+ @motion.request
272
+ end
273
+ end
274
+ end
275
+
276
+ class TestVisibility < self
277
+ def setup
278
+ @visibility = Gdk::EventVisibility.new(:visibility_notify)
279
+ end
280
+
281
+ def test_state
282
+ assert_kind_of(Gdk::EventVisibility::State, @visibility.state)
283
+ end
284
+ end
285
+
286
+ class TestCrossing < self
287
+ def setup
288
+ @crossing = Gdk::EventCrossing.new(:enter_notify)
289
+ end
290
+
291
+ def test_enter_notify
292
+ assert_equal("GDK_ENTER_NOTIFY",
293
+ Gdk::EventCrossing.new(:enter_notify).event_type.name)
294
+ end
295
+
296
+ def test_leave_notify
297
+ assert_equal("GDK_LEAVE_NOTIFY",
298
+ Gdk::EventCrossing.new(:leave_notify).event_type.name)
299
+ end
300
+
301
+ def test_time
302
+ assert_kind_of(Integer, @crossing.time)
303
+ end
304
+
305
+ def test_x
306
+ # TODO: Is Float better?
307
+ assert_kind_of(Integer, @crossing.x)
308
+ end
309
+
310
+ def test_y
311
+ # TODO: Is Float better?
312
+ assert_kind_of(Integer, @crossing.y)
313
+ end
314
+
315
+ def test_x_root
316
+ assert_kind_of(Float, @crossing.x_root)
317
+ end
318
+
319
+ def test_y_root
320
+ assert_kind_of(Float, @crossing.y_root)
321
+ end
322
+
323
+ def test_mode
324
+ assert_kind_of(Gdk::EventCrossing::Mode, @crossing.mode)
325
+ end
326
+
327
+ def test_detail
328
+ assert_not_nil(@crossing.detail)
329
+ end
330
+
331
+ def test_state
332
+ assert_not_nil(@crossing.state)
333
+ end
334
+ end
335
+
336
+ class TestFocus < self
337
+ def setup
338
+ @focus = Gdk::EventFocus.new
339
+ end
340
+
341
+ def test_in
342
+ assert_false(@focus.in?)
343
+ end
344
+ end
345
+
346
+ class TestConfigure < self
347
+ def setup
348
+ @configure = Gdk::EventConfigure.new
349
+ end
350
+
351
+ def test_x
352
+ assert_kind_of(Integer, @configure.x)
353
+ end
354
+
355
+ def test_y
356
+ assert_kind_of(Integer, @configure.y)
357
+ end
358
+
359
+ def test_width
360
+ assert_kind_of(Integer, @configure.width)
361
+ end
362
+
363
+ def test_height
364
+ assert_kind_of(Integer, @configure.height)
365
+ end
366
+ end
367
+
368
+ class TestProperty < self
369
+ def setup
370
+ @property = Gdk::EventProperty.new
371
+ end
372
+
373
+ def test_atom
374
+ assert_nothing_raised do
375
+ @property.atom
376
+ end
377
+ end
378
+
379
+ def test_time
380
+ assert_kind_of(Integer, @property.time)
381
+ end
382
+
383
+ def test_state
384
+ assert_not_nil(Integer, @property.state)
385
+ end
386
+ end
387
+
388
+ class TestSelection < self
389
+ def setup
390
+ @selection = Gdk::EventSelection.new(:selection_clear)
391
+ end
392
+
393
+ def test_selection_clear
394
+ assert_equal("GDK_SELECTION_CLEAR",
395
+ Gdk::EventSelection.new(:selection_clear).event_type.name)
396
+ end
397
+
398
+ def test_selection_notify
399
+ assert_equal("GDK_SELECTION_NOTIFY",
400
+ Gdk::EventSelection.new(:selection_notify).event_type.name)
401
+ end
402
+
403
+ def test_selection_request
404
+ assert_equal("GDK_SELECTION_REQUEST",
405
+ Gdk::EventSelection.new(:selection_request).event_type.name)
406
+ end
407
+
408
+ def test_selection
409
+ assert_nothing_raised do
410
+ @selection.selection
411
+ end
412
+ end
413
+
414
+ def test_target
415
+ assert_nothing_raised do
416
+ @selection.target
417
+ end
418
+ end
419
+
420
+ def test_property
421
+ assert_nothing_raised do
422
+ @selection.property
423
+ end
424
+ end
425
+
426
+ def test_time
427
+ assert_kind_of(Integer, @selection.time)
428
+ end
429
+ end
430
+
431
+ class TestDND < self
432
+ def setup
433
+ @dnd = Gdk::EventDND.new(:drag_enter)
434
+ end
435
+
436
+ def test_drag_enter
437
+ assert_equal("GDK_DRAG_ENTER",
438
+ Gdk::EventDND.new(:drag_enter).event_type.name)
439
+ end
440
+
441
+ def test_drag_leave
442
+ assert_equal("GDK_DRAG_LEAVE",
443
+ Gdk::EventDND.new(:drag_leave).event_type.name)
444
+ end
445
+
446
+ def test_drag_motion
447
+ assert_equal("GDK_DRAG_MOTION",
448
+ Gdk::EventDND.new(:drag_motion).event_type.name)
449
+ end
450
+
451
+ def test_drag_status
452
+ assert_equal("GDK_DRAG_STATUS",
453
+ Gdk::EventDND.new(:drag_status).event_type.name)
454
+ end
455
+
456
+ def test_drop_start
457
+ assert_equal("GDK_DROP_START",
458
+ Gdk::EventDND.new(:drop_start).event_type.name)
459
+ end
460
+
461
+ def test_drop_finished
462
+ assert_equal("GDK_DROP_FINISHED",
463
+ Gdk::EventDND.new(:drop_finished).event_type.name)
464
+ end
465
+
466
+ def test_context
467
+ assert_nothing_raised do
468
+ @dnd.context
469
+ end
470
+ end
471
+
472
+ def test_time
473
+ assert_kind_of(Integer, @dnd.time)
474
+ end
475
+
476
+ def test_x_root
477
+ assert_kind_of(Integer, @dnd.x_root)
478
+ end
479
+
480
+ def test_y_root
481
+ assert_kind_of(Integer, @dnd.y_root)
482
+ end
483
+ end
484
+
485
+ class TestProximity < self
486
+ def setup
487
+ @proximity = Gdk::EventProximity.new(:proximity_in)
488
+ end
489
+
490
+ def test_proximity_in
491
+ assert_equal("GDK_PROXIMITY_IN",
492
+ Gdk::EventProximity.new(:proximity_in).event_type.name)
493
+ end
494
+
495
+ def test_proximity_out
496
+ assert_equal("GDK_PROXIMITY_OUT",
497
+ Gdk::EventProximity.new(:proximity_out).event_type.name)
498
+ end
499
+
500
+ def test_time
501
+ assert_kind_of(Integer, @proximity.time)
502
+ end
503
+
504
+ def test_device
505
+ assert_nothing_raised do
506
+ @proximity.device
507
+ end
508
+ end
509
+ end
510
+
511
+ class TestWindowState < self
512
+ def setup
513
+ @window_state = Gdk::EventWindowState.new
514
+ end
515
+
516
+ def test_changed_mask
517
+ assert_nothing_raised do
518
+ @window_state.changed_mask
519
+ end
520
+ end
521
+
522
+ def test_new_window_state
523
+ assert_nothing_raised do
524
+ @window_state.new_window_state
525
+ end
526
+ end
527
+ end
528
+
529
+ class TestSetting < self
530
+ def setup
531
+ @setting = Gdk::EventSetting.new
532
+ end
533
+
534
+ def test_action
535
+ assert_nothing_raised do
536
+ @setting.action
537
+ end
538
+ end
539
+
540
+ def test_name
541
+ assert_nothing_raised do
542
+ @setting.name
543
+ end
544
+ end
545
+ end
546
+
547
+ class TestOwnerChange < self
548
+ def setup
549
+ @owner_change = Gdk::EventOwnerChange.new
550
+ end
551
+
552
+ def test_owner
553
+ assert_nothing_raised do
554
+ @owner_change.owner
555
+ end
556
+ end
557
+
558
+ def test_reason
559
+ assert_nothing_raised do
560
+ @owner_change.reason
561
+ end
562
+ end
563
+
564
+ def test_selection
565
+ assert_nothing_raised do
566
+ @owner_change.selection
567
+ end
568
+ end
569
+
570
+ def test_time
571
+ assert_kind_of(Integer, @owner_change.time)
572
+ end
573
+
574
+ def test_selection_time
575
+ assert_kind_of(Integer, @owner_change.selection_time)
576
+ end
577
+ end
578
+
579
+ class TestGrabBroken < self
580
+ def setup
581
+ @grab_broken = Gdk::EventGrabBroken.new
582
+ end
583
+
584
+ def test_keyboard
585
+ assert_boolean(@grab_broken.keyboard?)
586
+ end
587
+
588
+ def test_implicit
589
+ assert_boolean(@grab_broken.implicit?)
590
+ end
591
+
592
+ def test_grab_window
593
+ assert_nothing_raised do
594
+ @grab_broken.grab_window
595
+ end
596
+ end
597
+ end
598
+ end