Fixed class instantiation.
authorTilman Sauerbeck <tilman@code-monkey.de>
Fri, 10 Feb 2006 15:25:40 +0000 (15:25 +0000)
committerTilman Sauerbeck <tilman@code-monkey.de>
Fri, 10 Feb 2006 15:25:40 +0000 (15:25 +0000)
13 files changed:
src/ecore/rb_animator.c
src/ecore/rb_fd_handler.c
src/ecore/rb_idle_enterer.c
src/ecore/rb_idler.c
src/ecore/rb_timer.c
src/ecore_evas/rb_buffer.c
src/ecore_evas/rb_fb.c
src/ecore_evas/rb_gl_x11.c
src/ecore_evas/rb_software_x11.c
src/ecore_evas/rb_xrender_x11.c
src/ecore_job/rb_job.c
src/ecore_x/rb_cursor.c
src/ecore_x/rb_window.c

index 41837ded1c0d5832864e647f2a7f1c06817e09ce..9a3ce2778bb7a5fd2d6718448616c11c37633aa1 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * $Id: rb_animator.c 150 2004-12-03 13:45:00Z tilman $
+ * $Id: rb_animator.c 351 2006-02-10 15:25:40Z tilman $
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
@@ -73,24 +73,26 @@ static void c_free (RbAnimator *animator)
        free (animator);
 }
 
        free (animator);
 }
 
-static VALUE c_new (VALUE klass)
+static VALUE c_alloc (VALUE klass)
 {
 {
-       VALUE self;
        RbAnimator *animator = NULL;
 
        RbAnimator *animator = NULL;
 
-       if (!rb_block_given_p ())
-               return Qnil;
+       ecore_init ();
 
 
-       self = Data_Make_Struct (klass, RbAnimator, c_mark, c_free, animator);
+       return Data_Make_Struct (klass, RbAnimator, c_mark, c_free, animator);
+}
 
 
-       ecore_init ();
+static VALUE c_init (VALUE self)
+{
+       GET_OBJ (self, RbAnimator, animator);
+
+       if (!rb_block_given_p ())
+               rb_raise (rb_eStandardError, "block missing");
 
        animator->callback = rb_block_proc ();
        animator->deleted = false;
        animator->real = ecore_animator_add (on_animator, animator);
 
 
        animator->callback = rb_block_proc ();
        animator->deleted = false;
        animator->real = ecore_animator_add (on_animator, animator);
 
-       rb_obj_call_init (self, 0, NULL);
-
        return self;
 }
 
        return self;
 }
 
@@ -112,6 +114,7 @@ void Init_Animator (void)
 {
        VALUE c = rb_define_class_under (mEcore, "Animator", rb_cObject);
 
 {
        VALUE c = rb_define_class_under (mEcore, "Animator", rb_cObject);
 
-       rb_define_singleton_method (c, "new", c_new, 0);
+       rb_define_alloc_func (c, c_alloc);
+       rb_define_method (c, "initialize", c_init, 0);
        rb_define_method (c, "delete", c_delete, 0);
 }
        rb_define_method (c, "delete", c_delete, 0);
 }
index 4d7e08c9e616be99bb835a44954c6c41ecc002ca..c37e310bfd4d4034382e4dd775ae7829dcbbafca 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * $Id: rb_fd_handler.c 109 2004-09-01 20:33:15Z tilman $
+ * $Id: rb_fd_handler.c 351 2006-02-10 15:25:40Z tilman $
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
@@ -62,28 +62,30 @@ static void c_free (RbFdHandler *fdh)
        free (fdh);
 }
 
        free (fdh);
 }
 
-static VALUE c_new (VALUE klass, VALUE fd, VALUE flags)
+static VALUE c_alloc (VALUE klass)
 {
 {
-       VALUE self;
        RbFdHandler *fdh = NULL;
 
        RbFdHandler *fdh = NULL;
 
+       ecore_init ();
+
+       return Data_Make_Struct (klass, RbFdHandler, c_mark, c_free, fdh);
+}
+
+static VALUE c_init (VALUE self, VALUE fd, VALUE flags)
+{
+       GET_OBJ (self, RbFdHandler, fdh);
+
        if (!rb_block_given_p ())
        if (!rb_block_given_p ())
-               return Qnil;
+               rb_raise (rb_eStandardError, "block missing");
 
        Check_Type (fd, T_FIXNUM);
        Check_Type (flags, T_FIXNUM);
 
 
        Check_Type (fd, T_FIXNUM);
        Check_Type (flags, T_FIXNUM);
 
-       self = Data_Make_Struct (klass, RbFdHandler, c_mark, c_free, fdh);
-
-       ecore_init ();
-
        fdh->callback = rb_block_proc ();
        fdh->real = ecore_main_fd_handler_add (FIX2INT (fd),
                                               FIX2INT (flags), on_change,
                                               fdh, NULL, NULL);
 
        fdh->callback = rb_block_proc ();
        fdh->real = ecore_main_fd_handler_add (FIX2INT (fd),
                                               FIX2INT (flags), on_change,
                                               fdh, NULL, NULL);
 
-       rb_obj_call_init (self, 0, NULL);
-
        return self;
 }
 
        return self;
 }
 
