Fixed the build with the latest Ecore snapshot. master
authorTilman Sauerbeck <tilman@code-monkey.de>
Sun, 17 May 2009 10:00:19 +0000 (12:00 +0200)
committerTilman Sauerbeck <tilman@code-monkey.de>
Sun, 17 May 2009 10:00:19 +0000 (12:00 +0200)
src/ecore_x/rb_ecore_x.c

index c0c358fd65ff6701f0579c3044416cd6a33c2873..3e54992e2fe00678fb7d3699865a2e7739b692fe 100644 (file)
@@ -20,6 +20,7 @@
 
 #include <Ecore.h>
 #include <Ecore_X.h>
+#include <Ecore_Input.h>
 #include <X11/Xlib.h>
 
 #include "../ecore/rb_ecore.h"
@@ -48,27 +49,33 @@ static VALUE m_default_root_window_get (VALUE self)
 static VALUE c_ev_key_down_init (VALUE self, VALUE event)
 {
        VALUE c = CLASS_OF (self);
-       Ecore_X_Event_Key_Down *e = (void *) event;
+       Ecore_Event_Key *e = (void *) event;
 
        rb_define_attr (c, "keyname", 1, 0);
-       rb_define_attr (c, "keysymbol", 1, 0);
-       rb_define_attr (c, "key_compose", 1, 0);
+       rb_define_attr (c, "key", 1, 0);
+       rb_define_attr (c, "string", 1, 0);
+       rb_define_attr (c, "compose", 1, 0);
        rb_define_attr (c, "modifiers", 1, 0);
        rb_define_attr (c, "window", 1, 0);
+       rb_define_attr (c, "root_window", 1, 0);
        rb_define_attr (c, "event_window", 1, 0);
-       rb_define_attr (c, "time", 1, 0);
+       rb_define_attr (c, "timestamp", 1, 0);
 
        rb_iv_set (self, "@keyname",
                   e->keyname ?  rb_str_new2 (e->keyname) : Qnil);
-       rb_iv_set (self, "@keysymbol",
-                  e->keysymbol ? rb_str_new2 (e->keysymbol) : Qnil);
-       rb_iv_set (self, "@key_compose",
-                  e->key_compose ? rb_str_new2 (e->key_compose) : Qnil);
+       rb_iv_set (self, "@key",
+                  e->key ? rb_str_new2 (e->key) : Qnil);
+       rb_iv_set (self, "@string",
+                  e->string ? rb_str_new2 (e->string) : Qnil);
+       rb_iv_set (self, "@compose",
+                  e->compose ? rb_str_new2 (e->compose) : Qnil);
        rb_iv_set (self, "@modifiers", INT2FIX (e->modifiers));
-       rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->win));
+       rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->window));
+       rb_iv_set (self, "@root_window",
+                  TO_ECORE_X_WINDOW (Qnil, e->root_window));
        rb_iv_set (self, "@event_window",
-                  TO_ECORE_X_WINDOW (Qnil, e->event_win));
-       rb_iv_set (self, "@time", UINT2NUM (e->time));
+                  TO_ECORE_X_WINDOW (Qnil, e->event_window));
+       rb_iv_set (self, "@timestamp", UINT2NUM (e->timestamp));
 
        return self;
 }
