Don't use global variables for the Ruby classes.
authorTilman Sauerbeck <tilman@code-monkey.de>
Sat, 26 Jun 2004 23:07:01 +0000 (23:07 +0000)
committerTilman Sauerbeck <tilman@code-monkey.de>
Sat, 26 Jun 2004 23:07:01 +0000 (23:07 +0000)
src/ecore/rb_idler.c
src/ecore/rb_timer.c
src/ecore_evas/rb_ecore_evas.c
src/ecore_evas/rb_fb.c
src/ecore_evas/rb_fb.h
src/ecore_evas/rb_gl_x11.c
src/ecore_evas/rb_software_x11.c
src/ecore_job/rb_job.c

index 3bdf31f8723b0e4b885aa0159b68a490ac8f41ca..77c35a30c235f95768af0c73de8a9389c6002f82 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: rb_idler.c 9 2004-06-19 19:53:47Z tilman $
+ * $Id: rb_idler.c 25 2004-06-26 23:07:01Z tilman $
  *
  * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
  *
@@ -31,7 +31,7 @@ typedef struct {
        bool deleted;
 } RbEcoreIdler;
 
-VALUE cIdler;
+static VALUE cIdler;
 
 static int on_idler (void *data)
 {
index 61c72164b1249435e1930ad31fbf1a8c24ea3cc3..c9e93ecab55999db8b6c9e0b3c58d73d10c4dbfd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: rb_timer.c 9 2004-06-19 19:53:47Z tilman $
+ * $Id: rb_timer.c 25 2004-06-26 23:07:01Z tilman $
  *
  * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
  *
@@ -31,7 +31,7 @@ typedef struct {
        bool deleted;
 } RbEcoreTimer;
 
-VALUE cTimer;
+static VALUE cTimer;
 
 static int on_timer (void *data)
 {
index 7edb1685b908f90715b5eb45e2aefeb9e5713c53..18ac0e02d00992bf0d81d9a89171718f6cb71590 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: rb_ecore_evas.c 18 2004-06-22 20:32:57Z tilman $
+ * $Id: rb_ecore_evas.c 25 2004-06-26 23:07:01Z tilman $
  *
  * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
  *
@@ -90,6 +90,42 @@ static VALUE c_visible_get (VALUE self)
        return ecore_evas_visibility_get (*ee) ? Qtrue : Qfalse;
 }
 
+static VALUE c_raise (VALUE self)
+{
+       GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+
+       ecore_evas_raise (*ee);
+
+       return Qnil;
+}
+
+static VALUE c_lower (VALUE self)
+{
+       GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+
+       ecore_evas_lower (*ee);
+
+       return Qnil;
+}
+
+static VALUE c_layer_get (VALUE self)
+{
+       GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+
+       return INT2FIX (ecore_evas_layer_get (*ee));
+}
+
+static VALUE c_layer_set (VALUE self, VALUE val)
+{
+       GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+
+       Check_Type (val, T_FIXNUM);
+
+       ecore_evas_layer_set (*ee, FIX2INT (val));
+
+       return Qnil;
+}
+
 static VALUE c_evas (VALUE self)
 {
        GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
@@ -143,6 +179,18 @@ static VALUE c_set_size_max (VALUE self, VALUE w, VALUE h)
        return Qnil;
 }
 
+static VALUE c_move (VALUE self, VALUE x, VALUE y)
+{
+       GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+
+       Check_Type (x, T_FIXNUM);
+       Check_Type (y, T_FIXNUM);
+
+       ecore_evas_move (*ee, FIX2INT (x), FIX2INT (y));
+
+       return Qnil;
+}
+
 static VALUE c_resize (VALUE self, VALUE w, VALUE h)
 {
        GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
@@ -196,6 +244,60 @@ static VALUE c_borderless_set (VALUE self, VALUE val)
        return Qnil;
 }
 
+static VALUE c_shaped_get (VALUE self)
+{
+       GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+
+       return ecore_evas_shaped_get (*ee) ? Qtrue : Qfalse;
+}
+
+static VALUE c_shaped_set (VALUE self, VALUE val)
+{
+       GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+
+       CHECK_BOOL (val);
+
+       ecore_evas_shaped_set (*ee, val == Qtrue ? 1 : 0);
+
+       return Qnil;
+}
+
+static VALUE c_sticky_get (VALUE self)
+{
+       GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+
+       return ecore_evas_sticky_get (*ee) ? Qtrue : Qfalse;
+}
+
+static VALUE c_sticky_set (VALUE self, VALUE val)
+{
+       GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+
+       CHECK_BOOL (val);
+
+       ecore_evas_sticky_set (*ee, val == Qtrue ? 1 : 0);
+
+       return Qnil;
+}
+
+static VALUE c_rotation_get (VALUE self)
+{
+       GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+
+       return INT2FIX (ecore_evas_rotation_get (*ee));
+}
+
+static VALUE c_rotation_set (VALUE self, VALUE val)
+{
+       GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
+
+       Check_Type (val, T_FIXNUM);
+
+       ecore_evas_rotation_set (*ee, FIX2INT (val));
+
+       return Qnil;
+}
+
 static VALUE c_delete (VALUE self)
 {
        GET_OBJ (self, Ecore_Evas, ee, "EcoreEvas");
@@ -220,14 +322,25 @@ void Init_EcoreEvas (void)
        rb_define_method (cEcoreEvas, "show", c_show, 0);
        rb_define_method (cEcoreEvas, "hide", c_hide, 0);
        rb_define_method (cEcoreEvas, "visible?", c_visible_get, 0);
+       rb_define_method (cEcoreEvas, "raise", c_raise, 0);
+       rb_define_method (cEcoreEvas, "lower", c_lower, 0);
+       rb_define_method (cEcoreEvas, "layer", c_layer_get, 0);
+       rb_define_method (cEcoreEvas, "layer=", c_layer_set, 1);
        rb_define_method (cEcoreEvas, "evas", c_evas, 0);
        rb_define_method (cEcoreEvas, "get_size_min", c_get_size_min, 0);
        rb_define_method (cEcoreEvas, "set_size_min", c_set_size_min, 2);
        rb_define_method (cEcoreEvas, "get_size_max", c_get_size_max, 0);
        rb_define_method (cEcoreEvas, "set_size_max", c_set_size_max, 2);
+       rb_define_method (cEcoreEvas, "move", c_move, 2);
        rb_define_method (cEcoreEvas, "resize", c_resize, 2);
        rb_define_method (cEcoreEvas, "title", c_title_get, 0);
        rb_define_method (cEcoreEvas, "title=", c_title_set, 1);
-       rb_define_method (cEcoreEvas, "borderless", c_borderless_get, 0);
+       rb_define_method (cEcoreEvas, "borderless?", c_borderless_get, 0);
        rb_define_method (cEcoreEvas, "borderless=", c_borderless_set, 1);
+       rb_define_method (cEcoreEvas, "shaped?", c_shaped_get, 0);
+       rb_define_method (cEcoreEvas, "shaped=", c_shaped_set, 1);
+       rb_define_method (cEcoreEvas, "sticky?", c_sticky_get, 0);
+       rb_define_method (cEcoreEvas, "sticky=", c_sticky_set, 1);
+       rb_define_method (cEcoreEvas, "rotation", c_rotation_get, 0);
+       rb_define_method (cEcoreEvas, "rotation=", c_rotation_set, 1);
 }
index 86b12c24a3bedcd804ea1da6f599b0a438ed10c2..00635defd22d1f6071db46ddd317e814db4a0884 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id$
+ * $Id: rb_fb.c 25 2004-06-26 23:07:01Z tilman $
  *
  * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
  *
@@ -25,8 +25,6 @@
 #include "rb_ecore_evas_main.h"
 #include "rb_ecore_evas.h"
 
-VALUE cFb;
-
 static VALUE c_init (int argc, VALUE *argv, VALUE self)
 {
        VALUE disp, rot, w, h;
@@ -78,7 +76,7 @@ static VALUE c_new (int argc, VALUE *argv, VALUE klass)
 
 void Init_Fb (void)
 {
-       cFb = rb_define_class_under (mEvas, "Fb", cEcoreEvas);
+       VALUE cFb = rb_define_class_under (mEvas, "Fb", cEcoreEvas);
 
        rb_define_singleton_method (cFb, "new", c_new, -1);
        rb_define_method (cFb, "initialize", c_init, -1);
index ffdffbed3b5b3389914245a198a5dee71d00330e..4e11bbd9db706a3887647762e56fd09ad820531e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id$
+ * $Id: rb_fb.h 25 2004-06-26 23:07:01Z tilman $
  *
  * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
  *
index 134da28bc58eb16bfcf53afd03bf802e497a3f29..061517afb8df7e704dfbc84753f27d0f1e780299 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: rb_gl_x11.c 15 2004-06-20 13:23:07Z tilman $
+ * $Id: rb_gl_x11.c 25 2004-06-26 23:07:01Z tilman $
  *
  * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
  *
 #include "rb_ecore_evas_main.h"
 #include "rb_ecore_evas.h"
 
-VALUE cGlX11;
-
 static VALUE c_init (int argc, VALUE *argv, VALUE self)
 {
        VALUE disp, parent, geom[4];
        Ecore_Evas **ee = NULL;
        char *cdisp = NULL;
-       int i, igeom[4] = {0};
+       int i, igeom[4] = {0, 0, 0, 0};
 
        Data_Get_Struct (self, Ecore_Evas *, ee);
 
@@ -72,7 +70,7 @@ static VALUE c_new (int argc, VALUE *argv, VALUE klass)
 
 void Init_GlX11 (void)
 {
-       cGlX11 = rb_define_class_under (mEvas, "GlX11", cEcoreEvas);
+       VALUE cGlX11 = rb_define_class_under (mEvas, "GlX11", cEcoreEvas);
 
        rb_define_singleton_method (cGlX11, "new", c_new, -1);
        rb_define_method (cGlX11, "initialize", c_init, -1);
index eae769ff56fb6e56a09ac1be835d22f75531ba3c..04f70b05ebcc9c85950b138315a25890e565701a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: rb_software_x11.c 15 2004-06-20 13:23:07Z tilman $
+ * $Id: rb_software_x11.c 25 2004-06-26 23:07:01Z tilman $
  *
  * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
  *
 #include "rb_ecore_evas_main.h"
 #include "rb_ecore_evas.h"
 
-VALUE cSoftwareX11;
-
 static VALUE c_init (int argc, VALUE *argv, VALUE self)
 {
        VALUE disp, parent, geom[4];
        Ecore_Evas **ee = NULL;
        char *cdisp = NULL;
-       int i, igeom[4] = {0};
+       int i, igeom[4] = {0, 0, 0, 0};
 
        Data_Get_Struct (self, Ecore_Evas *, ee);
 
@@ -72,9 +70,9 @@ static VALUE c_new (int argc, VALUE *argv, VALUE klass)
 
 void Init_SoftwareX11 (void)
 {
-       cSoftwareX11 = rb_define_class_under (mEvas,
-                                             "SoftwareX11",
-                                             cEcoreEvas);
+       VALUE cSoftwareX11 = rb_define_class_under (mEvas,
+                                                   "SoftwareX11",
+                                                   cEcoreEvas);
 
        rb_define_singleton_method (cSoftwareX11, "new", c_new, -1);
        rb_define_method (cSoftwareX11, "initialize", c_init, -1);
index 4d45b1a781ab5cbc18c398429ead76de5237f85e..255c1d6527ff7939f2607e00ad8b5209469ea356 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: rb_job.c 9 2004-06-19 19:53:47Z tilman $
+ * $Id: rb_job.c 25 2004-06-26 23:07:01Z tilman $
  *
  * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
  *
@@ -31,7 +31,7 @@ typedef struct {
        bool deleted;
 } RbEcoreJob;
 
-VALUE cEcoreJob;
+static VALUE cJob;
 
 static void on_job (void *data)
 {
@@ -92,10 +92,10 @@ static VALUE c_delete (VALUE self)
 
 void Init_Job (void)
 {
-       cEcoreJob = rb_define_class_under (mJob, "Job", rb_cObject);
+       cJob = rb_define_class_under (mJob, "Job", rb_cObject);
 
-       rb_define_singleton_method (cEcoreJob, "new", c_new, 0);
-       rb_define_method (cEcoreJob, "initialize", c_init, 0);
-       rb_define_method (cEcoreJob, "delete", c_delete, 0);
+       rb_define_singleton_method (cJob, "new", c_new, 0);
+       rb_define_method (cJob, "initialize", c_init, 0);
+       rb_define_method (cJob, "delete", c_delete, 0);
 }