@@ -132,7 +134,8 @@ void Init_FdHandler (void)
 {
        VALUE c = rb_define_class_under (mEcore, "FdHandler", rb_cObject);
 
 {
        VALUE c = rb_define_class_under (mEcore, "FdHandler", rb_cObject);
 
-       rb_define_singleton_method (c, "new", c_new, 2);
+       rb_define_alloc_func (c, c_alloc);
+       rb_define_method (c, "initialize", c_init, 2);
        rb_define_method (c, "delete", c_delete, 0);
        rb_define_method (c, "fd", c_fd_get, 0);
        rb_define_method (c, "get_active", c_get_active, 1);
        rb_define_method (c, "delete", c_delete, 0);
        rb_define_method (c, "fd", c_fd_get, 0);
        rb_define_method (c, "get_active", c_get_active, 1);
index 39bac7e18a4b3c287973e8612b698e39f85815fb..236f891eab68be141d892698a9fbca69d8e80b52 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * $Id: rb_idle_enterer.c 154 2004-12-09 18:49:18Z tilman $
+ * $Id: rb_idle_enterer.c 351 2006-02-10 15:25:40Z tilman $
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
@@ -62,6 +62,16 @@ static void c_free (RbIdleEnterer *idle_enterer)
        free (idle_enterer);
 }
 
        free (idle_enterer);
 }
 
+static VALUE c_alloc (VALUE klass)
+{
+       RbIdleEnterer *idle_enterer;
+
+       ecore_init ();
+
+       return Data_Make_Struct (klass, RbIdleEnterer, c_mark, c_free,
+                                idle_enterer);
+}
+
 /*
  * call-seq:
  *  Ecore::IdleEnterer.new { block } => idle_enterer
 /*
  * call-seq:
  *  Ecore::IdleEnterer.new { block } => idle_enterer
@@ -70,26 +80,18 @@ static void c_free (RbIdleEnterer *idle_enterer)
  * When Ecore enters the idle state, the specified block will be called.
  * If the block returns false, the IdleEnterer is deleted.
  */
  * When Ecore enters the idle state, the specified block will be called.
  * If the block returns false, the IdleEnterer is deleted.
  */
-static VALUE c_new (VALUE klass)
+static VALUE c_init (VALUE self)
 {
 {
-       VALUE self;
-       RbIdleEnterer *idle_enterer;
+       GET_OBJ (self, RbIdleEnterer, idle_enterer);
 
        if (!rb_block_given_p ())
 
        if (!rb_block_given_p ())
-               return Qnil;
-
-       self = Data_Make_Struct (klass, RbIdleEnterer, c_mark, c_free,
-                                idle_enterer);
-
-       ecore_init ();
+               rb_raise (rb_eStandardError, "block missing");
 
        idle_enterer->callback = rb_block_proc ();
        idle_enterer->deleted = false;
        idle_enterer->real = ecore_idle_enterer_add (on_idle_enter,
                                                     idle_enterer);
 
 
        idle_enterer->callback = rb_block_proc ();
        idle_enterer->deleted = false;
        idle_enterer->real = ecore_idle_enterer_add (on_idle_enter,
                                                     idle_enterer);
 
-       rb_obj_call_init (self, 0, NULL);
-
        return self;
 }
 
        return self;
 }
 
@@ -117,6 +119,7 @@ void Init_IdleEnterer (void)
 {
        VALUE c = rb_define_class_under (mEcore, "IdleEnterer", rb_cObject);
 
 {
        VALUE c = rb_define_class_under (mEcore, "IdleEnterer", rb_cObject);
 
-       rb_define_singleton_method (c, "new", c_new, 0);
+       rb_define_alloc_func (c, c_alloc);
+       rb_define_method (c, "initialize", c_init, 0);
        rb_define_method (c, "delete", c_delete, 0);
 }
        rb_define_method (c, "delete", c_delete, 0);
 }
index d03a5ba8f0abe34c7c65e0cd039f3b1f5315d6ca..746229050c055168531666b11b332d76a42507a0 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * $Id: rb_idler.c 154 2004-12-09 18:49:18Z tilman $
+ * $Id: rb_idler.c 351 2006-02-10 15:25:40Z tilman $
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
@@ -62,6 +62,15 @@ static void c_free (RbIdler *idler)
        free (idler);
 }
 
        free (idler);
 }
 
+static VALUE c_alloc (VALUE klass)
+{
+       RbIdler *idler;
+
+       ecore_init ();
+
+       return Data_Make_Struct (klass, RbIdler, c_mark, c_free, idler);
+}
+
 /*
  * call-seq:
  *  Ecore::Idler.new { block } => idler
 /*
  * call-seq:
  *  Ecore::Idler.new { block } => idler
@@ -70,24 +79,17 @@ static void c_free (RbIdler *idler)
  * When Ecore is idle, the specified block will be called.
  * If the block returns false, the idler is deleted.
  */
  * When Ecore is idle, the specified block will be called.
  * If the block returns false, the idler is deleted.
  */
-static VALUE c_new (VALUE klass)
+static VALUE c_init (VALUE self)
 {
 {
-       VALUE self;
-       RbIdler *idler;
+       GET_OBJ (self, RbIdler, idler);
 
        if (!rb_block_given_p ())
 
        if (!rb_block_given_p ())
-               return Qnil;
-
-       self = Data_Make_Struct (klass, RbIdler, c_mark, c_free, idler);
-
-       ecore_init ();
+               rb_raise (rb_eStandardError, "block missing");
 
        idler->callback = rb_block_proc ();
        idler->deleted = false;
        idler->real = ecore_idler_add (on_idler, idler);
 
 
        idler->callback = rb_block_proc ();
        idler->deleted = false;
        idler->real = ecore_idler_add (on_idler, idler);
 
-       rb_obj_call_init (self, 0, NULL);
-
        return self;
 }
 
        return self;
 }
 