@@ -76,29 +83,32 @@ static VALUE c_ev_key_down_init (VALUE self, VALUE event)
 static VALUE c_ev_mouse_button_down_init (VALUE self, VALUE event)
 {
        VALUE c = CLASS_OF (self);
-       Ecore_X_Event_Mouse_Button_Down *e = (void *) event;
+       Ecore_Event_Mouse_Button *e = (void *) event;
 
-       rb_define_attr (c, "button", 1, 0);
+       rb_define_attr (c, "buttons", 1, 0);
        rb_define_attr (c, "modifiers", 1, 0);
        rb_define_attr (c, "x", 1, 0);
        rb_define_attr (c, "y", 1, 0);
        rb_define_attr (c, "root", 1, 0);
        rb_define_attr (c, "window", 1, 0);
+       rb_define_attr (c, "root_window", 1, 0);
        rb_define_attr (c, "event_window", 1, 0);
-       rb_define_attr (c, "time", 1, 0);
+       rb_define_attr (c, "timestamp", 1, 0);
        rb_define_attr (c, "double_click", 1, 0);
        rb_define_attr (c, "triple_click", 1, 0);
 
-       rb_iv_set (self, "@button", INT2FIX (e->button));
+       rb_iv_set (self, "@buttons", INT2FIX (e->buttons));
        rb_iv_set (self, "@modifiers", INT2FIX (e->modifiers));
        rb_iv_set (self, "@x", INT2FIX (e->x));
        rb_iv_set (self, "@y", INT2FIX (e->x));
        rb_iv_set (self, "@root", rb_ary_new3 (2, INT2FIX (e->root.x),
                                               INT2FIX (e->root.y)));
-       rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->win));
+       rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->window));
+       rb_iv_set (self, "@root_window",
+                  TO_ECORE_X_WINDOW (Qnil, e->root_window));
        rb_iv_set (self, "@event_window",
-                  TO_ECORE_X_WINDOW (Qnil, e->event_win));
-       rb_iv_set (self, "@time", UINT2NUM (e->time));
+                  TO_ECORE_X_WINDOW (Qnil, e->event_window));
+       rb_iv_set (self, "@timestamp", UINT2NUM (e->timestamp));
        rb_iv_set (self, "@double_click",
                   e->double_click ? Qtrue : Qfalse);
        rb_iv_set (self, "@triple_click",
@@ -107,56 +117,31 @@ static VALUE c_ev_mouse_button_down_init (VALUE self, VALUE event)
        return self;
 }
 
-static VALUE c_ev_mouse_button_up_init (VALUE self, VALUE event)
-{
-       VALUE c = CLASS_OF (self);
-       Ecore_X_Event_Mouse_Button_Up *e = (void *) event;
-
-       rb_define_attr (c, "button", 1, 0);
-       rb_define_attr (c, "modifiers", 1, 0);
-       rb_define_attr (c, "x", 1, 0);
-       rb_define_attr (c, "y", 1, 0);
-       rb_define_attr (c, "root", 1, 0);
-       rb_define_attr (c, "window", 1, 0);
-       rb_define_attr (c, "event_window", 1, 0);
-       rb_define_attr (c, "time", 1, 0);
-
-       rb_iv_set (self, "@button", INT2FIX (e->button));
-       rb_iv_set (self, "@modifiers", INT2FIX (e->modifiers));
-       rb_iv_set (self, "@x", INT2FIX (e->x));
-       rb_iv_set (self, "@y", INT2FIX (e->x));
-       rb_iv_set (self, "@root", rb_ary_new3 (2, INT2FIX (e->root.x),
-                                              INT2FIX (e->root.y)));
-       rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->win));
-       rb_iv_set (self, "@event_window",
-                  TO_ECORE_X_WINDOW (Qnil, e->event_win));
-       rb_iv_set (self, "@time", UINT2NUM (e->time));
-
-       return self;
-}
-
 static VALUE c_ev_mouse_move_init (VALUE self, VALUE event)
 {
        VALUE c = CLASS_OF (self);
-       Ecore_X_Event_Mouse_Move *e = (void *) event;
+       Ecore_Event_Mouse_Move *e = (void *) event;
 
        rb_define_attr (c, "modifiers", 1, 0);
        rb_define_attr (c, "x", 1, 0);
        rb_define_attr (c, "y", 1, 0);
        rb_define_attr (c, "root", 1, 0);
        rb_define_attr (c, "window", 1, 0);
+       rb_define_attr (c, "root_window", 1, 0);
        rb_define_attr (c, "event_window", 1, 0);
-       rb_define_attr (c, "time", 1, 0);
+       rb_define_attr (c, "timestamp", 1, 0);
 
        rb_iv_set (self, "@modifiers", INT2FIX (e->modifiers));
        rb_iv_set (self, "@x", INT2FIX (e->x));
        rb_iv_set (self, "@y", INT2FIX (e->y));
        rb_iv_set (self, "@root", rb_ary_new3 (2, INT2FIX (e->root.x),
                                               INT2FIX (e->root.y)));
-       rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->win));
+       rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->window));
+       rb_iv_set (self, "@root_window",
+                  TO_ECORE_X_WINDOW (Qnil, e->root_window));
        rb_iv_set (self, "@event_window",
-                  TO_ECORE_X_WINDOW (Qnil, e->event_win));
-       rb_iv_set (self, "@time", UINT2NUM (e->time));
+                  TO_ECORE_X_WINDOW (Qnil, e->event_window));
+       rb_iv_set (self, "@timestamp", UINT2NUM (e->timestamp));
 
        return self;
 }
