forked from enlightenment/efl
ecore-wl2: Fix issue of not unsetting move mouse pointer
Summary: When we finish moving a window, previously the mouse cursor would never get unset from the hand cursor. This is due to the way that grabs work in wayland, and not ever getting an event notification for the move being completed. This patch works around that issue @fix Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
parent
31dac90f9d
commit
9aaada21c3
|
@ -490,6 +490,13 @@ _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) && (input->grab.window == window))
|
||||
{
|
||||
_ecore_wl2_input_mouse_up_send(input, window, 0, input->grab.button,
|
||||
input->grab.timestamp);
|
||||
window->moving = EINA_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -511,6 +518,9 @@ _pointer_cb_leave(void *data, struct wl_pointer *pointer EINA_UNUSED, unsigned i
|
|||
window = _ecore_wl2_display_window_surface_find(input->display, surface);
|
||||
if (!window) return;
|
||||
|
||||
/* NB: Don't send a mouse out if we grabbed this window for moving */
|
||||
if ((window->moving) && (input->grab.window == window)) return;
|
||||
|
||||
_ecore_wl2_input_mouse_out_send(input, window);
|
||||
}
|
||||
|
||||
|
|
|
@ -125,6 +125,7 @@ struct _Ecore_Wl2_Window
|
|||
|
||||
Eina_Inlist *subsurfs;
|
||||
|
||||
Eina_Bool moving : 1;
|
||||
Eina_Bool minimized : 1;
|
||||
Eina_Bool maximized : 1;
|
||||
Eina_Bool fullscreen : 1;
|
||||
|
|
|
@ -412,7 +412,7 @@ ecore_wl2_window_move(Ecore_Wl2_Window *window, int x, int y)
|
|||
|
||||
if ((!input) || (!input->wl.seat)) return;
|
||||
|
||||
_ecore_wl2_input_ungrab(input);
|
||||
window->moving = EINA_TRUE;
|
||||
|
||||
if (window->xdg_surface)
|
||||
xdg_surface_move(window->xdg_surface, input->wl.seat,
|
||||
|
@ -437,8 +437,6 @@ ecore_wl2_window_resize(Ecore_Wl2_Window *window, int w, int h, int location)
|
|||
|
||||
if ((!input) || (!input->wl.seat)) return;
|
||||
|
||||
_ecore_wl2_input_ungrab(input);
|
||||
|
||||
if (window->xdg_surface)
|
||||
xdg_surface_resize(window->xdg_surface, input->wl.seat,
|
||||
input->display->serial, location);
|
||||
|
@ -793,43 +791,52 @@ ecore_wl2_window_iconified_set(Ecore_Wl2_Window *window, Eina_Bool iconified)
|
|||
EAPI void
|
||||
ecore_wl2_window_pointer_xy_get(Ecore_Wl2_Window *window, int *x, int *y)
|
||||
{
|
||||
Ecore_Wl2_Input *input;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
if (x) *x = 0;
|
||||
if (y) *y = 0;
|
||||
|
||||
if (!window->input) return;
|
||||
input = ecore_wl2_window_input_get(window);
|
||||
if (!input) return;
|
||||
|
||||
if (x) *x = window->input->pointer.sx;
|
||||
if (y) *y = window->input->pointer.sy;
|
||||
if (x) *x = input->pointer.sx;
|
||||
if (y) *y = input->pointer.sy;
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_pointer_set(Ecore_Wl2_Window *window, struct wl_surface *surface, int hot_x, int hot_y)
|
||||
{
|
||||
Ecore_Wl2_Input *input;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
if (!window->input) return;
|
||||
input = ecore_wl2_window_input_get(window);
|
||||
if (!input) return;
|
||||
|
||||
_ecore_wl2_input_cursor_update_stop(window->input);
|
||||
_ecore_wl2_input_cursor_update_stop(input);
|
||||
|
||||
if (window->input->wl.pointer)
|
||||
wl_pointer_set_cursor(window->input->wl.pointer,
|
||||
window->input->pointer.enter_serial,
|
||||
if (input->wl.pointer)
|
||||
wl_pointer_set_cursor(input->wl.pointer,
|
||||
input->pointer.enter_serial,
|
||||
surface, hot_x, hot_y);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
ecore_wl2_window_cursor_from_name_set(Ecore_Wl2_Window *window, const char *cursor)
|
||||
{
|
||||
Ecore_Wl2_Input *input;
|
||||
|
||||
EINA_SAFETY_ON_NULL_RETURN(window);
|
||||
|
||||
eina_stringshare_replace(&window->cursor, cursor);
|
||||
|
||||
if (!window->input) return;
|
||||
input = ecore_wl2_window_input_get(window);
|
||||
if (!input) return;
|
||||
|
||||
_ecore_wl2_input_cursor_update_stop(window->input);
|
||||
_ecore_wl2_input_cursor_set(window->input, cursor);
|
||||
_ecore_wl2_input_cursor_update_stop(input);
|
||||
_ecore_wl2_input_cursor_set(input, cursor);
|
||||
}
|
||||
|
||||
EAPI void
|
||||
|
|
Loading…
Reference in New Issue