@@ -115,6 +117,7 @@ void Init_Idler (void)
 {
        VALUE c = rb_define_class_under (mEcore, "Idler", rb_cObject);
 
 {
        VALUE c = rb_define_class_under (mEcore, "Idler", rb_cObject);
 
-       rb_define_singleton_method (c, "new", c_new, 0);
+       rb_define_alloc_func (c, c_alloc);
+       rb_define_method (c, "initialize", c_init, 0);
        rb_define_method (c, "delete", c_delete, 0);
 }
        rb_define_method (c, "delete", c_delete, 0);
 }
index 05e259249310b26f13c845e8ce82b4cdcbbc31d4..939a88d9df91c8a64a0f8e5790ad10b107255d31 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * $Id: rb_timer.c 279 2005-03-13 14:32:25Z tilman $
+ * $Id: rb_timer.c 351 2006-02-10 15:25:40Z tilman $
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
@@ -62,6 +62,15 @@ static void c_free (RbTimer *timer)
        free (timer);
 }
 
        free (timer);
 }
 
+static VALUE c_alloc (VALUE klass)
+{
+       RbTimer *timer = NULL;
+
+       ecore_init ();
+
+       return Data_Make_Struct (klass, RbTimer, c_mark, c_free, timer);
+}
+
 /*
  * call-seq:
  *  Ecore::Timer.new(interval) { block } => timer
 /*
  * call-seq:
  *  Ecore::Timer.new(interval) { block } => timer
@@ -70,25 +79,18 @@ static void c_free (RbTimer *timer)
  * When the timeout is hit, the block is called.
  * If the block returns false, the timer is deleted.
  */
  * When the timeout is hit, the block is called.
  * If the block returns false, the timer is deleted.
  */
-static VALUE c_new (VALUE klass, VALUE interval)
+static VALUE c_init (VALUE self, VALUE interval)
 {
 {
-       VALUE self;
-       RbTimer *timer = NULL;
+       GET_OBJ (self, RbTimer, timer);
 
        if (!rb_block_given_p ())
 
        if (!rb_block_given_p ())
-               return Qnil;
-
-       self = Data_Make_Struct (klass, RbTimer, c_mark, c_free, timer);
-
-       ecore_init ();
+               rb_raise (rb_eStandardError, "block missing");
 
        timer->callback = rb_block_proc ();
        timer->deleted = false;
        timer->real = ecore_timer_add (NUM2DBL (interval),
                                       on_timer, timer);
 
 
        timer->callback = rb_block_proc ();
        timer->deleted = false;
        timer->real = ecore_timer_add (NUM2DBL (interval),
                                       on_timer, timer);
 
-       rb_obj_call_init (self, 0, NULL);
-
        return self;
 }
 
        return self;
 }
 
@@ -132,7 +134,8 @@ void Init_Timer (void)
 {
        VALUE c = rb_define_class_under (mEcore, "Timer", rb_cObject);
 
 {
        VALUE c = rb_define_class_under (mEcore, "Timer", rb_cObject);
 
-       rb_define_singleton_method (c, "new", c_new, 1);
+       rb_define_alloc_func (c, c_alloc);
+       rb_define_method (c, "initialize", c_init, 1);
        rb_define_method (c, "delete", c_delete, 0);
        rb_define_method (c, "deleted?", c_deleted_get, 0);
        rb_define_method (c, "interval=", c_interval_set, 1);
        rb_define_method (c, "delete", c_delete, 0);
        rb_define_method (c, "deleted?", c_deleted_get, 0);
        rb_define_method (c, "interval=", c_interval_set, 1);
index db316cc1737881cf16938c5109bab40899aacfeb..9526f963cf182bc255af0a8e3eacc9209b40535a 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * $Id: rb_buffer.c 174 2005-01-19 21:31:04Z tilman $
+ * $Id: rb_buffer.c 351 2006-02-10 15:25:40Z tilman $
  *
  * Copyright (C) 2004-2005 ruby-ecore team (see AUTHORS)
  *
  *
  * Copyright (C) 2004-2005 ruby-ecore team (see AUTHORS)
  *
@@ -32,20 +32,29 @@ static void c_free (RbEcoreEvas *ee)
        c_ecore_evas_free (ee, true);
 }
 
        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::Buffer.new([w, h]) => buffer
  *
  * Creates an Ecore::Evas::Buffer object.
  */
 /*
  * call-seq:
  *  Ecore::Evas::Buffer.new([w, h]) => buffer
  *
  * Creates an Ecore::Evas::Buffer object.
  */
-static VALUE c_new (int argc, VALUE *argv, VALUE klass)
+static VALUE c_init (int argc, VALUE *argv, VALUE self)
 {
 {
-       VALUE self, w, h;
-       RbEcoreEvas *ee = NULL;
+       VALUE w, h;
        int iw = 0, ih = 0;
 
        int 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, "02", &w, &h);
 
 
        rb_scan_args (argc, argv, "02", &w, &h);
 
@@ -59,12 +68,9 @@ static VALUE c_new (int argc, VALUE *argv, VALUE klass)
                ih = FIX2INT (h);
        }
 
                ih = FIX2INT (h);
        }
 
