/*
- * $Id: rb_event_handler.c 358 2006-02-12 15:42:28Z tilman $
+ * $Id: rb_event_handler.c 359 2006-02-12 15:51:58Z tilman $
*
* Copyright (C) 2004 ruby-ecore team (see AUTHORS)
*
h->real = NULL;
h->deleted = true;
- return Qnil;
+ break;
}
rb_ary_push (handlers, el);
static int on_ecore_event (void *data, int type, void *event)
{
RbEventHandler *h = NULL;
- VALUE handler, klass, obj, argv[1], res;
+ VALUE handler, klass, obj, tmp, res;
int handler_type, len, i;
bool called = false;
/* instantiate the event object
* first, find the class we're gonna use
*/
- if (NIL_P (klass = rb_hash_aref (event_classes, INT2NUM (type)))) {
+ klass = rb_hash_aref (event_classes, INT2NUM (type));
+ if (NIL_P (klass))
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);
+ tmp = (VALUE) event;
+ obj = rb_class_new_instance (1, &tmp, klass);
len = RARRAY (handlers)->len;
}
}
- if (type == ECORE_EVENT_SIGNAL_EXIT && !called)
- ecore_main_loop_quit ();
-
/* call other event handlers, too */
return 1;
}