X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=src%2Fesmart_draggies%2Frb_esmart_draggies.c;h=287c1163969b6cc35b30bf05d78ef07a6701f382;hb=1969f6740e354d24f5a05436d0d3ffa63f9dbae9;hp=681e1958bc8b4dbfc27935f3eca2f5812589ee53;hpb=94cdd71fbad6175aba19192ebef7e54831f500ed;p=ruby-esmart.git diff --git a/src/esmart_draggies/rb_esmart_draggies.c b/src/esmart_draggies/rb_esmart_draggies.c index 681e195..287c116 100644 --- a/src/esmart_draggies/rb_esmart_draggies.c +++ b/src/esmart_draggies/rb_esmart_draggies.c @@ -1,6 +1,4 @@ /* - * $Id: rb_esmart_draggies.c 52 2004-08-01 10:19:14Z tilman $ - * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * * This library is free software; you can redistribute it and/or @@ -27,29 +25,31 @@ #include "../rb_esmart.h" -static void c_free (RbEvasObject *e) +static void on_mouse_up (void *data, Evas *e, Evas_Object *o, void *ev) { - c_evas_object_free (e, true); + ecore_evas_raise (data); } -static VALUE c_new (VALUE klass, VALUE ecore_evas) +static VALUE c_init (VALUE self, VALUE ecore_evas) { - VALUE self, argv[1]; static ID evas; - RbEvasObject *draggies; + VALUE tmp; CHECK_CLASS (ecore_evas, cEcoreEvas); GET_OBJ (ecore_evas, RbEcoreEvas, ee); + GET_OBJ (self, RbEvasObject, draggies); - self = Data_Make_Struct (klass, RbEvasObject, c_evas_object_mark, - c_free, draggies); draggies->real = esmart_draggies_new (ee->real); if (!evas) evas = rb_intern ("evas"); - argv[0] = rb_funcall (ecore_evas, evas, 0); - rb_obj_call_init (self, 1, argv); + tmp = rb_funcall (ecore_evas, evas, 0); + rb_call_super (1, &tmp); + + esmart_draggies_event_callback_add (draggies->real, + EVAS_CALLBACK_MOUSE_UP, + on_mouse_up, ee->real); return self; } @@ -74,6 +74,6 @@ void Init_esmart_draggies (void) c = rb_define_class_under (mEsmart, "Draggies", cEvasObject); - rb_define_singleton_method (c, "new", c_new, 1); + rb_define_method (c, "initialize", c_init, 1); rb_define_method (c, "button=", c_button_set, 1); }