-       ecore_init ();
-       ecore_evas_init ();
-
        ee->real = ecore_evas_buffer_new (iw, ih);
 
        ee->real = ecore_evas_buffer_new (iw, ih);
 
-       rb_obj_call_init (self, 0, NULL);
+       rb_call_super (argc, argv);
 
        return self;
 }
 
        return self;
 }
@@ -89,6 +95,7 @@ void Init_Buffer (void)
 {
        VALUE c = rb_define_class_under (mEvas, "Buffer", cEcoreEvas);
 
 {
        VALUE c = rb_define_class_under (mEvas, "Buffer", 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);
        rb_define_method (c, "pixels", c_pixels_get, 0);
 }
        rb_define_method (c, "pixels", c_pixels_get, 0);
 }
index 8192169278ec4ff6e4f409276e7cb3a27b113828..830448d5ca89a3a705bef5527a818eca67d294c4 100644 (file)
@@ -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)
  *
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
@@ -23,6 +23,7 @@
 #include <Ecore.h>
 #include <Ecore_Evas.h>
 
 #include <Ecore.h>
 #include <Ecore_Evas.h>
 
+#include "../ecore/rb_ecore.h"
 #include "rb_ecore_evas_main.h"
 #include "rb_ecore_evas.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);
 }
 
        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.
  */
 /*
  * 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;
 
        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);
 
 
        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);
        }
 
                ih = FIX2INT (h);
        }
 
-       ecore_init ();
-       ecore_evas_init ();
-
        ee->real = ecore_evas_fb_new (cdisp, irot, iw, ih);
 
        ee->real = ecore_evas_fb_new (cdisp, irot, iw, ih);
 
-       rb_obj_call_init (self, 0, NULL);
+       rb_call_super (argc, argv);
 
        return self;
 }
 
        return self;
 }
@@ -83,5 +90,6 @@ void Init_Fb (void)
 {
        VALUE c = rb_define_class_under (mEvas, "Fb", cEcoreEvas);
 
 {
        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);
 }
 }
index 6e9263cd994de1e0186744059448cf0e859c00ab..c0e5136f4e3e2f66627ef5e98c605a05ae8d90f5 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * $Id: rb_gl_x11.c 100 2004-08-27 09:31:26Z tilman $
+ * $Id: rb_gl_x11.c 351 2006-02-10 15:25:40Z tilman $
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
@@ -52,22 +52,31 @@ static void c_free (RbEcoreEvasGlX11 *ee)
        free (ee);
 }
 
        free (ee);
 }
 
+static VALUE c_alloc (VALUE klass)
+{
+       RbEcoreEvasGlX11 *ee = NULL;
+
+       ecore_init ();
+       ecore_evas_init ();
+
+       return Data_Make_Struct (klass, RbEcoreEvasGlX11,
+                                c_mark, c_free, ee);
+}
+
 /*
  * call-seq:
  *  Ecore::Evas::GlX11.new([display, parent, x, y, w, h]) => glx11
  *
  * Creates an Ecore::Evas::GlX11 object.
  */
 /*
  * call-seq:
  *  Ecore::Evas::GlX11.new([display, parent, x, y, w, h]) => glx11
  *
  * Creates an Ecore::Evas::GlX11 object.
  */
-static VALUE c_new (int argc, VALUE *argv, VALUE klass)
+static VALUE c_init (int argc, VALUE *argv, VALUE self)
 {
 {
-       VALUE self, disp, parent, geom[4];
-       RbEcoreEvasGlX11 *ee = NULL;
+       VALUE disp, parent, geom[4];
        RbWindow *win = NULL;
        char *cdisp = NULL;
        int i, igeom[4] = {0, 0, 0, 0};
 
        RbWindow *win = NULL;
        char *cdisp = NULL;
        int i, igeom[4] = {0, 0, 0, 0};
 
-       self = Data_Make_Struct (klass, RbEcoreEvasGlX11,
-                                c_mark, c_free, ee);
+       GET_OBJ (self, RbEcoreEvasGlX11, ee);
 
        rb_scan_args (argc, argv, "06", &disp, &parent,
                      &geom[0], &geom[1], &geom[2], &geom[3]);
 
        rb_scan_args (argc, argv, "06", &disp, &parent,
                      &geom[0], &geom[1], &geom[2], &geom[3]);
@@ -88,9 +97,6 @@ static VALUE c_new (int argc, VALUE *argv, VALUE klass)
                        igeom[i] = FIX2INT (geom[i]);
                }
 
                        igeom[i] = FIX2INT (geom[i]);
                }
 
-       ecore_init ();
-       ecore_evas_init ();
-
        ee->ee.real = ecore_evas_gl_x11_new (cdisp,
                                             win ? win->real : 0,
                                             igeom[0], igeom[1],
        ee->ee.real = ecore_evas_gl_x11_new (cdisp,
                                             win ? win->real : 0,
                                             igeom[0], igeom[1],
@@ -98,7 +104,7 @@ static VALUE c_new (int argc, VALUE *argv, VALUE klass)
        ee->parent_window = parent;
        ee->window = Qnil;
 
        ee->parent_window = parent;
        ee->window = Qnil;
 
-       rb_obj_call_init (self, 0, NULL);
+       rb_call_super (argc, argv);
 
        return self;
 }
 
        return self;
 }
