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