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