@@ -131,6 +137,7 @@ void Init_GlX11 (void)
 
        c = rb_define_class_under (mEvas, "GlX11", cEcoreEvas);
 
 
        c = rb_define_class_under (mEvas, "GlX11", 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);
        rb_define_method (c, "window", c_window_get, 0);
 }
        rb_define_method (c, "window", c_window_get, 0);
 }
index 9aafa26a9cf6751d469dfbc3a5026f95e35cd5b4..8549dc550adcdeb7b7297aad84868ffa621fb8ae 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * $Id: rb_software_x11.c 100 2004-08-27 09:31:26Z tilman $
+ * $Id: rb_software_x11.c 351 2006-02-10 15:25:40Z tilman $
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
@@ -52,22 +52,31 @@ static void c_free (RbEcoreEvasSoftwareX11 *ee)
        free (ee);
 }
 
        free (ee);
 }
 
+static VALUE c_alloc (VALUE klass)
+{
+       RbEcoreEvasSoftwareX11 *ee = NULL;
+
+       ecore_init ();
+       ecore_evas_init ();
+
+       return Data_Make_Struct (klass, RbEcoreEvasSoftwareX11,
+                                c_mark, c_free, ee);
+}
+
 /*
  * call-seq:
  *  Ecore::Evas::SoftwareX11.new([display, parent, x, y, w, h]) => swx11
  *
  * Creates an Ecore::Evas::SoftwareX11 object.
  */
 /*
  * call-seq:
  *  Ecore::Evas::SoftwareX11.new([display, parent, x, y, w, h]) => swx11
  *
  * Creates an Ecore::Evas::SoftwareX11 object.
  */
-static VALUE c_new (int argc, VALUE *argv, VALUE klass)
+static VALUE c_init (int argc, VALUE *argv, VALUE self)
 {
 {
-       VALUE self, disp, parent, geom[4];
-       RbEcoreEvasSoftwareX11 *ee = NULL;
+       VALUE disp, parent, geom[4];
        RbWindow *win = NULL;
        char *cdisp = NULL;
        int i, igeom[4] = {0, 0, 0, 0};
 
        RbWindow *win = NULL;
        char *cdisp = NULL;
        int i, igeom[4] = {0, 0, 0, 0};
 
-       self = Data_Make_Struct (klass, RbEcoreEvasSoftwareX11,
-                                c_mark, c_free, ee);
+       GET_OBJ (self, RbEcoreEvasSoftwareX11, ee);
 
        rb_scan_args (argc, argv, "06", &disp, &parent,
                      &geom[0], &geom[1], &geom[2], &geom[3]);
 
        rb_scan_args (argc, argv, "06", &disp, &parent,
                      &geom[0], &geom[1], &geom[2], &geom[3]);
@@ -88,9 +97,6 @@ static VALUE c_new (int argc, VALUE *argv, VALUE klass)
                        igeom[i] = FIX2INT (geom[i]);
                }
 
                        igeom[i] = FIX2INT (geom[i]);
                }
 
-       ecore_init ();
-       ecore_evas_init ();
-
        ee->ee.real = ecore_evas_software_x11_new (cdisp,
                                                   win ? win->real : 0,
                                                   igeom[0], igeom[1],
        ee->ee.real = ecore_evas_software_x11_new (cdisp,
                                                   win ? win->real : 0,
                                                   igeom[0], igeom[1],
@@ -98,7 +104,7 @@ static VALUE c_new (int argc, VALUE *argv, VALUE klass)
        ee->parent_window = parent;
        ee->window = Qnil;
 
        ee->parent_window = parent;
        ee->window = Qnil;
 
-       rb_obj_call_init (self, 0, NULL);
+       rb_call_super (argc, argv);
 
        return self;
 }
 
        return self;
 }
@@ -131,6 +137,7 @@ void Init_SoftwareX11 (void)
 
        c = rb_define_class_under (mEvas, "SoftwareX11", cEcoreEvas);
 
 
        c = rb_define_class_under (mEvas, "SoftwareX11", 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);
        rb_define_method (c, "window", c_window_get, 0);
 }
        rb_define_method (c, "window", c_window_get, 0);
 }
index a403bfa3669d83ac235da474f0dea5c919ee2d77..505638d21fc545ccefc3dee6204130af008c861a 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * $Id: rb_xrender_x11.c 348 2005-12-24 17:11:24Z tilman $
+ * $Id: rb_xrender_x11.c 351 2006-02-10 15:25:40Z tilman $
  *
  * Copyright (C) 2005 ruby-ecore team (see AUTHORS)
  *
  *
  * Copyright (C) 2005 ruby-ecore team (see AUTHORS)
  *
@@ -52,22 +52,31 @@ static void c_free (RbEcoreEvasXRenderX11 *ee)
        free (ee);
 }
 
        free (ee);
 }
 
