fix mouse down grab coutns if window minimized or hidden (especially
authorraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 27 Dec 2011 12:02:18 +0000 (12:02 +0000)
committerraster <raster@7cbeb6ba-43b4-40fd-8cce-4c39aea84d33>
Tue, 27 Dec 2011 12:02:18 +0000 (12:02 +0000)
the second).

git-svn-id: http://svn.enlightenment.org/svn/e/trunk/ecore@66568 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33

ChangeLog
src/lib/ecore_evas/ecore_evas_private.h
src/lib/ecore_evas/ecore_evas_x.c

index 6edd373..1580dfe 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
 
         * Add Ecore_Wayland (backend to support Wayland).
         * Add Shm and Egl engines for ecore_evas to draw in Wayland.
+
+2011-12-27 Carsten Haitzler (The Rasterman)
+
+        * Fix mouse down grab counts going bad by missing events.
+
index e3f8681..c6770e8 100644 (file)
@@ -300,6 +300,7 @@ struct _Ecore_Evas
    Eina_Bool   should_be_visible : 1;
    Eina_Bool   alpha  : 1;
    Eina_Bool   transparent  : 1;
+   Eina_Bool   in  : 1;
 
    Eina_Hash  *data;
 
index 04e06b7..94983a4 100644 (file)
@@ -740,10 +740,14 @@ _ecore_evas_x_event_mouse_in(void *data __UNUSED__, int type __UNUSED__, void *e
    //       (e->mode == ECORE_X_EVENT_MODE_UNGRAB))
    //     return 0;
    /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */
-   if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
-   ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
-   evas_event_feed_mouse_in(ee->evas, e->time, NULL);
-   _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
+   if (!ee->in)
+     {
+        if (ee->func.fn_mouse_in) ee->func.fn_mouse_in(ee);
+        ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
+        evas_event_feed_mouse_in(ee->evas, e->time, NULL);
+        _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
+        ee->in = EINA_TRUE;
+     }
    return ECORE_CALLBACK_PASS_ON;
 }
 
@@ -792,13 +796,19 @@ _ecore_evas_x_event_mouse_out(void *data __UNUSED__, int type __UNUSED__, void *
    //       (e->mode == ECORE_X_EVENT_MODE_UNGRAB))
    //     return 0;
    /* if (e->mode != ECORE_X_EVENT_MODE_NORMAL) return 0; */
-   ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
-   _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
-   if (e->mode == ECORE_X_EVENT_MODE_GRAB)
-     evas_event_feed_mouse_cancel(ee->evas, e->time, NULL);
-   evas_event_feed_mouse_out(ee->evas, e->time, NULL);
-   if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
-   if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
+   if (ee->in)
+     {
+        if (evas_event_down_count_get(ee->evas) > 0)
+          return ECORE_CALLBACK_PASS_ON;
+        ecore_event_evas_modifier_lock_update(ee->evas, e->modifiers);
+        _ecore_evas_mouse_move_process(ee, e->x, e->y, e->time);
+        if (e->mode == ECORE_X_EVENT_MODE_GRAB)
+          evas_event_feed_mouse_cancel(ee->evas, e->time, NULL);
+        evas_event_feed_mouse_out(ee->evas, e->time, NULL);
+        if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
+        if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
+        ee->in = EINA_FALSE;
+     }
    return ECORE_CALLBACK_PASS_ON;
 }
 
@@ -1032,6 +1042,14 @@ _ecore_evas_x_event_window_hide(void *data __UNUSED__, int type __UNUSED__, void
    ee = ecore_event_window_match(e->win);
    if (!ee) return ECORE_CALLBACK_PASS_ON; /* pass on event */
    if (e->win != ee->prop.window) return ECORE_CALLBACK_PASS_ON;
+   if (ee->in)
+     {
+        evas_event_feed_mouse_cancel(ee->evas, e->time, NULL);
+        evas_event_feed_mouse_out(ee->evas, e->time, NULL);
+        if (ee->func.fn_mouse_out) ee->func.fn_mouse_out(ee);
+        if (ee->prop.cursor.object) evas_object_hide(ee->prop.cursor.object);
+        ee->in = EINA_FALSE;
+     }
    if (!ee->visible) return ECORE_CALLBACK_PASS_ON;
 //   if (!ee->visible) return ECORE_CALLBACK_DONE;
 //   printf("HIDE EVENT %p\n", ee);