Nathan Ingersoll wrote:
Well that's a pain. I think the callback registration may need to be
moved to the ewl_window to avoid that situation. The idea is that the
FB event handlers are used when an EWL application has control of the
FB, and the evas object events are for when the EWL object is placed
on a pre-existing evas. If you want to fix this, I would split out the
ecore event handlers additions into a separate function that is called
by the window realize callback that sets a flag so it will only add
the event handlers once. If you don't have time I should be able to
fix this tonight.


No need to split it out, as that is all that ewl_ev_init() does. See what you think of the attached patch (against today's CVS).

I wasn't sure whether the handlers should be unregistered when the last window gets 'unrealized'. I haven't done this, as ewl_shutdown() doesn't bother.

--
Simon Poole
www.appliancestudio.com
diff -urN ewl-20050531.orig/src/lib/ewl_misc.c ewl-20050531/src/lib/ewl_misc.c
--- ewl-20050531.orig/src/lib/ewl_misc.c        2005-05-27 05:48:12.000000000 
+0100
+++ ewl-20050531/src/lib/ewl_misc.c     2005-05-31 15:47:57.763391392 +0100
@@ -159,12 +159,6 @@
                ewl_config.debug.level = debug_level;
        }
 
-       if (!ewl_ev_init()) {
-               DERROR("Could not init event data.\n");
-               ewl_shutdown();
-               DRETURN_INT(_ewl_init_count, DLEVEL_STABLE);
-       }
-
        ewl_callbacks_init();
 
        if (!ewl_theme_init()) {
diff -urN ewl-20050531.orig/src/lib/ewl_window.c 
ewl-20050531/src/lib/ewl_window.c
--- ewl-20050531.orig/src/lib/ewl_window.c      2005-04-25 21:06:36.000000000 
+0100
+++ ewl-20050531/src/lib/ewl_window.c   2005-05-31 15:47:58.487281344 +0100
@@ -24,6 +24,7 @@
 #endif
 
 Ecore_List *ewl_window_list = NULL;
+static int _ewl_window_realize_count = 0;
 
 /**
  * @return Returns a new window on success, or NULL on failure.
@@ -428,6 +429,12 @@
        DENTER_FUNCTION(DLEVEL_STABLE);
        DCHECK_PARAM_PTR("w", w);
 
+       if (++_ewl_window_realize_count == 1) {
+               if (!ewl_ev_init()) {
+                       DERROR("Could not init event data.\n");
+               }
+       }
+
        embed = EWL_EMBED(w);
        window = EWL_WINDOW(w);
        o = EWL_OBJECT(w);

Reply via email to