+static VALUE c_alloc (VALUE klass)
+{
+       RbEcoreEvasXRenderX11 *ee = NULL;
+
+       ecore_init ();
+       ecore_evas_init ();
+
+       return Data_Make_Struct (klass, RbEcoreEvasXRenderX11,
+                                c_mark, c_free, ee);
+}
+
 /*
  * call-seq:
  *  Ecore::Evas::XRenderX11.new([display, parent, x, y, w, h]) => xrx11
  *
  * Creates an Ecore::Evas::XRenderX11 object.
  */
 /*
  * call-seq:
  *  Ecore::Evas::XRenderX11.new([display, parent, x, y, w, h]) => xrx11
  *
  * Creates an Ecore::Evas::XRenderX11 object.
  */
-static VALUE c_new (int argc, VALUE *argv, VALUE klass)
+static VALUE c_init (int argc, VALUE *argv, VALUE self)
 {
 {
-       VALUE self, disp, parent, geom[4];
-       RbEcoreEvasXRenderX11 *ee = NULL;
+       VALUE disp, parent, geom[4];
        RbWindow *win = NULL;
        char *cdisp = NULL;
        int i, igeom[4] = {0, 0, 0, 0};
 
        RbWindow *win = NULL;
        char *cdisp = NULL;
        int i, igeom[4] = {0, 0, 0, 0};
 
-       self = Data_Make_Struct (klass, RbEcoreEvasXRenderX11,
-                                c_mark, c_free, ee);
+       GET_OBJ (self, RbEcoreEvasXRenderX11, ee);
 
        rb_scan_args (argc, argv, "06", &disp, &parent,
                      &geom[0], &geom[1], &geom[2], &geom[3]);
 
        rb_scan_args (argc, argv, "06", &disp, &parent,
                      &geom[0], &geom[1], &geom[2], &geom[3]);
@@ -88,9 +97,6 @@ static VALUE c_new (int argc, VALUE *argv, VALUE klass)
                        igeom[i] = FIX2INT (geom[i]);
                }
 
                        igeom[i] = FIX2INT (geom[i]);
                }
 
-       ecore_init ();
-       ecore_evas_init ();
-
        ee->ee.real = ecore_evas_xrender_x11_new (cdisp,
                                                  win ? win->real : 0,
                                                  igeom[0], igeom[1],
        ee->ee.real = ecore_evas_xrender_x11_new (cdisp,
                                                  win ? win->real : 0,
                                                  igeom[0], igeom[1],
@@ -98,7 +104,7 @@ static VALUE c_new (int argc, VALUE *argv, VALUE klass)
        ee->parent_window = parent;
        ee->window = Qnil;
 
        ee->parent_window = parent;
        ee->window = Qnil;
 
-       rb_obj_call_init (self, 0, NULL);
+       rb_call_super (argc, argv);
 
        return self;
 }
 
        return self;
 }
@@ -131,6 +137,7 @@ void Init_XRenderX11 (void)
 
        c = rb_define_class_under (mEvas, "XRenderX11", cEcoreEvas);
 
 
        c = rb_define_class_under (mEvas, "XRenderX11", 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);
        rb_define_method (c, "window", c_window_get, 0);
 }
        rb_define_method (c, "window", c_window_get, 0);
 }
index 71fe1e3143308f28ed545fc34396b65c6f0c3447..5c4ff46c00cc55620c414ac9abacb77b28c8ce95 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * $Id: rb_job.c 77 2004-08-19 17:39:29Z tilman $
+ * $Id: rb_job.c 351 2006-02-10 15:25:40Z tilman $
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
@@ -55,6 +55,15 @@ static void c_free (RbJob *job)
        free (job);
 }
 
        free (job);
 }
 
+static VALUE c_alloc (VALUE klass)
+{
+       RbJob *job = NULL;
+
+       ecore_init ();
+
+       return Data_Make_Struct (klass, RbJob, c_mark, c_free, job);
+}
+
 /*
  * call-seq:
  *  Ecore::Job::Job.new { block } => job
 /*
  * call-seq:
  *  Ecore::Job::Job.new { block } => job
@@ -62,24 +71,19 @@ static void c_free (RbJob *job)
  * Creates an Ecore::Job::Job object.
  * After execution, the object will be deleted.
  */
  * Creates an Ecore::Job::Job object.
  * After execution, the object will be deleted.
  */
-static VALUE c_new (VALUE klass)
+static VALUE c_init (VALUE self)
 {
 {
-       VALUE self;
-       RbJob *job;
+       RbJob *job = NULL;
 
        if (!rb_block_given_p ())
 
        if (!rb_block_given_p ())
-               return Qnil;
-
-       self = Data_Make_Struct (klass, RbJob, c_mark, c_free, job);
+               rb_raise (rb_eStandardError, "block missing");
 
 
-       ecore_init ();
+       Data_Get_Struct (self, RbJob, job);
 
        job->callback = rb_block_proc ();
        job->deleted = false;
        job->real = ecore_job_add (on_job, job);
 
 
        job->callback = rb_block_proc ();
        job->deleted = false;
        job->real = ecore_job_add (on_job, job);
 
-       rb_obj_call_init (self, 0, NULL);
-
        return self;
 }
 
        return self;
 }
 
@@ -110,6 +114,7 @@ void Init_Job (void)
 {
        VALUE c = rb_define_class_under (mJob, "Job", rb_cObject);
 
 {
        VALUE c = rb_define_class_under (mJob, "Job", rb_cObject);
 
-       rb_define_singleton_method (c, "new", c_new, 0);
+       rb_define_alloc_func (c, c_alloc);
+       rb_define_method (c, "initialize", c_init, 0);
        rb_define_method (c, "delete", c_delete, 0);
 }
        rb_define_method (c, "delete", c_delete, 0);
 }
