devilhorns pushed a commit to branch master.

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

commit 71fab4932578502c169a05350752bc5f85e47cca
Author: JengHyun Kang <jhyuni.k...@samsung.com>
Date:   Tue Jun 28 09:01:09 2016 -0400

    ecore-wayland: Prevent duplicated mouse up events.
    
    Summary:
    Prevent duplicated mouse up events generated from input_ungrab.
             If you touch downs and ups about all of fingers,
             that is sufficient condition to call ecore_wl_input_ungrab().
             And then one mouse up event is generated from that function.
             So if you set a callback about ECORE_EVENT_MOUSE_BUTTON_UP,
             you can watch two mouse up events are occurred.
    
    Test Plan: Touch and release. And watch mouse up events.
    
    Reviewers: raster, zmike, devilhorns
    
    Reviewed By: devilhorns
    
    Subscribers: ohduna, input.hacker, cedric, jpeg
    
    Differential Revision: https://phab.enlightenment.org/D4112
---
 src/lib/ecore_wayland/ecore_wl_input.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/lib/ecore_wayland/ecore_wl_input.c 
b/src/lib/ecore_wayland/ecore_wl_input.c
index 6219a03..e36f47d 100644
--- a/src/lib/ecore_wayland/ecore_wl_input.c
+++ b/src/lib/ecore_wayland/ecore_wl_input.c
@@ -164,12 +164,13 @@ ecore_wl_input_ungrab(Ecore_Wl_Input *input)
 
    if (!input) return;
 
-   if ((input->grab) && (input->grab_button))
+   if ((input->grab) && (input->grab_button) && (input->grab_count))
      _ecore_wl_input_mouse_up_send(input, input->grab, 0, input->grab_button,
                                    input->grab_timestamp);
 
    input->grab = NULL;
    input->grab_button = 0;
+   input->grab_count = 0;
 }
 
 /* NB: This function should be called just before shell move and shell resize
@@ -622,8 +623,8 @@ _ecore_wl_input_cb_pointer_button(void *data, struct 
wl_pointer *pointer EINA_UN
           _ecore_wl_input_mouse_up_send(input, input->pointer_focus,
                                         0, button, timestamp);
 
-        input->grab_count--;
-        if ((input->grab) && (input->grab_button == button) && 
+        if (input->grab_count) input->grab_count--;
+        if ((input->grab) && (input->grab_button == button) &&
             (!state) && (!input->grab_count))
           ecore_wl_input_ungrab(input);
      }
@@ -1168,8 +1169,8 @@ _ecore_wl_input_cb_touch_up(void *data, struct wl_touch 
*touch EINA_UNUSED, unsi
    input->display->serial = serial;
 
    _ecore_wl_input_mouse_up_send(input, input->touch_focus, id, BTN_LEFT, 
timestamp);
-   input->grab_count--;
-   if ((input->grab) && (input->grab_button == BTN_LEFT) && 
+   if (input->grab_count) input->grab_count--;
+   if ((input->grab) && (input->grab_button == BTN_LEFT) &&
        (!input->grab_count))
      ecore_wl_input_ungrab(input);
 }

-- 


Reply via email to