discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/efl.git/commit/?id=fbb462371fbb922e4387e77efb27690f8e44d8a1

commit fbb462371fbb922e4387e77efb27690f8e44d8a1
Author: Mike Blumenkrantz <zm...@osg.samsung.com>
Date:   Tue Jul 7 14:15:29 2015 -0400

    ecore-input-evas: fix canvas mouse event dispatch
    
    this was broken in 5cb6cdbc5e1a13ea0262e155983b494e6519abde such that
    when multiple sources produce mouse events using the same device,
    these events are marshalled as though they were from the same canvas.
    the result is that eventing is wrong on at least one of the canvases,
    and spurious mouse-up events are triggered before every mouse down
    
    fix T2509
---
 src/lib/ecore_input_evas/ecore_input_evas.c | 20 +++++++++++++-------
 1 file changed, 13 insertions(+), 7 deletions(-)

diff --git a/src/lib/ecore_input_evas/ecore_input_evas.c 
b/src/lib/ecore_input_evas/ecore_input_evas.c
index 4c95bf9..d332b4c 100644
--- a/src/lib/ecore_input_evas/ecore_input_evas.c
+++ b/src/lib/ecore_input_evas/ecore_input_evas.c
@@ -48,6 +48,7 @@ struct _Ecore_Input_Last
    unsigned int device;
    unsigned int buttons;
    Ecore_Input_State state;
+   Ecore_Window win;
 
    Eina_Bool faked : 1;
 };
@@ -118,7 +119,7 @@ _ecore_event_last_check(Ecore_Event_Last *eel, 
Ecore_Event_Press press)
 }
 
 static Ecore_Event_Last *
-_ecore_event_evas_lookup(unsigned int device, unsigned int buttons, Eina_Bool 
create_new)
+_ecore_event_evas_lookup(unsigned int device, unsigned int buttons, 
Ecore_Window win, Eina_Bool create_new)
 {
    Ecore_Event_Last *eel;
    Eina_List *l;
@@ -137,6 +138,7 @@ _ecore_event_evas_lookup(unsigned int device, unsigned int 
buttons, Eina_Bool cr
    eel->buttons = buttons;
    eel->state = ECORE_INPUT_NONE;
    eel->faked = EINA_FALSE;
+   eel->win = win;
 
    _last_events = eina_list_append(_last_events, eel);
    return eel;
@@ -174,14 +176,15 @@ static Eina_Bool
 _ecore_event_evas_push_mouse_button(Ecore_Event_Mouse_Button *e, 
Ecore_Event_Press press)
 {
    Ecore_Event_Last *eel;
-   Ecore_Input_Action action;
+   Ecore_Input_Action action = ECORE_INPUT_CONTINUE;
 
    //_ecore_event_evas_mouse_button already check press or cancel without 
history
-   eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, EINA_TRUE);
+   eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, e->window, 
EINA_TRUE);
    if (!eel) return EINA_FALSE;
    INF("dev(%d), button(%d), last_press(%d), press(%d)", e->multi.device, 
e->buttons, eel->state, press);
 
-   action = _ecore_event_last_check(eel, press);
+   if (e->window == eel->win)
+     action = _ecore_event_last_check(eel, press);
    INF("action(%d)", action);
    switch (action)
      {
@@ -191,6 +194,7 @@ 
_ecore_event_evas_push_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Pre
          break;
       case ECORE_INPUT_IGNORE:
       default:
+        eel->win = e->window;
         return EINA_FALSE;
      }
 
@@ -205,6 +209,7 @@ 
_ecore_event_evas_push_mouse_button(Ecore_Event_Mouse_Button *e, Ecore_Event_Pre
       default:
         break;
      }
+   eel->win = e->window;
 
    //if up event not occurs from under layers of ecore
    //up event is generated by ecore
@@ -456,15 +461,16 @@ _ecore_event_evas_mouse_button(Ecore_Event_Mouse_Button 
*e, Ecore_Event_Press pr
    if (press != ECORE_DOWN)
      {
         //ECORE_UP or ECORE_CANCEL
-        eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, 
EINA_FALSE);
+        eel = _ecore_event_evas_lookup(e->multi.device, e->buttons, e->window, 
EINA_FALSE);
         if (!eel)
           {
              WRN("ButtonEvent has no history.");
              return ECORE_CALLBACK_PASS_ON;
           }
 
-        if ((eel->state == ECORE_INPUT_UP) ||
-            (eel->state == ECORE_INPUT_CANCEL))
+        if ((e->window == eel->win) &&
+            ((eel->state == ECORE_INPUT_UP) ||
+            (eel->state == ECORE_INPUT_CANCEL)))
           {
              WRN("ButtonEvent has wrong history. Last state=%d", eel->state);
              return ECORE_CALLBACK_PASS_ON;

-- 


Reply via email to