index 0612666818ced7f212710a0d3cfbdc90f97bb774..f025f6ebd5c2de6e12fab3ce9f4504cb78cfd532 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * $Id: rb_cursor.c 109 2004-09-01 20:33:15Z tilman $
+ * $Id: rb_cursor.c 351 2006-02-10 15:25:40Z tilman $
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
@@ -38,18 +38,25 @@ static void c_free (RbCursor *c)
        free (c);
 }
 
        free (c);
 }
 
+static VALUE c_alloc (VALUE klass)
+{
+       RbCursor *cursor = NULL;
+
+       return Data_Make_Struct (klass, RbCursor, NULL, c_free, cursor);
+}
+
 static VALUE c_new_from_shape (VALUE klass, VALUE shape)
 {
        VALUE self;
        RbCursor *cursor = NULL;
 
 static VALUE c_new_from_shape (VALUE klass, VALUE shape)
 {
        VALUE self;
        RbCursor *cursor = NULL;
 
-       self = Data_Make_Struct (klass, RbCursor, NULL, c_free, cursor);
+       self = rb_class_new_instance (1, &shape, klass);
+
+       Data_Get_Struct (self, RbCursor, cursor);
 
        cursor->real = ecore_x_cursor_shape_get (FIX2INT (shape));
        cursor->need_free = false;
 
 
        cursor->real = ecore_x_cursor_shape_get (FIX2INT (shape));
        cursor->need_free = false;
 
-       rb_obj_call_init (self, 0, NULL);
-
        return self;
 }
 
        return self;
 }
 
