X-Git-Url: http://git.code-monkey.de/?a=blobdiff_plain;f=src%2Fecore_evas%2Frb_software_x11.c;h=055c17e1a357a6c55f0c95de89784e33675a7295;hb=4f5c88b4cfae4d5fb177710b09624f2e229d6a1b;hp=d61c66fd95f5b916d160cc48e592a7a30f3745ce;hpb=98ce45a70b8b219b738bb804297417aae0ae9baa;p=ruby-ecore.git diff --git a/src/ecore_evas/rb_software_x11.c b/src/ecore_evas/rb_software_x11.c index d61c66f..055c17e 100644 --- a/src/ecore_evas/rb_software_x11.c +++ b/src/ecore_evas/rb_software_x11.c @@ -1,5 +1,5 @@ /* - * $Id: rb_software_x11.c 27 2004-07-08 18:25:05Z tilman $ + * $Id: rb_software_x11.c 40 2004-07-25 13:14:34Z tilman $ * * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de) * @@ -23,9 +23,13 @@ #include #include +#include "../ecore/rb_ecore.h" +#include "../ecore_x/rb_window.h" #include "rb_ecore_evas_main.h" #include "rb_ecore_evas.h" +static VALUE windows; + static VALUE c_new (int argc, VALUE *argv, VALUE klass) { VALUE self, disp, parent, geom[4]; @@ -62,11 +66,33 @@ static VALUE c_new (int argc, VALUE *argv, VALUE klass) return self; } +static VALUE c_window_get (VALUE self) +{ + VALUE o; + Ecore_X_Window w; + + GET_OBJ (self, Ecore_Evas *, ee); + + if (NIL_P (o = rb_hash_aref (windows, INT2NUM ((long) (ee))))) { + w = ecore_evas_software_x11_window_get (*ee); + o = TO_ECORE_X_WINDOW (self, w); + rb_hash_aset (windows, INT2NUM ((long) ee), o); + } + + return o; +} + void Init_SoftwareX11 (void) { - VALUE cSoftwareX11 = rb_define_class_under (mEvas, - "SoftwareX11", - cEcoreEvas); + VALUE c; + + rb_require ("ecore_x"); + + c = rb_define_class_under (mEvas, "SoftwareX11", cEcoreEvas); + + rb_define_singleton_method (c, "new", c_new, -1); + rb_define_method (c, "window", c_window_get, 0); - rb_define_singleton_method (cSoftwareX11, "new", c_new, -1); + windows = rb_hash_new (); + rb_global_variable (&windows); }