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
This commit is contained in:
Derek Foreman 2018-05-08 13:26:46 -05:00
parent f78ff5f445
commit ed60eddff5
3 changed files with 4 additions and 13 deletions

View File

@ -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

View File

@ -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;

View File

@ -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