projects
/
ruby-evas.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Create the callbacks hash on first use.
[ruby-evas.git]
/
src
/
rb_evas_object_events.c
diff --git
a/src/rb_evas_object_events.c
b/src/rb_evas_object_events.c
index 71c087af82aa497f119cb395ded65167bf5454ee..1d465a7474b98243a7496fbec9a2a3b74338668c 100644
(file)
--- a/
src/rb_evas_object_events.c
+++ b/
src/rb_evas_object_events.c
@@
-1,5
+1,5
@@
/*
/*
- * $Id: rb_evas_object_events.c
282 2005-03-14 21:54:32
Z tilman $
+ * $Id: rb_evas_object_events.c
302 2005-03-22 17:41:35
Z tilman $
*
* Copyright (C) 2005 Tilman Sauerbeck (tilman at code-monkey de)
*
*
* Copyright (C) 2005 Tilman Sauerbeck (tilman at code-monkey de)
*
@@
-47,6
+47,9
@@
\
if (!rb_block_given_p ()) \
return Qnil; \
\
if (!rb_block_given_p ()) \
return Qnil; \
+\
+ if (NIL_P (e->callbacks)) \
+ e->callbacks = rb_hash_new (); \
\
rb_hash_aset (e->callbacks, rb_str_new2 (#name), \
rb_block_proc ()); \
\
rb_hash_aset (e->callbacks, rb_str_new2 (#name), \
rb_block_proc ()); \
@@
-67,8
+70,16
@@
static VALUE event_classes, cPos;
static VALUE c_ev_mouse_down_init (VALUE self, VALUE ev)
{
static VALUE c_ev_mouse_down_init (VALUE self, VALUE ev)
{
+ VALUE argv[4];
Evas_Event_Mouse_Down *e = (Evas_Event_Mouse_Down *) ev;
Evas_Event_Mouse_Down *e = (Evas_Event_Mouse_Down *) ev;
+ argv[0] = INT2FIX ((int) e->output.x);
+ argv[1] = INT2FIX ((int) e->output.y);
+ argv[2] = INT2FIX ((int) e->canvas.x);
+ argv[3] = INT2FIX ((int) e->canvas.y);
+
+ rb_iv_set (self, "@position",
+ rb_class_new_instance (4, argv, cPos));
rb_iv_set (self, "@button", INT2FIX (e->button));
return self;
rb_iv_set (self, "@button", INT2FIX (e->button));
return self;
@@
-76,8
+87,16
@@
static VALUE c_ev_mouse_down_init (VALUE self, VALUE ev)
static VALUE c_ev_mouse_up_init (VALUE self, VALUE ev)
{
static VALUE c_ev_mouse_up_init (VALUE self, VALUE ev)
{
+ VALUE argv[4];
Evas_Event_Mouse_Up *e = (Evas_Event_Mouse_Up *) ev;
Evas_Event_Mouse_Up *e = (Evas_Event_Mouse_Up *) ev;
+ argv[0] = INT2FIX ((int) e->output.x);
+ argv[1] = INT2FIX ((int) e->output.y);
+ argv[2] = INT2FIX ((int) e->canvas.x);
+ argv[3] = INT2FIX ((int) e->canvas.y);
+
+ rb_iv_set (self, "@position",
+ rb_class_new_instance (4, argv, cPos));
rb_iv_set (self, "@button", INT2FIX (e->button));
return self;
rb_iv_set (self, "@button", INT2FIX (e->button));
return self;