projects
/
ruby-ecore.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Use Numeric for the event type for consistency.
[ruby-ecore.git]
/
src
/
ecore
/
rb_event_handler.c
diff --git
a/src/ecore/rb_event_handler.c
b/src/ecore/rb_event_handler.c
index 81a5fdc808f2500b0ee261e7ac9351fea47626e2..8e7312926373a0f8ec9b8ad3efceec518d736f8d 100644
(file)
--- a/
src/ecore/rb_event_handler.c
+++ b/
src/ecore/rb_event_handler.c
@@
-1,5
+1,5
@@
/*
/*
- * $Id: rb_event_handler.c 35
7 2006-02-12 15:40:30
Z tilman $
+ * $Id: rb_event_handler.c 35
9 2006-02-12 15:51:58
Z tilman $
*
* Copyright (C) 2004 ruby-ecore team (see AUTHORS)
*
*
* Copyright (C) 2004 ruby-ecore team (see AUTHORS)
*
@@
-83,14
+83,14
@@
static VALUE c_init (VALUE self, VALUE type)
int t;
if (!rb_block_given_p ())
int t;
if (!rb_block_given_p ())
- r
eturn Qnil
;
+ r
b_raise (rb_eStandardError, "block missing")
;
Data_Get_Struct (self, RbEventHandler, h);
t = NUM2INT (type);
if (t <= ECORE_EVENT_NONE)
Data_Get_Struct (self, RbEventHandler, h);
t = NUM2INT (type);
if (t <= ECORE_EVENT_NONE)
- r
eturn Qnil
;
+ r
b_raise (rb_eStandardError, "invalid type")
;
rb_iv_set (self, "@type", type);
rb_iv_set (self, "@type", type);
@@
-117,7
+117,7
@@
static VALUE c_delete (VALUE self)
h->real = NULL;
h->deleted = true;
h->real = NULL;
h->deleted = true;
-
return Qnil
;
+
break
;
}
rb_ary_push (handlers, el);
}
rb_ary_push (handlers, el);
@@
-129,23
+129,21
@@
static VALUE c_delete (VALUE self)
static int on_ecore_event (void *data, int type, void *event)
{
RbEventHandler *h = NULL;
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
*/
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);
rb_raise (rb_eException, "Cannot find event class "
"for event %i\n", type);
- return 0;
- }
/* now create and init the object */
/* 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;
len = RARRAY (handlers)->len;
@@
-166,9
+164,6
@@
static int on_ecore_event (void *data, int type, void *event)
}
}
}
}
- if (type == ECORE_EVENT_SIGNAL_EXIT && !called)
- ecore_main_loop_quit ();
-
/* call other event handlers, too */
return 1;
}
/* call other event handlers, too */
return 1;
}