--- /dev/null
+## $Id$
+
+SUBDIRS = src
--- /dev/null
+#! /bin/sh
+# Run this to generate all the initial makefiles, etc.
+
+# Stolen from the GNU Midnight Commander. Customized for giFTcurs. Stolen from
+# giFTcurs. Customized for giFT. Stolen from giFT.
+# Customized for $this_project.
+
+# Make it possible to specify path in the environment
+: ${AUTOCONF=autoconf}
+: ${AUTOHEADER=autoheader}
+: ${AUTOMAKE=automake}
+: ${ACLOCAL=aclocal}
+: ${LIBTOOLIZE=libtoolize}
+
+srcdir=`dirname $0`
+test -z "$srcdir" && srcdir=.
+
+(
+cd $srcdir
+
+# The autoconf cache (version after 2.52) is not reliable yet.
+rm -rf autom4te.cache
+
+rm -f aclocal.m4
+ACLOCAL_INCLUDES="-I m4"
+
+# Some old version of GNU build tools fail to set error codes.
+# Check that they generate some of the files they should.
+
+echo "Running $ACLOCAL..."
+$ACLOCAL $ACLOCAL_INCLUDES $ACLOCAL_FLAGS || exit 1
+test -f aclocal.m4 || \
+ { echo "aclocal failed to generate aclocal.m4" 2>&1; exit 1; }
+
+echo "Running $AUTOHEADER..."
+$AUTOHEADER || exit 1
+test -f config.h.in || \
+ { echo "autoheader failed to generate config.h.in" 2>&1; exit 1; }
+
+echo "Running $AUTOCONF..."
+$AUTOCONF || exit 1
+test -f configure || \
+ { echo "autoconf failed to generate configure" 2>&1; exit 1; }
+
+# hack hack hack...i hate autotools.
+echo "Running $LIBTOOLIZE --automake..."
+$LIBTOOLIZE --automake || exit 1
+test -f ltmain.sh || \
+ { echo "libtoolize failed to generate ltmain.sh" 2>&1; exit 1; }
+
+# Workaround for Automake 1.5 to ensure that depcomp is distributed.
+echo "Running $AUTOMAKE..."
+$AUTOMAKE -c -a src/Makefile || exit 1
+$AUTOMAKE -c -a || exit 1
+test -f Makefile.in || \
+ { echo "automake failed to generate Makefile.in" 2>&1; exit 1; }
+
+) || exit 1
+
+echo
+echo "Type './configure' to configure ruby-ecore."
+echo
--- /dev/null
+dnl $Id$
+
+AC_INIT(ruby-ecore, 0.0.1)
+AC_CONFIG_SRCDIR([src/ecore/rb_ecore.c])
+
+AM_INIT_AUTOMAKE([dist-bzip2])
+AM_CONFIG_HEADER(config.h)
+
+AC_PROG_CC
+AC_PROG_CC_STDC
+AC_PROG_INSTALL
+AC_CHECK_PROG(RUBY, ruby)
+
+AM_DISABLE_STATIC
+AC_PROG_LIBTOOL
+
+AC_HEADER_STDC
+AC_HEADER_STDBOOL
+
+AC_RUBY_EXT
+
+AC_PATH_GENERIC(ecore, , ,
+ AC_MSG_ERROR(Cannot find ecore: Is ecore-config in path?))
+
+AC_PATH_GENERIC(evas, , ,
+ AC_MSG_ERROR(Cannot find evas: Is evas-config in path?))
+
+AC_CONFIG_FILES([
+Makefile
+src/Makefile
+src/ecore/Makefile
+src/ecore_job/Makefile
+src/ecore_evas/Makefile
+])
+
+AC_OUTPUT
+
--- /dev/null
+## $Id$
+
+EXTRA_DIST = ac_path_generic.m4 ac_ruby.m4
--- /dev/null
+## $Id$
+
+SUBDIRS = ecore ecore_job ecore_evas
--- /dev/null
+## $Id$
+
+AM_CFLAGS = $(ECORE_CFLAGS)
+INCLUDES = -I$(RUBYDIR)
+
+ext_LTLIBRARIES = ecore.la
+extdir = $(RUBYSITEDIR)
+
+ecore_la_SOURCES = rb_ecore.c rb_ecore.h \
+ rb_idler.c rb_idler.h \
+ rb_timer.c rb_timer.h
+
+ecore_la_LIBADD = -lruby $(ECORE_LIBS)
+ecore_la_LDFLAGS = -module -avoid-version
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <ruby.h>
+
+#include <Ecore.h>
+
+#include "rb_ecore.h"
+#include "rb_timer.h"
+#include "rb_idler.h"
+
+static VALUE m_init (VALUE self)
+{
+ return INT2FIX (ecore_init ());
+}
+
+static VALUE m_main_loop_begin (VALUE self)
+{
+ ecore_main_loop_begin ();
+
+ return Qnil;
+}
+
+static VALUE m_main_loop_iterate (VALUE self)
+{
+ ecore_main_loop_iterate ();
+
+ return Qnil;
+}
+
+static VALUE m_main_loop_quit (VALUE self)
+{
+ ecore_main_loop_quit ();
+
+ return Qnil;
+}
+
+static VALUE m_shutdown (VALUE self)
+{
+ rb_gc_start ();
+
+ return INT2FIX (ecore_shutdown ());
+}
+
+void Init_ecore (void)
+{
+ mEcore = rb_define_module ("Ecore");
+
+ rb_define_module_function (mEcore, "init",
+ m_init, 0);
+ rb_define_module_function (mEcore, "main_loop_begin",
+ m_main_loop_begin, 0);
+ rb_define_module_function (mEcore, "main_loop_iterate",
+ m_main_loop_iterate, 0);
+ rb_define_module_function (mEcore, "main_loop_quit",
+ m_main_loop_quit, 0);
+ rb_define_module_function (mEcore, "shutdown",
+ m_shutdown, 0);
+
+ Init_Timer ();
+ Init_Idler ();
+}
+
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __RB_ECORE_H
+#define __RB_ECORE_H
+
+VALUE mEcore;
+
+#endif
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <ruby.h>
+
+#include <Ecore.h>
+#include <stdbool.h>
+
+#include "rb_ecore.h"
+
+typedef struct {
+ Ecore_Idler *idler;
+ void *cb;
+ bool deleted;
+} RbEcoreIdler;
+
+VALUE cIdler;
+
+static int on_idler (void *data)
+{
+ VALUE r;
+ RbEcoreIdler *idler = data;
+
+ r = rb_funcall ((VALUE) idler->cb, rb_intern ("call"), 0);
+
+ /* if the callback returns false, we return 0 and Ecore
+ * will remove the idler
+ */
+ if (r == Qfalse)
+ idler->deleted = true;
+
+ return (r != Qfalse);
+}
+
+static VALUE c_init (VALUE self)
+{
+ RbEcoreIdler *idler = NULL;
+
+ Data_Get_Struct (self, RbEcoreIdler, idler);
+
+ idler->cb = (void *) rb_block_proc ();
+ idler->idler = ecore_idler_add (on_idler, idler);
+
+ return self;
+}
+
+static void c_free (RbEcoreIdler *idler)
+{
+ if (idler->idler && !idler->deleted)
+ ecore_idler_del (idler->idler);
+
+ free (idler);
+}
+
+static VALUE c_new (VALUE klass)
+{
+ VALUE self;
+ RbEcoreIdler *idler;
+
+ self = Data_Make_Struct (klass, RbEcoreIdler, NULL, c_free, idler);
+
+ rb_obj_call_init (self, 0, NULL);
+
+ return self;
+}
+
+static VALUE c_delete (VALUE self)
+{
+ RbEcoreIdler *idler = NULL;
+
+ Data_Get_Struct (self, RbEcoreIdler, idler);
+
+ if (idler->idler && !idler->deleted) {
+ ecore_idler_del (idler->idler);
+ idler->idler = NULL;
+ idler->deleted = true;
+ } else
+ rb_raise (rb_eException, "Idler already deleted!");
+
+ return Qnil;
+}
+
+void Init_Idler (void)
+{
+ cIdler = rb_define_class_under (mEcore, "Idler", rb_cObject);
+
+ rb_define_singleton_method (cIdler, "new", c_new, 1);
+ rb_define_method (cIdler, "initialize", c_init, 1);
+ rb_define_method (cIdler, "delete", c_delete, 0);
+}
+
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __RB_IDLER_H
+#define __RB_IDLER_H
+
+void Init_Idler (void);
+
+#endif
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <ruby.h>
+
+#include <Ecore.h>
+#include <stdbool.h>
+
+#include "rb_ecore.h"
+
+typedef struct {
+ Ecore_Timer *timer;
+ void *cb;
+ bool deleted;
+} RbEcoreTimer;
+
+VALUE cTimer;
+
+static int on_timer (void *data)
+{
+ VALUE r;
+ RbEcoreTimer *timer = data;
+
+ r = rb_funcall ((VALUE) timer->cb, rb_intern ("call"), 0);
+
+ /* if the callback returns false, we return 0 and Ecore
+ * will remove the timer
+ */
+ if (r == Qfalse)
+ timer->deleted = true;
+
+ return (r != Qfalse);
+}
+
+static VALUE c_init (VALUE self, VALUE interval)
+{
+ RbEcoreTimer *timer = NULL;
+
+ Data_Get_Struct (self, RbEcoreTimer, timer);
+
+ timer->cb = (void *) rb_block_proc ();
+ timer->timer = ecore_timer_add (NUM2DBL (interval),
+ on_timer, timer);
+
+ return self;
+}
+
+static void c_free (RbEcoreTimer *timer)
+{
+ if (timer->timer && !timer->deleted)
+ ecore_timer_del (timer->timer);
+
+ free (timer);
+}
+
+static VALUE c_new (VALUE klass, VALUE interval)
+{
+ VALUE self, argv[1];
+ RbEcoreTimer *timer;
+
+ self = Data_Make_Struct (klass, RbEcoreTimer, NULL, c_free, timer);
+
+ argv[0] = interval;
+ rb_obj_call_init (self, 1, argv);
+
+ return self;
+}
+
+static VALUE c_delete (VALUE self)
+{
+ RbEcoreTimer *timer = NULL;
+
+ Data_Get_Struct (self, RbEcoreTimer, timer);
+
+ if (timer->timer && !timer->deleted) {
+ ecore_timer_del (timer->timer);
+ timer->timer = NULL;
+ timer->deleted = true;
+ } else
+ rb_raise (rb_eException, "Timer already deleted!");
+
+ return Qnil;
+}
+
+void Init_Timer (void)
+{
+ cTimer = rb_define_class_under (mEcore, "Timer", rb_cObject);
+
+ rb_define_singleton_method (cTimer, "new", c_new, 1);
+ rb_define_method (cTimer, "initialize", c_init, 1);
+ rb_define_method (cTimer, "delete", c_delete, 0);
+}
+
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __RB_TIMER_H
+#define __RB_TIMER_H
+
+void Init_Timer (void);
+
+#endif
--- /dev/null
+## $Id$
+
+AM_CFLAGS = $(ECORE_CFLAGS)
+INCLUDES = -I$(RUBYDIR) -I$(RUBYSITEDIR)
+
+ext_LTLIBRARIES = ecore_evas.la
+extdir = $(RUBYSITEDIR)
+
+ecore_evas_la_SOURCES = rb_ecore_evas_main.c rb_ecore_evas_main.h \
+ rb_ecore_evas.c rb_ecore_evas.h \
+ rb_software_x11.c rb_software_x11.h \
+ rb_gl_x11.c rb_gl_x11.h
+
+ecore_evas_la_LIBADD = -lruby $(ECORE_LIBS)
+ecore_evas_la_LDFLAGS = -module -avoid-version
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <ruby.h>
+
+#include <Ecore_Evas.h>
+#include <rb_evas.h>
+
+#include "rb_ecore_evas_main.h"
+#include "rb_ecore_evas.h"
+
+#define GET_OBJ(obj, ee) \
+ Ecore_Evas **(ee) = NULL; \
+\
+ Data_Get_Struct ((obj), Ecore_Evas *, (ee)); \
+\
+ if (!*(ee)) { \
+ rb_raise (rb_eException, "EcoreEvas destroyed already"); \
+ return Qnil; \
+ }
+
+/* called by the child classes */
+void c_ecore_evas_free (Ecore_Evas **ee)
+{
+ if (*ee)
+ ecore_evas_free (*ee);
+
+ free (ee);
+}
+
+#if 0
+static VALUE c_init (int argc, VALUE argv, VALUE self)
+{
+ rb_iv_set (self, "@title", rb_str_new2 (""));
+ rb_iv_set (self, "@name", rb_str_new2 (""));
+ rb_iv_set (self, "@class", rb_str_new2 (""));
+ rb_iv_set (self, "@name", rb_str_new2 (""));
+
+ return self;
+}
+#endif
+
+static VALUE c_show (VALUE self)
+{
+ GET_OBJ (self, ee);
+
+ ecore_evas_show (*ee);
+
+ return Qnil;
+}
+
+static VALUE c_hide (VALUE self)
+{
+ GET_OBJ (self, ee);
+
+ ecore_evas_hide (*ee);
+
+ return Qnil;
+}
+
+static VALUE c_is_visible (VALUE self)
+{
+ GET_OBJ (self, ee);
+
+ return ecore_evas_visibility_get (*ee) ? Qtrue : Qfalse;
+}
+
+static VALUE c_evas (VALUE self)
+{
+ GET_OBJ (self, ee);
+
+ return TO_EVAS (self, ecore_evas_get (*ee));
+}
+
+static VALUE c_resize (VALUE self, VALUE w, VALUE h)
+{
+ GET_OBJ (self, ee);
+
+ Check_Type (w, T_FIXNUM);
+ Check_Type (h, T_FIXNUM);
+
+ ecore_evas_resize (*ee, FIX2INT (w), FIX2INT (h));
+
+ return Qnil;
+}
+
+static VALUE c_title_get (VALUE self)
+{
+ const char *tmp;
+
+ GET_OBJ (self, ee);
+
+ if (!(tmp = ecore_evas_title_get (*ee)))
+ return Qnil;
+ else
+ return rb_str_new2 (tmp);
+}
+
+static VALUE c_title_set (VALUE self, VALUE val)
+{
+ GET_OBJ (self, ee);
+
+ Check_Type (val, T_STRING);
+
+ ecore_evas_title_set (*ee, STR2CSTR (val));
+
+ return Qnil;
+}
+
+static VALUE c_borderless_get (VALUE self)
+{
+ GET_OBJ (self, ee);
+
+ return ecore_evas_borderless_get (*ee) ? Qtrue : Qfalse;
+}
+
+static VALUE c_borderless_set (VALUE self, VALUE val)
+{
+ GET_OBJ (self, ee);
+
+ /* make sure we're passed a boolean */
+ if (TYPE (val) != T_TRUE && TYPE (val) != T_FALSE) {
+ rb_raise (rb_eTypeError,
+ "wrong argument type %s (expected true or false)",
+ rb_obj_classname (val));
+ return Qnil;
+ }
+
+ ecore_evas_borderless_set (*ee, val == Qtrue ? 1 : 0);
+
+ return Qnil;
+}
+
+static VALUE c_delete (VALUE self)
+{
+ GET_OBJ (self, ee);
+
+ /* reap our children */
+ rb_gc_start ();
+
+ ecore_evas_free (*ee);
+ *ee = NULL;
+
+ return Qnil;
+}
+
+void Init_EcoreEvas (void)
+{
+ cEcoreEvas = rb_define_class_under (mEvas, "EcoreEvas", rb_cObject);
+
+ rb_define_private_method (rb_singleton_class (cEcoreEvas),
+ "new", NULL, 0);
+ /*rb_define_method (cEcoreEvas, "initialize", c_init, -1);*/
+ rb_define_method (cEcoreEvas, "delete", c_delete, 0);
+ rb_define_method (cEcoreEvas, "show", c_show, 0);
+ rb_define_method (cEcoreEvas, "hide", c_hide, 0);
+ rb_define_method (cEcoreEvas, "visible?", c_is_visible, 0);
+ rb_define_method (cEcoreEvas, "evas", c_evas, 0);
+ 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_set, 1);
+}
+
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __RB_ECORE_EVAS_H
+#define __RB_ECORE_EVAS_H
+
+VALUE cEcoreEvas;
+
+void Init_EcoreEvas (void);
+
+void c_ecore_evas_free (Ecore_Evas **ee);
+
+#endif
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <ruby.h>
+
+#include <Ecore_Evas.h>
+
+#include "../ecore/rb_ecore.h"
+#include "rb_ecore_evas_main.h"
+#include "rb_ecore_evas.h"
+#include "rb_software_x11.h"
+
+static VALUE m_init (VALUE self)
+{
+ return INT2FIX (ecore_evas_init ());
+}
+
+static VALUE m_shutdown (VALUE self)
+{
+ return INT2FIX (ecore_evas_shutdown ());
+}
+
+void Init_ecore_evas (void)
+{
+ rb_require ("ecore");
+ rb_require ("evas");
+
+ mEvas = rb_define_module_under (mEcore, "Evas");
+
+ rb_define_module_function (mEvas, "init", m_init, 0);
+ rb_define_module_function (mEvas, "shutdown", m_shutdown, 0);
+
+ Init_EcoreEvas ();
+ Init_SoftwareX11 ();
+ Init_GlX11 ();
+ /*Init_FrameBuffer ();*/
+}
+
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __RB_ECORE_EVAS_MAIN_H
+#define __RB_ECORE_EVAS_MAIN_H
+
+VALUE mEvas;
+
+#endif
+
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <ruby.h>
+
+#include <Ecore_Evas.h>
+
+#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};
+
+ Data_Get_Struct (self, Ecore_Evas *, ee);
+
+ rb_scan_args (argc, argv, "06", &disp, &parent,
+ &geom[0], &geom[1], &geom[2], &geom[3]);
+
+ if (!NIL_P (disp)) {
+ Check_Type (disp, T_STRING);
+ cdisp = STR2CSTR (disp);
+ }
+
+ for (i = 0; i < 4; i++)
+ if (!NIL_P (geom[i])) {
+ Check_Type (geom[i], T_FIXNUM);
+ igeom[i] = NUM2INT (geom[i]);
+ }
+
+ *ee = ecore_evas_software_x11_new (cdisp, 0,
+ igeom[0], igeom[1],
+ igeom[2], igeom[3]);
+
+ return self;
+}
+
+static VALUE c_new (int argc, VALUE *argv, VALUE klass)
+{
+ VALUE self;
+ Ecore_Evas **ee;
+
+ self = Data_Make_Struct (klass, Ecore_Evas *,
+ NULL, c_ecore_evas_free, ee);
+
+ rb_obj_call_init (self, argc, argv);
+
+ return self;
+}
+
+void Init_SoftwareX11 (void)
+{
+ 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);
+}
+
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __RB_SOFTWARE_X11_H
+#define __RB_SOFTWARE_X11_H
+
+void Init_SoftwareX11 (void);
+
+#endif
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <ruby.h>
+
+#include <Ecore_Evas.h>
+
+#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};
+
+ Data_Get_Struct (self, Ecore_Evas *, ee);
+
+ rb_scan_args (argc, argv, "06", &disp, &parent,
+ &geom[0], &geom[1], &geom[2], &geom[3]);
+
+ if (!NIL_P (disp)) {
+ Check_Type (disp, T_STRING);
+ cdisp = STR2CSTR (disp);
+ }
+
+ for (i = 0; i < 4; i++)
+ if (!NIL_P (geom[i])) {
+ Check_Type (geom[i], T_FIXNUM);
+ igeom[i] = NUM2INT (geom[i]);
+ }
+
+ *ee = ecore_evas_gl_x11_new (cdisp, 0,
+ igeom[0], igeom[1],
+ igeom[2], igeom[3]);
+
+ return self;
+}
+
+static VALUE c_new (int argc, VALUE *argv, VALUE klass)
+{
+ VALUE self;
+ Ecore_Evas **ee;
+
+ self = Data_Make_Struct (klass, Ecore_Evas *,
+ NULL, c_ecore_evas_free, ee);
+
+ rb_obj_call_init (self, argc, argv);
+
+ return self;
+}
+
+void Init_GlX11 (void)
+{
+ 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);
+}
+
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __RB_GL_X11_H
+#define __RB_GL_X11_H
+
+void Init_GlX11 (void);
+
+#endif
--- /dev/null
+## $Id$
+
+AM_CFLAGS = $(ECORE_CFLAGS)
+INCLUDES = -I$(RUBYDIR)
+
+ext_LTLIBRARIES = ecore_job.la
+extdir = $(RUBYSITEDIR)
+
+ecore_job_la_SOURCES = rb_ecore_job.c rb_ecore_job.h \
+ rb_job.c rb_job.h
+
+ecore_job_la_LIBADD = -lruby $(ECORE_LIBS)
+ecore_job_la_LDFLAGS = -module -avoid-version
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <ruby.h>
+
+#include "../ecore/rb_ecore.h"
+#include "rb_ecore_job.h"
+#include "rb_job.h"
+
+void Init_ecore_job (void)
+{
+ rb_require ("ecore");
+
+ mJob = rb_define_module_under (mEcore, "Job");
+
+ Init_Job ();
+}
+
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __RB_ECORE_JOB_H
+#define __RB_ECORE_JOB_H
+
+VALUE mJob;
+
+#endif
+
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#include <ruby.h>
+
+#include <Ecore_Job.h>
+#include <stdbool.h>
+
+#include "rb_ecore_job.h"
+
+typedef struct {
+ Ecore_Job *job;
+ void *cb;
+ bool deleted;
+} RbEcoreJob;
+
+VALUE cEcoreJob;
+
+static void on_job (void *data)
+{
+ RbEcoreJob *job = data;
+
+ rb_funcall ((VALUE) job->cb, rb_intern ("call"), 0);
+ job->deleted = true;
+}
+
+static VALUE c_init (VALUE self)
+{
+ RbEcoreJob *job = NULL;
+
+ Data_Get_Struct (self, RbEcoreJob, job);
+
+ job->cb = (void *) rb_block_proc ();
+ job->job = ecore_job_add (on_job, job);
+
+ return self;
+}
+
+static void c_free (RbEcoreJob *job)
+{
+ if (job->job && !job->deleted)
+ ecore_job_del (job->job);
+
+ free (job);
+}
+
+static VALUE c_new (VALUE klass)
+{
+ VALUE self;
+ RbEcoreJob *job;
+
+ self = Data_Make_Struct (klass, RbEcoreJob, NULL, c_free, job);
+
+ rb_obj_call_init (self, 0, NULL);
+
+ return self;
+}
+
+static VALUE c_delete (VALUE self)
+{
+ VALUE ret = Qfalse;
+ RbEcoreJob *job = NULL;
+
+ Data_Get_Struct (self, RbEcoreJob, job);
+
+ if (job->job && !job->deleted) {
+ ecore_job_del (job->job);
+ job->deleted = true;
+ job->job = NULL;
+ ret = Qtrue;
+ }
+
+ return ret;
+}
+
+void Init_Job (void)
+{
+ cEcoreJob = 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);
+}
+
--- /dev/null
+/*
+ * $Id$
+ *
+ * Copyright (C) 2004 Tilman Sauerbeck (tilman at code-monkey de)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef __RB_JOB_H
+#define __RB_JOB_H
+
+void Init_Job (void);
+
+#endif