- if (NIL_P (klass = rb_hash_aref (event_classes, INT2NUM (type)))) {
- rb_raise (rb_eException, "Cannot find event class "
- "for event %i\n", type);
- return 0;
- }
-
- /* now create and init the object */
- obj = rb_obj_alloc (klass);
- argv[0] = (VALUE) event;
- rb_obj_call_init (obj, 1, argv);
-
- len = RARRAY (handlers)->len;
-
- for (i = 0; i < len; i++) {
- handler = rb_ary_entry (handlers, i);
- handler_type = NUM2INT (rb_iv_get (handler, "@type"));
-
- if (handler_type == type) {
- Data_Get_Struct (handler, RbEventHandler, h);
- res = rb_funcall (h->callback, rb_intern ("call"), 1, obj);
- called = true;
-
- /* if the block returned false, don't call the other
- * event handlers
- */
- if (res == Qfalse)
- break;
- }
- }
-
- if (type == ECORE_EVENT_SIGNAL_EXIT && !called)
- ecore_main_loop_quit ();
-
- /* call other event handlers, too */
- return 1;
+ return (tmp != Qfalse);
+}
+
+VALUE c_ev_inherited (VALUE klass, VALUE child)
+{
+ VALUE t;
+
+ t = INT2FIX (ecore_event_type_new ());
+ rb_hash_aset (event_classes, t, child);
+
+ rb_define_const (child, "TYPE", t);
+ rb_define_singleton_method (child, "raise", c_ev_raise, -2);
+
+ return Qnil;