@@ -457,39 +442,39 @@ void Init_ecore_x (void)
        /* key modifiers */
        c = rb_define_class_under (mX, "Modifier", rb_cObject);
        rb_define_private_method (rb_singleton_class (c), "new", NULL, 0);
-       DEF_CONST (c, ECORE_X_MODIFIER_, SHIFT);
-       DEF_CONST (c, ECORE_X_MODIFIER_, CTRL);
-       DEF_CONST (c, ECORE_X_MODIFIER_, ALT);
-       DEF_CONST (c, ECORE_X_MODIFIER_, WIN);
+       DEF_CONST (c, ECORE_EVENT_MODIFIER_, SHIFT);
+       DEF_CONST (c, ECORE_EVENT_MODIFIER_, CTRL);
+       DEF_CONST (c, ECORE_EVENT_MODIFIER_, ALT);
+       DEF_CONST (c, ECORE_EVENT_MODIFIER_, WIN);
 
        /* events */
-       ADD_EVENT (mX, ECORE_X_EVENT_KEY_DOWN, "KeyDownEvent", c);
+       ADD_EVENT (mX, ECORE_EVENT_KEY_DOWN, "KeyDownEvent", c);
        rb_define_private_method (c, "initialize",
                                  c_ev_key_down_init, 1);
 
-       ADD_EVENT (mX, ECORE_X_EVENT_KEY_UP, "KeyUpEvent", c);
+       ADD_EVENT (mX, ECORE_EVENT_KEY_UP, "KeyUpEvent", c);
        rb_define_private_method (c, "initialize",
                                  c_ev_key_down_init, 1);
 
-       ADD_EVENT (mX, ECORE_X_EVENT_MOUSE_BUTTON_DOWN,
+       ADD_EVENT (mX, ECORE_EVENT_MOUSE_BUTTON_DOWN,
                   "MouseButtonDownEvent", c);
        rb_define_private_method (c, "initialize",
                                  c_ev_mouse_button_down_init, 1);
 
-       ADD_EVENT (mX, ECORE_X_EVENT_MOUSE_BUTTON_UP,
+       ADD_EVENT (mX, ECORE_EVENT_MOUSE_BUTTON_UP,
                   "MouseButtonUpEvent", c);
        rb_define_private_method (c, "initialize",
-                                 c_ev_mouse_button_up_init, 1);
+                                 c_ev_mouse_button_down_init, 1);
 
-       ADD_EVENT (mX, ECORE_X_EVENT_MOUSE_MOVE, "MouseMoveEvent", c);
+       ADD_EVENT (mX, ECORE_EVENT_MOUSE_MOVE, "MouseMoveEvent", c);
        rb_define_private_method (c, "initialize",
                                  c_ev_mouse_move_init, 1);
 
-       ADD_EVENT (mX, ECORE_X_EVENT_MOUSE_IN, "MouseInEvent", c);
+       ADD_EVENT (mX, ECORE_EVENT_MOUSE_IN, "MouseInEvent", c);
        rb_define_private_method (c, "initialize",
                                  c_ev_mouse_in_init, 1);
 
-       ADD_EVENT (mX, ECORE_X_EVENT_MOUSE_OUT, "MouseOutEvent", c);
+       ADD_EVENT (mX, ECORE_EVENT_MOUSE_OUT, "MouseOutEvent", c);
        rb_define_private_method (c, "initialize",
                                  c_ev_mouse_in_init, 1);