X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=src%2Fesmart_trans_x11%2Frb_esmart_trans_x11.c;h=fa8a9da48e71d8f3c589cad314dc8979464b7536;hb=2d5931fbc6f4c336f898072dc08aec26fcb59682;hp=d986027637a8e73340eb2b189d340249124f9a51;hpb=197f83468ba03c07a5f51888e67e164e257aa9a3;p=ruby-esmart.git diff --git a/src/esmart_trans_x11/rb_esmart_trans_x11.c b/src/esmart_trans_x11/rb_esmart_trans_x11.c index d986027..fa8a9da 100644 --- a/src/esmart_trans_x11/rb_esmart_trans_x11.c +++ b/src/esmart_trans_x11/rb_esmart_trans_x11.c @@ -1,5 +1,5 @@ /* - * $Id$ + * $Id: rb_esmart_trans_x11.c 390 2006-11-11 12:10:09Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -21,70 +21,67 @@ #include #include -#include -#include -#include +#include +#include +#include #include "../rb_esmart.h" -static VALUE c_new (VALUE klass, VALUE evas) -{ - VALUE self, argv[1]; - Evas_Object **trans; +static VALUE cWindow; +static VALUE c_init (VALUE self, VALUE evas) +{ CHECK_CLASS (evas, cEvas); - GET_OBJ (evas, Evas *, e); + GET_OBJ (evas, RbEvas, e); + GET_OBJ (self, RbEvasObject, trans); - self = Data_Make_Struct (klass, Evas_Object *, c_evas_object_mark, - c_evas_object_free, trans); - *trans = esmart_trans_x11_new (*e); + trans->real = esmart_trans_x11_new (e->real); - argv[0] = evas; - rb_obj_call_init (self, 1, argv); + rb_call_super (1, &evas); return self; } 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) { - GET_OBJ (self, Evas_Object *, e); + GET_OBJ (self, RbEvasObject, e); - CHECK_CLASS (window, cEcoreXWindow); - 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; @@ -92,14 +89,18 @@ static VALUE c_freshen (VALUE self, VALUE x, VALUE y, VALUE w, VALUE h) void Init_esmart_trans_x11 (void) { - VALUE c; + VALUE m, c; rb_require ("esmart"); rb_require ("ecore_x"); + m = rb_const_get (rb_cModule, rb_intern ("Ecore")); + m = rb_const_get (m, rb_intern ("X")); + cWindow = rb_const_get (m, rb_intern ("Window")); + c = rb_define_class_under (mEsmart, "TransX11", cEvasObject); - rb_define_singleton_method (c, "new", c_new, 1); + rb_define_method (c, "initialize", c_init, 1); rb_define_method (c, "type", c_type_get, 0); rb_define_method (c, "type=", c_type_set, 1); rb_define_method (c, "window=", c_window_set, 1);