/*
- * $Id: rb_ecore_x.c 88 2004-08-22 14:52:37Z tilman $
+ * $Id: rb_ecore_x.c 89 2004-08-22 15:12:39Z tilman $
*
* Copyright (C) 2004 ruby-ecore team (see AUTHORS)
*
return default_root;
}
+static VALUE c_ev_key_down_init (VALUE self, VALUE event)
+{
+ VALUE c = CLASS_OF (self);
+ Ecore_X_Event_Key_Down *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, "modifiers", 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, "@keyname", rb_str_new2 (e->keyname));
+ rb_iv_set (self, "@keysymbol", rb_str_new2 (e->keysymbol));
+ rb_iv_set (self, "@key_compose", rb_str_new2 (e->key_compose));
+ rb_iv_set (self, "@modifiers", INT2FIX (e->modifiers));
+ 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);
DEF_CONST (c, ECORE_X_EVENT_DETAIL_, DETAIL_NONE);
/* events */
+ ADD_EVENT (mX, ECORE_X_EVENT_, KEY_DOWN, "KeyDown", c);
+ rb_define_private_method (c, "initialize",
+ c_ev_key_down_init, 1);
+
+ ADD_EVENT (mX, ECORE_X_EVENT_, KEY_UP, "KeyUp", c);
+ rb_define_private_method (c, "initialize",
+ c_ev_key_down_init, 1);
+
ADD_EVENT (mX, ECORE_X_EVENT_, MOUSE_MOVE, "MouseMove", c);
rb_define_private_method (c, "initialize",
c_ev_mouse_move_init, 1);