We now use real structs to wrap objects.
[ruby-esmart.git] / src / esmart_trans_x11 / rb_esmart_trans_x11.c
index fa2983698d9e47f9c08f4025350996a6021f4730..4671d62dabde06d4fc2762467438559eb013c67a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: rb_esmart_trans_x11.c 41 2004-07-25 13:15:54Z tilman $
+ * $Id: rb_esmart_trans_x11.c 52 2004-08-01 10:19:14Z tilman $
  *
  * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
  *
 #include <ruby.h>
 
 #include <Esmart/Esmart_Trans_X11.h>
-#include <rb_evas.h>
-#include <rb_evas_object.h>
+#include <evas/rb_evas.h>
+#include <evas/rb_evas_object.h>
+#include <ecore/rb_window.h>
 
 #include "../rb_esmart.h"
 
+static void c_free (RbEvasObject *e)
+{
+       c_evas_object_free (e, true);
+}
+
 static VALUE c_new (VALUE klass, VALUE evas)
 {
        VALUE self, argv[1];
-       Evas_Object **trans;
+       RbEvasObject *trans;
 
        CHECK_CLASS (evas, cEvas);
-       GET_OBJ (evas, Evas *, e);
+       GET_OBJ (evas, RbEvas, e);
 
-       self = Data_Make_Struct (klass, Evas_Object *, c_evas_object_mark,
-                                c_evas_object_free, trans);
-       *trans = esmart_trans_x11_new (*e);
+       self = Data_Make_Struct (klass, RbEvasObject, c_evas_object_mark,
+                                c_free, trans);
+       trans->real = esmart_trans_x11_new (e->real);
 
        argv[0] = evas;
        rb_obj_call_init (self, 1, argv);
@@ -46,49 +52,44 @@ static VALUE c_new (VALUE klass, VALUE evas)
 
 static VALUE c_type_get (VALUE self)
 {
-       GET_OBJ (self, Evas_Object *, e);
+       GET_OBJ (self, RbEvasObject, e);
 
-       return INT2FIX (esmart_trans_x11_type_get (*e));
+       return INT2FIX (esmart_trans_x11_type_get (e->real));
 }
 
 static VALUE c_type_set (VALUE self, VALUE val)
 {
-       GET_OBJ (self, Evas_Object *, e);
+       GET_OBJ (self, RbEvasObject, e);
 
        Check_Type (val, T_FIXNUM);
 
-       esmart_trans_x11_type_set (*e, FIX2INT (val));
+       esmart_trans_x11_type_set (e->real, FIX2INT (val));
 
        return Qnil;
 }
 
 static VALUE c_window_set (VALUE self, VALUE window)
 {
-       static VALUE c;
-
-       GET_OBJ (self, Evas_Object *, e);
-
-       if (!c)
-               c = rb_eval_string ("Ecore::X::Window");
+       GET_OBJ (self, RbEvasObject, e);
 
-       CHECK_CLASS (window, c);
-       GET_OBJ (window, Ecore_X_Window, w);
+       CHECK_CLASS (window, cWindow);
+       GET_OBJ (window, RbWindow, w);
 
-       esmart_trans_x11_window_set (*e, *w);
+       esmart_trans_x11_window_set (e->real, w->real);
 
        return Qnil;
 }
 
 static VALUE c_freshen (VALUE self, VALUE x, VALUE y, VALUE w, VALUE h)
 {
-       GET_OBJ (self, Evas_Object *, e);
+       GET_OBJ (self, RbEvasObject, e);
 
        Check_Type (x, T_FIXNUM);
        Check_Type (y, T_FIXNUM);
        Check_Type (w, T_FIXNUM);
        Check_Type (h, T_FIXNUM);
 
-       esmart_trans_x11_freshen (*e, FIX2INT (x), FIX2INT (y),
+       esmart_trans_x11_freshen (e->real, FIX2INT (x), FIX2INT (y),
                                  FIX2INT (w), FIX2INT (h));
 
        return Qnil;