ecore_wl2: Fix window drag mouse eventing
authorDerek Foreman <derekf@osg.samsung.com>
Tue, 8 May 2018 18:26:46 +0000 (13:26 -0500)
committerWonki Kim <wonki_.kim@samsung.com>
Fri, 1 Jun 2018 01:51:17 +0000 (10:51 +0900)
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
src/lib/ecore_wl2/ecore_wl2_private.h
src/lib/ecore_wl2/ecore_wl2_window.c

index e963aca..9602dac 100644 (file)
@@ -1056,13 +1056,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
index cf04e01..17b118f 100644 (file)
@@ -284,8 +284,6 @@ struct _Ecore_Wl2_Window
    Eina_Bool iconified : 1;
    //
 
-   Eina_Bool moving : 1;
-   Eina_Bool resizing : 1;
    Eina_Bool alpha : 1;
    Eina_Bool transparent : 1;
 
index d99464a..88c2691 100644 (file)
@@ -1292,8 +1292,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);
@@ -1301,6 +1299,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
@@ -1312,8 +1312,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);
@@ -1321,6 +1319,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