@@ -57,6 +64,7 @@ void Init_Cursor (void)
 {
        cCursor = rb_define_class_under (mX, "Cursor", rb_cObject);
 
 {
        cCursor = rb_define_class_under (mX, "Cursor", rb_cObject);
 
+       rb_define_alloc_func (cCursor, c_alloc);
        rb_define_singleton_method (cCursor, "new_from_shape",
                                    c_new_from_shape, 1);
 
        rb_define_singleton_method (cCursor, "new_from_shape",
                                    c_new_from_shape, 1);
 
index 6aca50968d09484e0f0b51572a125bd6f9343049..204d3014444db9e32a8d5972bc6dca4d32e48de5 100644 (file)
@@ -1,5 +1,5 @@
 /*
 /*
- * $Id: rb_window.c 111 2004-09-02 18:47:00Z tilman $
+ * $Id: rb_window.c 351 2006-02-10 15:25:40Z tilman $
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
  *
  * Copyright (C) 2004 ruby-ecore team (see AUTHORS)
  *
@@ -60,14 +60,21 @@ VALUE TO_ECORE_X_WINDOW (VALUE parent, Ecore_X_Window w)
        return self;
 }
 
        return self;
 }
 
-static VALUE c_new (int argc, VALUE *argv, VALUE klass)
+static VALUE c_alloc (VALUE klass)
 {
 {
-       VALUE self, parent, geom[4];
-       RbWindow *window = NULL, *p = NULL;
+       RbWindow *window = NULL;
+
+       return Data_Make_Struct (cWindow, RbWindow, c_mark, c_free, window);
+}
+
+static VALUE c_init (int argc, VALUE *argv, VALUE self)
+{
+       VALUE parent, geom[4];
+       RbWindow *p = NULL;
        int i, igeom[4] = {0, 0, 0, 0};
        Ecore_X_Window pwin = 0;
 
        int i, igeom[4] = {0, 0, 0, 0};
        Ecore_X_Window pwin = 0;
 
-       self = Data_Make_Struct (cWindow, RbWindow, c_mark, c_free, window);
+       GET_OBJ (self, RbWindow, win);
 
        rb_scan_args (argc, argv, "05",
                      &parent, &geom[0], &geom[1], &geom[2], &geom[3]);
 
        rb_scan_args (argc, argv, "05",
                      &parent, &geom[0], &geom[1], &geom[2], &geom[3]);
@@ -84,17 +91,10 @@ static VALUE c_new (int argc, VALUE *argv, VALUE klass)
                        igeom[i] = FIX2INT (geom[i]);
                }
 
                        igeom[i] = FIX2INT (geom[i]);
                }
 
-       window->real = ecore_x_window_new (pwin, igeom[0], igeom[1],
-                                          igeom[2], igeom[3]);
-       window->parent = parent;
+       win->real = ecore_x_window_new (pwin, igeom[0], igeom[1],
+                                       igeom[2], igeom[3]);
+       win->parent = parent;
 
 
-       rb_obj_call_init (self, 0, NULL);
-
-       return self;
-}
-
-static VALUE c_init (int argc, VALUE *argv, VALUE self)
-{
        rb_iv_set (self, "@cursor", Qnil);
 
        return self;
        rb_iv_set (self, "@cursor", Qnil);
 
        return self;
@@ -330,6 +330,7 @@ static VALUE c_parent_get (VALUE self)
                                  ecore_x_window_parent_get (win->real));
 }
 
                                  ecore_x_window_parent_get (win->real));
 }
 
+#if 0
 static VALUE c_title_get (VALUE self)
 {
        char *s;
 static VALUE c_title_get (VALUE self)
 {
        char *s;
@@ -351,6 +352,7 @@ static VALUE c_title_set (VALUE self, VALUE val)
 
        return Qnil;
 }
 
        return Qnil;
 }
+#endif
 
 static VALUE c_set_event_mask (VALUE self, VALUE val)
 {
 
 static VALUE c_set_event_mask (VALUE self, VALUE val)
 {
@@ -374,6 +376,7 @@ static VALUE c_unset_event_mask (VALUE self, VALUE val)
        return Qnil;
 }
 
        return Qnil;
 }
 
+#if 0
 static VALUE c_set_protocol (VALUE self, VALUE proto, VALUE on)
 {
        GET_OBJ (self, RbWindow, win);
 static VALUE c_set_protocol (VALUE self, VALUE proto, VALUE on)
 {
        GET_OBJ (self, RbWindow, win);
@@ -386,6 +389,7 @@ static VALUE c_set_protocol (VALUE self, VALUE proto, VALUE on)
 
        return Qnil;
 }
 
        return Qnil;
 }
+#endif
 
 static VALUE c_get_protocol (VALUE self, VALUE proto)
 {
 
 static VALUE c_get_protocol (VALUE self, VALUE proto)
 {
@@ -398,6 +402,7 @@ static VALUE c_get_protocol (VALUE self, VALUE proto)
        return s ? Qtrue : Qfalse;
 }
 
        return s ? Qtrue : Qfalse;
 }
 
+#if 0
 static VALUE c_sticky_get (VALUE self)
 {
        int s;
 static VALUE c_sticky_get (VALUE self)
 {
        int s;
@@ -442,6 +447,7 @@ static VALUE c_borderless_set (VALUE self, VALUE val)
 
        return Qnil;
 }
 
        return Qnil;
 }
+#endif
 
 static VALUE c_cursor_set (VALUE self, VALUE val)
 {
 
 static VALUE c_cursor_set (VALUE self, VALUE val)
 {
@@ -505,7 +511,7 @@ void Init_Window (void)
 {
        cWindow = rb_define_class_under (mX, "Window", rb_cObject);
 
 {
        cWindow = rb_define_class_under (mX, "Window", rb_cObject);
 
-       rb_define_singleton_method (cWindow, "new", c_new, -1);
+       rb_define_alloc_func (cWindow, c_alloc);
        rb_define_method (cWindow, "initialize", c_init, -1);
        rb_define_method (cWindow, "inspect", c_inspect, 0);
        rb_define_method (cWindow, "eql?", c_equal_value, 1);
        rb_define_method (cWindow, "initialize", c_init, -1);
        rb_define_method (cWindow, "inspect", c_inspect, 0);
        rb_define_method (cWindow, "eql?", c_equal_value, 1);
@@ -530,17 +536,23 @@ void Init_Window (void)
        rb_define_method (cWindow, "border_width=", c_border_width_set, 1);
        rb_define_method (cWindow, "depth", c_depth_get, 0);
        rb_define_method (cWindow, "parent", c_parent_get, 0);
        rb_define_method (cWindow, "border_width=", c_border_width_set, 1);
        rb_define_method (cWindow, "depth", c_depth_get, 0);
        rb_define_method (cWindow, "parent", c_parent_get, 0);
+#if 0
        rb_define_method (cWindow, "title", c_title_get, 0);
        rb_define_method (cWindow, "title=", c_title_set, 1);
        rb_define_method (cWindow, "title", c_title_get, 0);
        rb_define_method (cWindow, "title=", c_title_set, 1);
+#endif
        rb_define_method (cWindow, "set_event_mask", c_set_event_mask, 1);
        rb_define_method (cWindow, "unset_event_mask",
                          c_unset_event_mask, 1);
        rb_define_method (cWindow, "set_event_mask", c_set_event_mask, 1);
        rb_define_method (cWindow, "unset_event_mask",
                          c_unset_event_mask, 1);
+#if 0
        rb_define_method (cWindow, "set_protocol", c_set_protocol, 2);
        rb_define_method (cWindow, "set_protocol", c_set_protocol, 2);
+#endif
        rb_define_method (cWindow, "get_protocol", c_get_protocol, 1);
        rb_define_method (cWindow, "get_protocol", c_get_protocol, 1);
+#if 0
        rb_define_method (cWindow, "sticky?", c_sticky_get, 0);
        rb_define_method (cWindow, "sticky=", c_sticky_set, 1);
        rb_define_method (cWindow, "borderless?", c_borderless_get, 0);
        rb_define_method (cWindow, "borderless=", c_borderless_set, 1);
        rb_define_method (cWindow, "sticky?", c_sticky_get, 0);
        rb_define_method (cWindow, "sticky=", c_sticky_set, 1);
        rb_define_method (cWindow, "borderless?", c_borderless_get, 0);
        rb_define_method (cWindow, "borderless=", c_borderless_set, 1);
+#endif
        rb_define_method (cWindow, "cursor=", c_cursor_set, 1);
        rb_define_method (cWindow, "manage", c_manage, 0);
        rb_define_method (cWindow, "manage_container", c_manage_container, 0);
        rb_define_method (cWindow, "cursor=", c_cursor_set, 1);
        rb_define_method (cWindow, "manage", c_manage, 0);
        rb_define_method (cWindow, "manage_container", c_manage_container, 0);