- 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) {
- res = rb_funcall (rb_iv_get (handler, "handler"),
- 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;