/*
- * $Id: rb_ecore.c 77 2004-08-19 17:39:29Z tilman $
+ * $Id: rb_ecore.c 83 2004-08-21 19:55:35Z tilman $
*
* Copyright (C) 2004 ruby-ecore team (see AUTHORS)
*
static VALUE c_ev_exe_exit_init (VALUE self, VALUE event)
{
+ VALUE c = CLASS_OF (self);
Ecore_Event_Exe_Exit *e = (void *) event;
+ rb_define_attr (c, "pid", 1, 0);
+ rb_define_attr (c, "exit_code", 1, 0);
+ rb_define_attr (c, "exit_signal", 1, 0);
+ rb_define_attr (c, "exited", 1, 0);
+ rb_define_attr (c, "signalled", 1, 0);
+
rb_iv_set (self, "@pid", INT2FIX (e->pid));
rb_iv_set (self, "@exit_code", INT2FIX (e->exit_code));
rb_iv_set (self, "@exit_signal", INT2FIX (e->exit_signal));
{
Ecore_Event_Signal_User *e = (void *) event;
+ rb_define_attr (CLASS_OF (self), "number", 1, 0);
+
rb_iv_set (self, "@number", INT2FIX (e->number));
return self;
static VALUE c_ev_sig_exit_init (VALUE self, VALUE event)
{
+ VALUE c = CLASS_OF (self);
Ecore_Event_Signal_Exit *e = (void *) event;
+ rb_define_attr (c, "interrupt", 1, 0);
+ rb_define_attr (c, "quit", 1, 0);
+ rb_define_attr (c, "terminate", 1, 0);
+
rb_iv_set (self, "@interrupt", e->interrupt ? Qtrue : Qfalse);
rb_iv_set (self, "@quit", e->quit ? Qtrue : Qfalse);
rb_iv_set (self, "@terminate", e->terminate ? Qtrue : Qfalse);
{
Ecore_Event_Signal_Realtime *e = (void *) event;
+ rb_define_attr (CLASS_OF (self), "number", 1, 0);
+
rb_iv_set (self, "@number", INT2FIX (e->num));
return self;
ADD_EVENT (mEcore, ECORE_EVENT_, EXE_EXIT, "ExeExit", c);
rb_define_private_method (c, "initialize", c_ev_exe_exit_init, 1);
- rb_define_attr (c, "pid", 1, 0);
- rb_define_attr (c, "exit_code", 1, 0);
- rb_define_attr (c, "exit_signal", 1, 0);
- rb_define_attr (c, "exited", 1, 0);
- rb_define_attr (c, "signalled", 1, 0);
-
/* SIGNAL_USER */
ADD_EVENT (mEcore, ECORE_EVENT_, SIGNAL_USER,
"SignalUser", c);
rb_define_private_method (c, "initialize", c_ev_sig_user_init, 1);
- rb_define_attr (c, "number", 1, 0);
-
/* SIGNAL_EXIT */
ADD_EVENT (mEcore, ECORE_EVENT_, SIGNAL_EXIT,
"SignalExit", c);
rb_define_private_method (c, "initialize", c_ev_sig_exit_init, 1);
- rb_define_attr (c, "interrupt", 1, 0);
- rb_define_attr (c, "quit", 1, 0);
- rb_define_attr (c, "terminate", 1, 0);
-
/* SIGNAL_REALTIME */
ADD_EVENT (mEcore, ECORE_EVENT_, SIGNAL_REALTIME,
"SignalRealtime", c);
rb_define_private_method (c, "initialize", c_ev_sig_rt_init, 1);
-
- rb_define_attr (c, "number", 1, 0);
}
/*
- * $Id: rb_ecore_x.c 80 2004-08-21 09:41:43Z tilman $
+ * $Id: rb_ecore_x.c 83 2004-08-21 19:55:35Z tilman $
*
* Copyright (C) 2004 ruby-ecore team (see AUTHORS)
*
return default_root;
}
-static VALUE c_ev_win_show_req_init (VALUE self, VALUE event)
+static VALUE c_ev_win_focus_change_init (VALUE self, VALUE event)
{
+ VALUE c = CLASS_OF (self);
+ Ecore_X_Event_Window_Focus_In *e = (void *) event;
+
+ rb_define_attr (c, "window", 1, 0);
+ rb_define_attr (c, "mode", 1, 0);
+ rb_define_attr (c, "detail", 1, 0);
+ rb_define_attr (c, "time", 1, 0);
+
+ rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->win));
+ rb_iv_set (self, "@mode", INT2FIX (e->mode));
+ rb_iv_set (self, "@detail", INT2FIX (e->detail));
+ rb_iv_set (self, "@time", UINT2NUM (e->time));
+
+ return self;
+}
+
+static VALUE c_ev_win_delete_request_init (VALUE self, VALUE event)
+{
+ VALUE c = CLASS_OF (self);
+ Ecore_X_Event_Window_Delete_Request *e = (void *) event;
+
+ rb_define_attr (c, "window", 1, 0);
+ rb_define_attr (c, "time", 1, 0);
+
+ rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->win));
+ rb_iv_set (self, "@time", UINT2NUM (e->time));
+
+ return self;
+}
+
+static VALUE c_ev_win_configure_init (VALUE self, VALUE event)
+{
+ VALUE c = CLASS_OF (self);
+ Ecore_X_Event_Window_Configure *e = (void *) event;
+
+ rb_define_attr (c, "window", 1, 0);
+ rb_define_attr (c, "window_above", 1, 0);
+ rb_define_attr (c, "x", 1, 0);
+ rb_define_attr (c, "y", 1, 0);
+ rb_define_attr (c, "w", 1, 0);
+ rb_define_attr (c, "h", 1, 0);
+ rb_define_attr (c, "border", 1, 0);
+ rb_define_attr (c, "override", 1, 0);
+ rb_define_attr (c, "from_wm", 1, 0);
+ rb_define_attr (c, "time", 1, 0);
+
+ rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->win));
+ rb_iv_set (self, "@window_above", TO_ECORE_X_WINDOW (Qnil,
+ e->abovewin));
+ rb_iv_set (self, "@x", INT2FIX (e->x));
+ rb_iv_set (self, "@y", INT2FIX (e->y));
+ rb_iv_set (self, "@w", INT2FIX (e->w));
+ rb_iv_set (self, "@h", INT2FIX (e->h));
+ rb_iv_set (self, "@border", INT2FIX (e->border));
+ rb_iv_set (self, "@override", e->override ? Qtrue : Qfalse);
+ rb_iv_set (self, "@from_wm", e->from_wm ? Qtrue : Qfalse);
+ rb_iv_set (self, "@time", UINT2NUM (e->time));
+
+ return self;
+}
+
+static VALUE c_ev_win_visibility_change_init (VALUE self, VALUE event)
+{
+ VALUE c = CLASS_OF (self);
+ Ecore_X_Event_Window_Visibility_Change *e = (void *) event;
+
+ rb_define_attr (c, "window", 1, 0);
+ rb_define_attr (c, "fully_obscured", 1, 0);
+ rb_define_attr (c, "time", 1, 0);
+
+ rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->win));
+ rb_iv_set (self, "@fully_obscured", e->fully_obscured ? Qtrue : Qfalse);
+ rb_iv_set (self, "@time", UINT2NUM (e->time));
+
+ return self;
+}
+
+static VALUE c_ev_win_show_request_init (VALUE self, VALUE event)
+{
+ VALUE c = CLASS_OF (self);
Ecore_X_Event_Window_Show_Request *e = (void *) event;
+ rb_define_attr (c, "window", 1, 0);
+ rb_define_attr (c, "parent", 1, 0);
+ rb_define_attr (c, "time", 1, 0);
+
rb_iv_set (self, "@window", TO_ECORE_X_WINDOW (Qnil, e->win));
rb_iv_set (self, "@parent", TO_ECORE_X_WINDOW (Qnil, e->parent));
rb_iv_set (self, "@time", UINT2NUM (e->time));
DEF_CONST (c, ECORE_X_WM_PROTOCOL_, DELETE_REQUEST);
DEF_CONST (c, ECORE_X_WM_PROTOCOL_, TAKE_FOCUS);
+ /* event modes */
+ c = rb_define_class_under (mX, "EventMode", rb_cObject);
+ rb_define_private_method (rb_singleton_class (c), "new", NULL, 0);
+ DEF_CONST (c, ECORE_X_EVENT_MODE_, NORMAL);
+ DEF_CONST (c, ECORE_X_EVENT_MODE_, WHILE_GRABBED);
+ DEF_CONST (c, ECORE_X_EVENT_MODE_, GRAB);
+ DEF_CONST (c, ECORE_X_EVENT_MODE_, UNGRAB);
+
+ /* event details */
+ c = rb_define_class_under (mX, "EventDetails", rb_cObject);
+ rb_define_private_method (rb_singleton_class (c), "new", NULL, 0);
+ DEF_CONST (c, ECORE_X_EVENT_DETAIL_, ANCESTOR);
+ DEF_CONST (c, ECORE_X_EVENT_DETAIL_, VIRTUAL);
+ DEF_CONST (c, ECORE_X_EVENT_DETAIL_, INFERIOR);
+ DEF_CONST (c, ECORE_X_EVENT_DETAIL_, NON_LINEAR);
+ DEF_CONST (c, ECORE_X_EVENT_DETAIL_, NON_LINEAR_VIRTUAL);
+ DEF_CONST (c, ECORE_X_EVENT_DETAIL_, POINTER);
+ DEF_CONST (c, ECORE_X_EVENT_DETAIL_, POINTER_ROOT);
+ DEF_CONST (c, ECORE_X_EVENT_DETAIL_, DETAIL_NONE);
+
/* events */
ADD_EVENT (mX, ECORE_X_EVENT_, WINDOW_FOCUS_IN,
"WindowFocusIn", c);
- rb_define_private_method (c, "initialize", c_ev_generic_init, 1);
+ rb_define_private_method (c, "initialize",
+ c_ev_win_focus_change_init, 1);
ADD_EVENT (mX, ECORE_X_EVENT_, WINDOW_FOCUS_OUT,
"WindowFocusOut", c);
- rb_define_private_method (c, "initialize", c_ev_generic_init, 1);
+ rb_define_private_method (c, "initialize",
+ c_ev_win_focus_change_init, 1);
ADD_EVENT (mX, ECORE_X_EVENT_, WINDOW_DELETE_REQUEST,
"WindowDeleteRequest", c);
- rb_define_private_method (c, "initialize", c_ev_generic_init, 1);
+ rb_define_private_method (c, "initialize",
+ c_ev_win_delete_request_init, 1);
ADD_EVENT (mX, ECORE_X_EVENT_, WINDOW_CONFIGURE_REQUEST,
"WindowConfigureRequest", c);
- rb_define_private_method (c, "initialize", c_ev_generic_init, 1);
+ rb_define_private_method (c, "initialize",
+ c_ev_win_delete_request_init, 1);
ADD_EVENT (mX, ECORE_X_EVENT_, WINDOW_CONFIGURE,
"WindowConfigure", c);
- rb_define_private_method (c, "initialize", c_ev_generic_init, 1);
+ rb_define_private_method (c, "initialize",
+ c_ev_win_configure_init, 1);
ADD_EVENT (mX, ECORE_X_EVENT_, WINDOW_VISIBILITY_CHANGE,
"WindowVisibilityChange", c);
- rb_define_private_method (c, "initialize", c_ev_generic_init, 1);
+ rb_define_private_method (c, "initialize",
+ c_ev_win_visibility_change_init, 1);
ADD_EVENT (mX, ECORE_X_EVENT_, WINDOW_SHOW, "WindowShow", c);
- rb_define_private_method (c, "initialize", c_ev_generic_init, 1);
+ rb_define_private_method (c, "initialize",
+ c_ev_win_delete_request_init, 1);
ADD_EVENT (mX, ECORE_X_EVENT_, WINDOW_HIDE, "WindowHide", c);
- rb_define_private_method (c, "initialize", c_ev_generic_init, 1);
+ rb_define_private_method (c, "initialize",
+ c_ev_win_delete_request_init, 1);
ADD_EVENT (mX, ECORE_X_EVENT_, WINDOW_SHOW_REQUEST,
"WindowShowRequest", c);
rb_define_private_method (c, "initialize",
- c_ev_win_show_req_init, 1);
-
- rb_define_attr (c, "window", 1, 0);
- rb_define_attr (c, "parent", 1, 0);
- rb_define_attr (c, "time", 1, 0);
+ c_ev_win_show_request_init, 1);
}