Fixed the build with the latest Ecore snapshot.
[ruby-ecore.git] / src / ecore_x / rb_ecore_x.c
1 /*
2  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  */
18
19 #include <ruby.h>
20
21 #include <Ecore.h>
22 #include <Ecore_X.h>
23 #include <Ecore_Input.h>
24 #include <X11/Xlib.h>
25
26 #include "../ecore/rb_ecore.h"
27 #include "../ecore/rb_event_handler.h"
28 #include "rb_ecore_x.h"
29 #include "rb_window.h"
30 #include "rb_cursor.h"
31
32 #if 0
33 static VALUE default_root;
34 #endif
35
36 static void at_exit ()
37 {
38         ecore_x_shutdown ();
39         ecore_shutdown ();
40 }
41
42 #if 0
43 static VALUE m_default_root_window_get (VALUE self)
44 {
45         return default_root;
46 }
47 #endif
48
49 static VALUE c_ev_key_down_init (VALUE self, VALUE event)
50 {
51         VALUE c = CLASS_OF (self);
52         Ecore_Event_Key *e = (void *) event;
53
54         rb_define_attr (c, "keyname", 1, 0);
55         rb_define_attr (c, "key", 1, 0);
56         rb_define_attr (c, "string", 1, 0);
57         rb_define_attr (c, "compose", 1, 0);
58         rb_define_attr (c, "modifiers", 1, 0);
59         rb_define_attr (c, "window", 1, 0);
60         rb_define_attr (c, "root_window", 1, 0);
61         rb_define_attr (c, "event_window", 1, 0);
62         rb_define_attr (c, "timestamp", 1, 0);
63
64         rb_iv_set (self, "@keyname",
65                    e->keyname ?  rb_str_new2 (e->keyname) : Qnil);
66         rb_iv_set (self, "@key",
67                    e->key ? rb_str_new2 (e->key) : Qnil);
68         rb_iv_set (self, "@string",
69                    e->string ? rb_str_new2 (e->string) : Qnil);
70         rb_iv_set (self, "@compose",
71                    e->compose ? rb_str_new2 (e->compose) : Qnil);
72         rb_iv_set (self, "@modifiers", INT2FIX (e->modifiers));
73         rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->window));
74         rb_iv_set (self, "@root_window",
75                    TO_ECORE_X_WINDOW (Qnil, e->root_window));
76         rb_iv_set (self, "@event_window",
77                    TO_ECORE_X_WINDOW (Qnil, e->event_window));
78         rb_iv_set (self, "@timestamp", UINT2NUM (e->timestamp));
79
80         return self;
81 }
82
83 static VALUE c_ev_mouse_button_down_init (VALUE self, VALUE event)
84 {
85         VALUE c = CLASS_OF (self);
86         Ecore_Event_Mouse_Button *e = (void *) event;
87
88         rb_define_attr (c, "buttons", 1, 0);
89         rb_define_attr (c, "modifiers", 1, 0);
90         rb_define_attr (c, "x", 1, 0);
91         rb_define_attr (c, "y", 1, 0);
92         rb_define_attr (c, "root", 1, 0);
93         rb_define_attr (c, "window", 1, 0);
94         rb_define_attr (c, "root_window", 1, 0);
95         rb_define_attr (c, "event_window", 1, 0);
96         rb_define_attr (c, "timestamp", 1, 0);
97         rb_define_attr (c, "double_click", 1, 0);
98         rb_define_attr (c, "triple_click", 1, 0);
99
100         rb_iv_set (self, "@buttons", INT2FIX (e->buttons));
101         rb_iv_set (self, "@modifiers", INT2FIX (e->modifiers));
102         rb_iv_set (self, "@x", INT2FIX (e->x));
103         rb_iv_set (self, "@y", INT2FIX (e->x));
104         rb_iv_set (self, "@root", rb_ary_new3 (2, INT2FIX (e->root.x),
105                                                INT2FIX (e->root.y)));
106         rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->window));
107         rb_iv_set (self, "@root_window",
108                    TO_ECORE_X_WINDOW (Qnil, e->root_window));
109         rb_iv_set (self, "@event_window",
110                    TO_ECORE_X_WINDOW (Qnil, e->event_window));
111         rb_iv_set (self, "@timestamp", UINT2NUM (e->timestamp));
112         rb_iv_set (self, "@double_click",
113                    e->double_click ? Qtrue : Qfalse);
114         rb_iv_set (self, "@triple_click",
115                    e->triple_click ? Qtrue : Qfalse);
116
117         return self;
118 }
119
120 static VALUE c_ev_mouse_move_init (VALUE self, VALUE event)
121 {
122         VALUE c = CLASS_OF (self);
123         Ecore_Event_Mouse_Move *e = (void *) event;
124
125         rb_define_attr (c, "modifiers", 1, 0);
126         rb_define_attr (c, "x", 1, 0);
127         rb_define_attr (c, "y", 1, 0);
128         rb_define_attr (c, "root", 1, 0);
129         rb_define_attr (c, "window", 1, 0);
130         rb_define_attr (c, "root_window", 1, 0);
131         rb_define_attr (c, "event_window", 1, 0);
132         rb_define_attr (c, "timestamp", 1, 0);
133
134         rb_iv_set (self, "@modifiers", INT2FIX (e->modifiers));
135         rb_iv_set (self, "@x", INT2FIX (e->x));
136         rb_iv_set (self, "@y", INT2FIX (e->y));
137         rb_iv_set (self, "@root", rb_ary_new3 (2, INT2FIX (e->root.x),
138                                                INT2FIX (e->root.y)));
139         rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->window));
140         rb_iv_set (self, "@root_window",
141                    TO_ECORE_X_WINDOW (Qnil, e->root_window));
142         rb_iv_set (self, "@event_window",
143                    TO_ECORE_X_WINDOW (Qnil, e->event_window));
144         rb_iv_set (self, "@timestamp", UINT2NUM (e->timestamp));
145
146         return self;
147 }
148
149 static VALUE c_ev_mouse_in_init (VALUE self, VALUE event)
150 {
151         VALUE c = CLASS_OF (self);
152         Ecore_X_Event_Mouse_In *e = (void *) event;
153
154         rb_define_attr (c, "modifiers", 1, 0);
155         rb_define_attr (c, "x", 1, 0);
156         rb_define_attr (c, "y", 1, 0);
157         rb_define_attr (c, "root", 1, 0);
158         rb_define_attr (c, "window", 1, 0);
159         rb_define_attr (c, "event_window", 1, 0);
160         rb_define_attr (c, "mode", 1, 0);
161         rb_define_attr (c, "detail", 1, 0);
162         rb_define_attr (c, "time", 1, 0);
163
164         rb_iv_set (self, "@modifiers", INT2FIX (e->modifiers));
165         rb_iv_set (self, "@x", INT2FIX (e->x));
166         rb_iv_set (self, "@y", INT2FIX (e->y));
167         rb_iv_set (self, "@root", rb_ary_new3 (2, INT2FIX (e->root.x),
168                                                INT2FIX (e->root.y)));
169         rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->win));
170         rb_iv_set (self, "@event_window",
171                    TO_ECORE_X_WINDOW (Qnil, e->event_win));
172         rb_iv_set (self, "@mode", INT2FIX (e->mode));
173         rb_iv_set (self, "@detail", INT2FIX (e->detail));
174         rb_iv_set (self, "@time", UINT2NUM (e->time));
175
176         return self;
177 }
178
179 static VALUE c_ev_win_focus_change_init (VALUE self, VALUE event)
180 {
181         VALUE c = CLASS_OF (self);
182         Ecore_X_Event_Window_Focus_In *e = (void *) event;
183
184         rb_define_attr (c, "window", 1, 0);
185         rb_define_attr (c, "mode", 1, 0);
186         rb_define_attr (c, "detail", 1, 0);
187         rb_define_attr (c, "time", 1, 0);
188
189         rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->win));
190         rb_iv_set (self, "@mode", INT2FIX (e->mode));
191         rb_iv_set (self, "@detail", INT2FIX (e->detail));
192         rb_iv_set (self, "@time", UINT2NUM (e->time));
193
194         return self;
195 }
196
197 static VALUE c_ev_win_delete_request_init (VALUE self, VALUE event)
198 {
199         VALUE c = CLASS_OF (self);
200         Ecore_X_Event_Window_Delete_Request *e = (void *) event;
201
202         rb_define_attr (c, "window", 1, 0);
203         rb_define_attr (c, "time", 1, 0);
204
205         rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->win));
206         rb_iv_set (self, "@time", UINT2NUM (e->time));
207
208         return self;
209 }
210
211 static VALUE c_ev_win_configure_request_init (VALUE self, VALUE event)
212 {
213         VALUE c = CLASS_OF (self);
214         Ecore_X_Event_Window_Configure_Request *e = (void *) event;
215
216         rb_define_attr (c, "window", 1, 0);
217         rb_define_attr (c, "window_above", 1, 0);
218         rb_define_attr (c, "x", 1, 0);
219         rb_define_attr (c, "y", 1, 0);
220         rb_define_attr (c, "w", 1, 0);
221         rb_define_attr (c, "h", 1, 0);
222         rb_define_attr (c, "border", 1, 0);
223         rb_define_attr (c, "detail", 1, 0);
224         rb_define_attr (c, "value_mask", 1, 0);
225         rb_define_attr (c, "time", 1, 0);
226
227         rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->win));
228         rb_iv_set (self, "@window_above", TO_ECORE_X_WINDOW (Qnil,
229                                                              e->abovewin));
230         rb_iv_set (self, "@x", INT2FIX (e->x));
231         rb_iv_set (self, "@y", INT2FIX (e->y));
232         rb_iv_set (self, "@w", INT2FIX (e->w));
233         rb_iv_set (self, "@h", INT2FIX (e->h));
234         rb_iv_set (self, "@border", INT2FIX (e->border));
235         rb_iv_set (self, "@detail", INT2FIX (e->detail));
236         rb_iv_set (self, "@value_mask", INT2FIX (e->value_mask));
237         rb_iv_set (self, "@time", UINT2NUM (e->time));
238
239         return self;
240 }
241
242 static VALUE c_ev_win_configure_init (VALUE self, VALUE event)
243 {
244         VALUE c = CLASS_OF (self);
245         Ecore_X_Event_Window_Configure *e = (void *) event;
246
247         rb_define_attr (c, "window", 1, 0);
248         rb_define_attr (c, "window_above", 1, 0);
249         rb_define_attr (c, "x", 1, 0);
250         rb_define_attr (c, "y", 1, 0);
251         rb_define_attr (c, "w", 1, 0);
252         rb_define_attr (c, "h", 1, 0);
253         rb_define_attr (c, "border", 1, 0);
254         rb_define_attr (c, "override", 1, 0);
255         rb_define_attr (c, "from_wm", 1, 0);
256         rb_define_attr (c, "time", 1, 0);
257
258         rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->win));
259         rb_iv_set (self, "@window_above", TO_ECORE_X_WINDOW (Qnil,
260                                                              e->abovewin));
261         rb_iv_set (self, "@x", INT2FIX (e->x));
262         rb_iv_set (self, "@y", INT2FIX (e->y));
263         rb_iv_set (self, "@w", INT2FIX (e->w));
264         rb_iv_set (self, "@h", INT2FIX (e->h));
265         rb_iv_set (self, "@border", INT2FIX (e->border));
266         rb_iv_set (self, "@override", e->override ? Qtrue : Qfalse);
267         rb_iv_set (self, "@from_wm", e->from_wm ? Qtrue : Qfalse);
268         rb_iv_set (self, "@time", UINT2NUM (e->time));
269
270         return self;
271 }
272
273 static VALUE c_ev_win_resize_request_init (VALUE self, VALUE event)
274 {
275         VALUE c = CLASS_OF (self);
276         Ecore_X_Event_Window_Resize_Request *e = (void *) event;
277
278         rb_define_attr (c, "window", 1, 0);
279         rb_define_attr (c, "w", 1, 0);
280         rb_define_attr (c, "h", 1, 0);
281         rb_define_attr (c, "time", 1, 0);
282
283         rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->win));
284         rb_iv_set (self, "@w", INT2FIX (e->w));
285         rb_iv_set (self, "@h", INT2FIX (e->h));
286         rb_iv_set (self, "@time", UINT2NUM (e->time));
287
288         return self;
289 }
290
291 static VALUE c_ev_win_damage_init (VALUE self, VALUE event)
292 {
293         VALUE c = CLASS_OF (self);
294         Ecore_X_Event_Window_Damage *e = (void *) event;
295
296         rb_define_attr (c, "window", 1, 0);
297         rb_define_attr (c, "x", 1, 0);
298         rb_define_attr (c, "y", 1, 0);
299         rb_define_attr (c, "w", 1, 0);
300         rb_define_attr (c, "h", 1, 0);
301         rb_define_attr (c, "time", 1, 0);
302
303         rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->win));
304         rb_iv_set (self, "@x", INT2FIX (e->x));
305         rb_iv_set (self, "@y", INT2FIX (e->y));
306         rb_iv_set (self, "@w", INT2FIX (e->w));
307         rb_iv_set (self, "@h", INT2FIX (e->h));
308         rb_iv_set (self, "@time", UINT2NUM (e->time));
309
310         return self;
311 }
312
313 static VALUE c_ev_win_visibility_change_init (VALUE self, VALUE event)
314 {
315         VALUE c = CLASS_OF (self);
316         Ecore_X_Event_Window_Visibility_Change *e = (void *) event;
317
318         rb_define_attr (c, "window", 1, 0);
319         rb_define_attr (c, "fully_obscured", 1, 0);
320         rb_define_attr (c, "time", 1, 0);
321
322         rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->win));
323         rb_iv_set (self, "@fully_obscured", e->fully_obscured ? Qtrue : Qfalse);
324         rb_iv_set (self, "@time", UINT2NUM (e->time));
325
326         return self;
327 }
328
329 static VALUE c_ev_win_create_init (VALUE self, VALUE event)
330 {
331         VALUE c = CLASS_OF (self);
332         Ecore_X_Event_Window_Create *e = (void *) event;
333
334         rb_define_attr (c, "window", 1, 0);
335         rb_define_attr (c, "override", 1, 0);
336         rb_define_attr (c, "time", 1, 0);
337
338         rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->win));
339         rb_iv_set (self, "@override", e->override ? Qtrue : Qfalse);
340         rb_iv_set (self, "@time", UINT2NUM (e->time));
341
342         return self;
343 }
344
345 static VALUE c_ev_win_show_request_init (VALUE self, VALUE event)
346 {
347         VALUE c = CLASS_OF (self);
348         Ecore_X_Event_Window_Show_Request *e = (void *) event;
349
350         rb_define_attr (c, "window", 1, 0);
351         rb_define_attr (c, "parent", 1, 0);
352         rb_define_attr (c, "time", 1, 0);
353
354         rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->win));
355         rb_iv_set (self, "@parent", TO_ECORE_X_WINDOW (Qnil, e->parent));
356         rb_iv_set (self, "@time", UINT2NUM (e->time));
357
358         return self;
359 }
360
361 void Init_ecore_x (void)
362 {
363         VALUE c;
364         Ecore_X_Window w;
365
366         rb_require ("ecore");
367
368         /* we need to call ecore_x_init () here, to make sure the
369          * event ids are set properly
370          */
371         ecore_init ();
372         ecore_x_init (getenv ("DISPLAY"));
373         atexit (at_exit);
374
375         mX = rb_define_module_under (mEcore, "X");
376
377 #if 0
378         rb_define_module_function (mX, "default_root_window",
379                                    m_default_root_window_get, 0);
380 #endif
381
382         Init_Window ();
383         Init_Cursor ();
384
385 #if 0
386         /* now create the default root window object */
387         w = DefaultRootWindow (ecore_x_display_get ());
388         default_root = TO_ECORE_X_WINDOW (Qnil, w);
389         rb_global_variable (&default_root);
390 #endif
391
392         /* event mask values */
393         c = rb_define_class_under (mX, "EventMask", rb_cObject);
394         rb_define_private_method (rb_singleton_class (c), "new", NULL, 0);
395         DEF_CONST (c, ECORE_X_EVENT_MASK_, KEY_DOWN);
396         DEF_CONST (c, ECORE_X_EVENT_MASK_, KEY_UP);
397         DEF_CONST (c, ECORE_X_EVENT_MASK_, MOUSE_DOWN);
398         DEF_CONST (c, ECORE_X_EVENT_MASK_, MOUSE_UP);
399         DEF_CONST (c, ECORE_X_EVENT_MASK_, MOUSE_IN);
400         DEF_CONST (c, ECORE_X_EVENT_MASK_, MOUSE_OUT);
401         DEF_CONST (c, ECORE_X_EVENT_MASK_, MOUSE_MOVE);
402         DEF_CONST (c, ECORE_X_EVENT_MASK_, WINDOW_DAMAGE);
403         DEF_CONST (c, ECORE_X_EVENT_MASK_, WINDOW_VISIBILITY);
404         DEF_CONST (c, ECORE_X_EVENT_MASK_, WINDOW_CONFIGURE);
405         DEF_CONST (c, ECORE_X_EVENT_MASK_, WINDOW_RESIZE_MANAGE);
406         DEF_CONST (c, ECORE_X_EVENT_MASK_, WINDOW_MANAGE);
407         DEF_CONST (c, ECORE_X_EVENT_MASK_, WINDOW_CHILD_CONFIGURE);
408         DEF_CONST (c, ECORE_X_EVENT_MASK_, WINDOW_FOCUS_CHANGE);
409         DEF_CONST (c, ECORE_X_EVENT_MASK_, WINDOW_PROPERTY);
410         DEF_CONST (c, ECORE_X_EVENT_MASK_, WINDOW_COLORMAP);
411         DEF_CONST (c, ECORE_X_EVENT_MASK_, WINDOW_GRAB);
412         DEF_CONST (c, ECORE_X_EVENT_MASK_, MOUSE_WHEEL);
413         DEF_CONST (c, ECORE_X_EVENT_MASK_, WINDOW_FOCUS_IN);
414         DEF_CONST (c, ECORE_X_EVENT_MASK_, WINDOW_FOCUS_OUT);
415
416         /* wm protocols */
417         c = rb_define_class_under (mX, "WmProtocol", rb_cObject);
418         rb_define_private_method (rb_singleton_class (c), "new", NULL, 0);
419         DEF_CONST (c, ECORE_X_WM_PROTOCOL_, DELETE_REQUEST);
420         DEF_CONST (c, ECORE_X_WM_PROTOCOL_, TAKE_FOCUS);
421
422         /* event modes */
423         c = rb_define_class_under (mX, "EventMode", rb_cObject);
424         rb_define_private_method (rb_singleton_class (c), "new", NULL, 0);
425         DEF_CONST (c, ECORE_X_EVENT_MODE_, NORMAL);
426         DEF_CONST (c, ECORE_X_EVENT_MODE_, WHILE_GRABBED);
427         DEF_CONST (c, ECORE_X_EVENT_MODE_, GRAB);
428         DEF_CONST (c, ECORE_X_EVENT_MODE_, UNGRAB);
429
430         /* event details */
431         c = rb_define_class_under (mX, "EventDetail", rb_cObject);
432         rb_define_private_method (rb_singleton_class (c), "new", NULL, 0);
433         DEF_CONST (c, ECORE_X_EVENT_DETAIL_, ANCESTOR);
434         DEF_CONST (c, ECORE_X_EVENT_DETAIL_, VIRTUAL);
435         DEF_CONST (c, ECORE_X_EVENT_DETAIL_, INFERIOR);
436         DEF_CONST (c, ECORE_X_EVENT_DETAIL_, NON_LINEAR);
437         DEF_CONST (c, ECORE_X_EVENT_DETAIL_, NON_LINEAR_VIRTUAL);
438         DEF_CONST (c, ECORE_X_EVENT_DETAIL_, POINTER);
439         DEF_CONST (c, ECORE_X_EVENT_DETAIL_, POINTER_ROOT);
440         DEF_CONST (c, ECORE_X_EVENT_DETAIL_, DETAIL_NONE);
441
442         /* key modifiers */
443         c = rb_define_class_under (mX, "Modifier", rb_cObject);
444         rb_define_private_method (rb_singleton_class (c), "new", NULL, 0);
445         DEF_CONST (c, ECORE_EVENT_MODIFIER_, SHIFT);
446         DEF_CONST (c, ECORE_EVENT_MODIFIER_, CTRL);
447         DEF_CONST (c, ECORE_EVENT_MODIFIER_, ALT);
448         DEF_CONST (c, ECORE_EVENT_MODIFIER_, WIN);
449
450         /* events */
451         ADD_EVENT (mX, ECORE_EVENT_KEY_DOWN, "KeyDownEvent", c);
452         rb_define_private_method (c, "initialize",
453                                   c_ev_key_down_init, 1);
454
455         ADD_EVENT (mX, ECORE_EVENT_KEY_UP, "KeyUpEvent", c);
456         rb_define_private_method (c, "initialize",
457                                   c_ev_key_down_init, 1);
458
459         ADD_EVENT (mX, ECORE_EVENT_MOUSE_BUTTON_DOWN,
460                    "MouseButtonDownEvent", c);
461         rb_define_private_method (c, "initialize",
462                                   c_ev_mouse_button_down_init, 1);
463
464         ADD_EVENT (mX, ECORE_EVENT_MOUSE_BUTTON_UP,
465                    "MouseButtonUpEvent", c);
466         rb_define_private_method (c, "initialize",
467                                   c_ev_mouse_button_down_init, 1);
468
469         ADD_EVENT (mX, ECORE_EVENT_MOUSE_MOVE, "MouseMoveEvent", c);
470         rb_define_private_method (c, "initialize",
471                                   c_ev_mouse_move_init, 1);
472
473         ADD_EVENT (mX, ECORE_EVENT_MOUSE_IN, "MouseInEvent", c);
474         rb_define_private_method (c, "initialize",
475                                   c_ev_mouse_in_init, 1);
476
477         ADD_EVENT (mX, ECORE_EVENT_MOUSE_OUT, "MouseOutEvent", c);
478         rb_define_private_method (c, "initialize",
479                                   c_ev_mouse_in_init, 1);
480
481         ADD_EVENT (mX, ECORE_X_EVENT_WINDOW_FOCUS_IN,
482                    "WindowFocusInEvent", c);
483         rb_define_private_method (c, "initialize",
484                                   c_ev_win_focus_change_init, 1);
485
486         ADD_EVENT (mX, ECORE_X_EVENT_WINDOW_FOCUS_OUT,
487                    "WindowFocusOutEvent", c);
488         rb_define_private_method (c, "initialize",
489                                   c_ev_win_focus_change_init, 1);
490
491         ADD_EVENT (mX, ECORE_X_EVENT_WINDOW_DELETE_REQUEST,
492                    "WindowDeleteRequestEvent", c);
493         rb_define_private_method (c, "initialize",
494                                   c_ev_win_delete_request_init, 1);
495
496         ADD_EVENT (mX, ECORE_X_EVENT_WINDOW_CONFIGURE_REQUEST,
497                    "WindowConfigureRequestEvent", c);
498         rb_define_private_method (c, "initialize",
499                                   c_ev_win_configure_request_init, 1);
500
501         ADD_EVENT (mX, ECORE_X_EVENT_WINDOW_CONFIGURE,
502                    "WindowConfigureEvent", c);
503         rb_define_private_method (c, "initialize",
504                                   c_ev_win_configure_init, 1);
505
506         ADD_EVENT (mX, ECORE_X_EVENT_WINDOW_RESIZE_REQUEST,
507                    "WindowResizeRequestEvent", c);
508         rb_define_private_method (c, "initialize",
509                                   c_ev_win_resize_request_init, 1);
510
511         ADD_EVENT (mX, ECORE_X_EVENT_WINDOW_DAMAGE, "WindowDamageEvent", c);
512         rb_define_private_method (c, "initialize",
513                                   c_ev_win_damage_init, 1);
514
515         ADD_EVENT (mX, ECORE_X_EVENT_WINDOW_VISIBILITY_CHANGE,
516                    "WindowVisibilityChangeEvent", c);
517         rb_define_private_method (c, "initialize",
518                                   c_ev_win_visibility_change_init, 1);
519
520         ADD_EVENT (mX, ECORE_X_EVENT_WINDOW_CREATE, "WindowCreateEvent", c);
521         rb_define_private_method (c, "initialize",
522                                   c_ev_win_create_init, 1);
523
524         ADD_EVENT (mX, ECORE_X_EVENT_WINDOW_DESTROY, "WindowDestroyEvent", c);
525         rb_define_private_method (c, "initialize",
526                                   c_ev_win_delete_request_init, 1);
527
528         ADD_EVENT (mX, ECORE_X_EVENT_WINDOW_SHOW, "WindowShowEvent", c);
529         rb_define_private_method (c, "initialize",
530                                   c_ev_win_delete_request_init, 1);
531
532         ADD_EVENT (mX, ECORE_X_EVENT_WINDOW_HIDE, "WindowHideEvent", c);
533         rb_define_private_method (c, "initialize",
534                                   c_ev_win_delete_request_init, 1);
535
536         ADD_EVENT (mX, ECORE_X_EVENT_WINDOW_SHOW_REQUEST,
537                    "WindowShowRequestEvent", c);
538         rb_define_private_method (c, "initialize",
539                                   c_ev_win_show_request_init, 1);
540 }