zmike pushed a commit to branch efl-1.22.

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

commit ed2b2aa790d51344d9451b79a1492c26ee431c38
Author: Wonki Kim <[email protected]>
Date:   Tue Apr 30 11:27:25 2019 -0400

    wl2_input: fix a problem that occurs in case of using both pointer/touch 
input devices
    
    Summary:
    if wl2_input logic gets a 'touch down' event from touch device,
    input->focus.touch has set and it cause the logic handles every input as 
touch input
    from that moment at _ecore_wl2_input_mouse_move_send function.
    that is the reason why the patch(410c1f95879e46a5e52132662d4c43b74e95a251) 
has written for.
    
    however, if there are multiple touch input devices,
    clearing focus.touch variable without checking any conditions causes 
another problem.
    
    I mean a case such as 'touch 1 down' -> 'touch 2 down' -> 'touch 1 up' -> 
'touch 2 up'
    at the moment 'touch 1 up' event executed, focus.touch would be cleared,
    and 'touch 2 up' and following touch events will not be executed properly 
at the moment.
    
    this patch counts a number of touch devices which are grabbing to clear 
focus.touch at proper time.
    
    Reviewers: devilhorns
    
    Reviewed By: devilhorns
    
    Subscribers: cedric, #reviewers, #committers
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D8787
---
 src/lib/ecore_wl2/ecore_wl2_input.c   | 6 +++++-
 src/lib/ecore_wl2/ecore_wl2_private.h | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c 
b/src/lib/ecore_wl2/ecore_wl2_input.c
index fb50d04117..67a2dcba80 100644
--- a/src/lib/ecore_wl2/ecore_wl2_input.c
+++ b/src/lib/ecore_wl2/ecore_wl2_input.c
@@ -671,6 +671,7 @@ _ecore_wl2_input_ungrab(Ecore_Wl2_Input *input)
    input->grab.window = NULL;
    input->grab.button = 0;
    input->grab.count = 0;
+   input->grab.touch_count = 0;
 }
 
 static void
@@ -1210,6 +1211,7 @@ _touch_cb_down(void *data, struct wl_touch *touch 
EINA_UNUSED, unsigned int seri
 
    input->focus.touch = window;
    input->timestamp = timestamp;
+   input->grab.touch_count++;
 
    _pointer_cb_enter(data, NULL, serial, surface, x, y);
 
@@ -1239,11 +1241,13 @@ _touch_cb_up(void *data, struct wl_touch *touch 
EINA_UNUSED, unsigned int serial
                                   BTN_LEFT, timestamp);
 
    if (input->grab.count) input->grab.count--;
+   if (input->grab.touch_count) input->grab.touch_count--;
    if ((input->grab.window) && (input->grab.button == BTN_LEFT) &&
        (!input->grab.count))
      _ecore_wl2_input_ungrab(input);
 
-   input->focus.touch = NULL;
+   if (input->grab.touch_count == 0) input->focus.touch = NULL;
+
 }
 
 static void
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h 
b/src/lib/ecore_wl2/ecore_wl2_private.h
index 9b6d4f7e49..4c19886842 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -473,6 +473,7 @@ struct _Ecore_Wl2_Input
      {
         unsigned int button, count, timestamp;
         Ecore_Wl2_Window *window;
+        unsigned int touch_count;
      } grab;
 
    struct

-- 


Reply via email to