derekf pushed a commit to branch master.

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

commit ed60eddff5cf2c9397eb30afad25ce30266ab65e
Author: Derek Foreman <der...@osg.samsung.com>
Date:   Tue May 8 13:26:46 2018 -0500

    ecore_wl2: Fix window drag mouse eventing
    
    Summary:
    When a CSD button interaction under wayland leads to a compositor action
    like move or resize, we essentially "give back" that button press to the
    compositor, and it never sends us a mouse up for it.
    
    We need to internally fire a mouse up event to fix up state so the client
    doesn't think the mouse is still down.  Until now we've been doing this
    by setting a flag when we start a move/resize and checking it at next
    pointer enter for the window.
    
    This leads to unsolvable races and wacky bookkeeping, and runs afoul of
    the fact that we're not actually guaranteed a pointer enter immediately
    after a move completes.  There is absolutely no way at all on wayland to
    know if a move or resize operation has completed.
    
    So, let's just fire the mouse up immediately on start of interaction,
    which is raceless.
    
    This fixes a years old bug where dragging a window might leave a stuck
    mouse up, and allow hilighting text without drag after the window drag
    completes.  (elementary-test -to "text editor" with multiple windows open
    exhibits this bug)
    Depends on D6127
    
    Reviewers: zmike, cedric
    
    Reviewed By: zmike
    
    Tags: #efl
    
    Differential Revision: https://phab.enlightenment.org/D6128
---
 src/lib/ecore_wl2/ecore_wl2_input.c   | 7 -------
 src/lib/ecore_wl2/ecore_wl2_private.h | 2 --
 src/lib/ecore_wl2/ecore_wl2_window.c  | 8 ++++----
 3 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/src/lib/ecore_wl2/ecore_wl2_input.c 
b/src/lib/ecore_wl2/ecore_wl2_input.c
index 7e67fc9a99..9d6378f1bb 100644
--- a/src/lib/ecore_wl2/ecore_wl2_input.c
+++ b/src/lib/ecore_wl2/ecore_wl2_input.c
@@ -716,13 +716,6 @@ _pointer_cb_enter(void *data, struct wl_pointer *pointer 
EINA_UNUSED, unsigned i
    input->focus.pointer = window;
 
    _ecore_wl2_input_mouse_in_send(input, window);
-
-   if ((window->moving || window->resizing) && (input->grab.window == window))
-     {
-        _ecore_wl2_input_mouse_up_send(input, window, 0, input->grab.button,
-                                       input->grab.timestamp);
-        window->resizing = window->moving = EINA_FALSE;
-     }
 }
 
 static void
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h 
b/src/lib/ecore_wl2/ecore_wl2_private.h
index c79e3fa088..b636612270 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -229,8 +229,6 @@ struct _Ecore_Wl2_Window
    Ecore_Wl2_Window_Configure_State req_config;
    Ecore_Wl2_Window_Configure_State def_config;
 
-   Eina_Bool moving : 1;
-   Eina_Bool resizing : 1;
    Eina_Bool alpha : 1;
 
    Eina_Bool input_set : 1;
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c 
b/src/lib/ecore_wl2/ecore_wl2_window.c
index 7010938c40..7b1d6b711e 100644
--- a/src/lib/ecore_wl2/ecore_wl2_window.c
+++ b/src/lib/ecore_wl2/ecore_wl2_window.c
@@ -734,8 +734,6 @@ ecore_wl2_window_move(Ecore_Wl2_Window *window, 
Ecore_Wl2_Input *input)
    if (!input)
      input = EINA_INLIST_CONTAINER_GET(window->display->inputs, 
Ecore_Wl2_Input);
 
-   window->moving = EINA_TRUE;
-
    if (window->xdg_toplevel)
      xdg_toplevel_move(window->xdg_toplevel, input->wl.seat,
                            window->display->serial);
@@ -743,6 +741,8 @@ ecore_wl2_window_move(Ecore_Wl2_Window *window, 
Ecore_Wl2_Input *input)
      zxdg_toplevel_v6_move(window->zxdg_toplevel, input->wl.seat,
                            window->display->serial);
    ecore_wl2_display_flush(window->display);
+
+   _ecore_wl2_input_ungrab(input);
 }
 
 EAPI void
@@ -754,8 +754,6 @@ ecore_wl2_window_resize(Ecore_Wl2_Window *window, 
Ecore_Wl2_Input *input, int lo
    if (!input)
      input = EINA_INLIST_CONTAINER_GET(window->display->inputs, 
Ecore_Wl2_Input);
 
-   window->resizing = EINA_TRUE;
-
    if (window->xdg_toplevel)
      xdg_toplevel_resize(window->xdg_toplevel, input->wl.seat,
                              window->display->serial, location);
@@ -763,6 +761,8 @@ ecore_wl2_window_resize(Ecore_Wl2_Window *window, 
Ecore_Wl2_Input *input, int lo
      zxdg_toplevel_v6_resize(window->zxdg_toplevel, input->wl.seat,
                              window->display->serial, location);
    ecore_wl2_display_flush(window->display);
+
+   _ecore_wl2_input_ungrab(input);
 }
 
 EAPI void

-- 


Reply via email to