X-Git-Url: http://git.code-monkey.de/?p=ruby-ecore.git;a=blobdiff_plain;f=src%2Fecore_x%2Frb_window.c;h=e046b6f37f67d1bc81ba511cea111a5beb6910f1;hp=2d7e3c0d7b4f666218a8329c669ae22cccfc7b91;hb=f805cf241a9d1fb9765892f0af48ede8359e9b65;hpb=4f5c88b4cfae4d5fb177710b09624f2e229d6a1b diff --git a/src/ecore_x/rb_window.c b/src/ecore_x/rb_window.c index 2d7e3c0..e046b6f 100644 --- a/src/ecore_x/rb_window.c +++ b/src/ecore_x/rb_window.c @@ -1,5 +1,5 @@ /* - * $Id: rb_window.c 39 2004-07-25 13:13:57Z tilman $ + * $Id: rb_window.c 50 2004-08-01 10:18:39Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -23,39 +23,31 @@ #include #include +#define __RB_WINDOW_C +#include "../ecore/rb_ecore.h" #include "rb_ecore_x.h" +#include "rb_window.h" -static VALUE cWindow, parents; +VALUE cWindow; -static void c_mark (Ecore_X_Window *w) +static void c_mark (RbWindow *w) { - VALUE parent; - - parent = rb_hash_aref (parents, INT2NUM ((long) (w))); - if (parent != Qnil) - rb_gc_mark (parent); -} - -static void c_free (Ecore_X_Window *w) -{ - rb_hash_aset (parents, INT2NUM ((long) w), Qnil); - - free (w); + if (!NIL_P (w->parent)) + rb_gc_mark (w->parent); } VALUE TO_ECORE_X_WINDOW (VALUE parent, Ecore_X_Window w) { VALUE self; - Ecore_X_Window *my_w = NULL; + RbWindow *window = NULL; - if (NIL_P (parent) || !w) + if (!w) return Qnil; - self = Data_Make_Struct (cWindow, Ecore_X_Window, - c_mark, c_free, my_w); - *my_w = w; + self = Data_Make_Struct (cWindow, RbWindow, c_mark, free, window); - rb_hash_aset (parents, INT2NUM ((long) my_w), parent); + window->real = w; + window->parent = parent; rb_obj_call_init (self, 0, NULL); @@ -69,7 +61,4 @@ void Init_Window (void) /* not publically instantiable yet */ rb_define_private_method (rb_singleton_class (cWindow), "new", NULL, 0); - - parents = rb_hash_new (); - rb_global_variable (&parents); }