X-Git-Url: http://git.code-monkey.de/?p=ruby-ecore.git;a=blobdiff_plain;f=src%2Fecore_evas%2Frb_fb.c;h=830448d5ca89a3a705bef5527a818eca67d294c4;hp=8192169278ec4ff6e4f409276e7cb3a27b113828;hb=d907bd016f15dc5be72d12ee1742047eafc2abae;hpb=0ad70bf579b712a8bf770e2775cffa4a50097557 diff --git a/src/ecore_evas/rb_fb.c b/src/ecore_evas/rb_fb.c index 8192169..830448d 100644 --- a/src/ecore_evas/rb_fb.c +++ b/src/ecore_evas/rb_fb.c @@ -1,5 +1,5 @@ /* - * $Id: rb_fb.c 77 2004-08-19 17:39:29Z tilman $ + * $Id: rb_fb.c 351 2006-02-10 15:25:40Z tilman $ * * Copyright (C) 2004 ruby-ecore team (see AUTHORS) * @@ -23,6 +23,7 @@ #include #include +#include "../ecore/rb_ecore.h" #include "rb_ecore_evas_main.h" #include "rb_ecore_evas.h" @@ -31,21 +32,30 @@ static void c_free (RbEcoreEvas *ee) c_ecore_evas_free (ee, true); } +static VALUE c_alloc (VALUE klass) +{ + RbEcoreEvas *ee = NULL; + + ecore_init (); + ecore_evas_init (); + + return Data_Make_Struct (klass, RbEcoreEvas, + c_ecore_evas_mark, c_free, ee); +} + /* * call-seq: * Ecore::Evas::Fb.new([display, rotation, w, h]) => fb * * Creates an Ecore::Evas::Fb object. */ -static VALUE c_new (int argc, VALUE *argv, VALUE klass) +static VALUE c_init (int argc, VALUE *argv, VALUE self) { - VALUE self, disp, rot, w, h; - RbEcoreEvas *ee = NULL; + VALUE disp, rot, w, h; char *cdisp = NULL; int irot = 0, iw = 0, ih = 0; - self = Data_Make_Struct (klass, RbEcoreEvas, - c_ecore_evas_mark, c_free, ee); + GET_OBJ (self, RbEcoreEvas, ee); rb_scan_args (argc, argv, "04", &disp, &rot, &w, &h); @@ -69,12 +79,9 @@ static VALUE c_new (int argc, VALUE *argv, VALUE klass) ih = FIX2INT (h); } - ecore_init (); - ecore_evas_init (); - ee->real = ecore_evas_fb_new (cdisp, irot, iw, ih); - rb_obj_call_init (self, 0, NULL); + rb_call_super (argc, argv); return self; } @@ -83,5 +90,6 @@ void Init_Fb (void) { VALUE c = rb_define_class_under (mEvas, "Fb", cEcoreEvas); - rb_define_singleton_method (c, "new", c_new, -1); + rb_define_alloc_func (c, c_alloc); + rb_define_method (c, "initialize", c_init, -1); }