xwayland: Use xwl_window for tracking focus/touch
Slightly simpler, and might work better in some cases when X windows get reparented. Part-of: <https://gitlab.freedesktop.org/xorg/xserver/-/merge_requests/1300>
This commit is contained in:
parent
0db309467d
commit
59a0259152
|
@ -547,7 +547,7 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer,
|
||||||
dy = xwl_seat->focus_window->window->drawable.y;
|
dy = xwl_seat->focus_window->window->drawable.y;
|
||||||
|
|
||||||
/* We just entered a new xwindow, forget about the old last xwindow */
|
/* We just entered a new xwindow, forget about the old last xwindow */
|
||||||
xwl_seat->last_xwindow = NullWindow;
|
xwl_seat->last_focus_window = NULL;
|
||||||
|
|
||||||
master = GetMaster(dev, POINTER_OR_FLOAT);
|
master = GetMaster(dev, POINTER_OR_FLOAT);
|
||||||
(*pScreen->SetCursorPosition) (dev, pScreen, dx + sx, dy + sy, TRUE);
|
(*pScreen->SetCursorPosition) (dev, pScreen, dx + sx, dy + sy, TRUE);
|
||||||
|
@ -615,7 +615,7 @@ pointer_handle_leave(void *data, struct wl_pointer *pointer,
|
||||||
* in sprite_check_lost_focus()
|
* in sprite_check_lost_focus()
|
||||||
*/
|
*/
|
||||||
if (xwl_seat->focus_window) {
|
if (xwl_seat->focus_window) {
|
||||||
xwl_seat->last_xwindow = xwl_seat->focus_window->window;
|
xwl_seat->last_focus_window = xwl_seat->focus_window;
|
||||||
xwl_seat->focus_window = NULL;
|
xwl_seat->focus_window = NULL;
|
||||||
focus_lost = TRUE;
|
focus_lost = TRUE;
|
||||||
}
|
}
|
||||||
|
@ -3192,8 +3192,9 @@ sprite_check_lost_focus(SpritePtr sprite, WindowPtr window)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (xwl_seat->focus_window == NULL &&
|
if (xwl_seat->focus_window == NULL &&
|
||||||
xwl_seat->last_xwindow != NullWindow &&
|
xwl_seat->last_focus_window != NULL &&
|
||||||
(IsParent(xwl_seat->last_xwindow, window) || xwl_seat->last_xwindow == window))
|
(xwl_seat->last_focus_window->window == window ||
|
||||||
|
IsParent(xwl_seat->last_focus_window->window, window)))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -3227,13 +3228,13 @@ xwl_xy_to_window(ScreenPtr screen, SpritePtr sprite, int x, int y)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
xwl_seat_clear_touch(struct xwl_seat *xwl_seat, WindowPtr window)
|
xwl_seat_clear_touch(struct xwl_seat *xwl_seat, struct xwl_window *xwl_window)
|
||||||
{
|
{
|
||||||
struct xwl_touch *xwl_touch, *next_xwl_touch;
|
struct xwl_touch *xwl_touch, *next_xwl_touch;
|
||||||
|
|
||||||
xorg_list_for_each_entry_safe(xwl_touch, next_xwl_touch,
|
xorg_list_for_each_entry_safe(xwl_touch, next_xwl_touch,
|
||||||
&xwl_seat->touches, link_touch) {
|
&xwl_seat->touches, link_touch) {
|
||||||
if (xwl_touch->window->window == window) {
|
if (xwl_touch->window == xwl_window) {
|
||||||
xorg_list_del(&xwl_touch->link_touch);
|
xorg_list_del(&xwl_touch->link_touch);
|
||||||
free(xwl_touch);
|
free(xwl_touch);
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,7 +81,7 @@ struct xwl_seat {
|
||||||
OsTimerPtr x_cursor_timer;
|
OsTimerPtr x_cursor_timer;
|
||||||
CursorPtr pending_x_cursor;
|
CursorPtr pending_x_cursor;
|
||||||
struct xwl_cursor cursor;
|
struct xwl_cursor cursor;
|
||||||
WindowPtr last_xwindow;
|
struct xwl_window *last_focus_window;
|
||||||
|
|
||||||
uint32_t pointer_gesture_swipe_fingers;
|
uint32_t pointer_gesture_swipe_fingers;
|
||||||
uint32_t pointer_gesture_pinch_fingers;
|
uint32_t pointer_gesture_pinch_fingers;
|
||||||
|
@ -195,7 +195,7 @@ void xwl_seat_leave_kbd(struct xwl_seat *xwl_seat);
|
||||||
|
|
||||||
void xwl_seat_destroy(struct xwl_seat *xwl_seat);
|
void xwl_seat_destroy(struct xwl_seat *xwl_seat);
|
||||||
|
|
||||||
void xwl_seat_clear_touch(struct xwl_seat *xwl_seat, WindowPtr window);
|
void xwl_seat_clear_touch(struct xwl_seat *xwl_seat, struct xwl_window *xwl_window);
|
||||||
|
|
||||||
void xwl_seat_emulate_pointer_warp(struct xwl_seat *xwl_seat,
|
void xwl_seat_emulate_pointer_warp(struct xwl_seat *xwl_seat,
|
||||||
struct xwl_window *xwl_window,
|
struct xwl_window *xwl_window,
|
||||||
|
|
|
@ -1452,23 +1452,6 @@ xwl_unrealize_window(WindowPtr window)
|
||||||
|
|
||||||
xwl_screen = xwl_screen_get(screen);
|
xwl_screen = xwl_screen_get(screen);
|
||||||
|
|
||||||
xorg_list_for_each_entry(xwl_seat, &xwl_screen->seat_list, link) {
|
|
||||||
if (xwl_seat->focus_window && xwl_seat->focus_window->window == window)
|
|
||||||
xwl_seat->focus_window = NULL;
|
|
||||||
if (xwl_seat->tablet_focus_window && xwl_seat->tablet_focus_window->window == window)
|
|
||||||
xwl_seat->tablet_focus_window = NULL;
|
|
||||||
if (xwl_seat->last_xwindow == window)
|
|
||||||
xwl_seat->last_xwindow = NullWindow;
|
|
||||||
if (xwl_seat->cursor_confinement_window &&
|
|
||||||
xwl_seat->cursor_confinement_window->window == window)
|
|
||||||
xwl_seat_unconfine_pointer(xwl_seat);
|
|
||||||
if (xwl_seat->pointer_warp_emulator &&
|
|
||||||
xwl_seat->pointer_warp_emulator->locked_window &&
|
|
||||||
xwl_seat->pointer_warp_emulator->locked_window->window == window)
|
|
||||||
xwl_seat_destroy_pointer_warp_emulator(xwl_seat);
|
|
||||||
xwl_seat_clear_touch(xwl_seat, window);
|
|
||||||
}
|
|
||||||
|
|
||||||
compUnredirectWindow(serverClient, window, CompositeRedirectManual);
|
compUnredirectWindow(serverClient, window, CompositeRedirectManual);
|
||||||
|
|
||||||
screen->UnrealizeWindow = xwl_screen->UnrealizeWindow;
|
screen->UnrealizeWindow = xwl_screen->UnrealizeWindow;
|
||||||
|
@ -1480,6 +1463,21 @@ xwl_unrealize_window(WindowPtr window)
|
||||||
if (!xwl_window)
|
if (!xwl_window)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
xorg_list_for_each_entry(xwl_seat, &xwl_screen->seat_list, link) {
|
||||||
|
if (xwl_seat->focus_window == xwl_window)
|
||||||
|
xwl_seat->focus_window = NULL;
|
||||||
|
if (xwl_seat->tablet_focus_window == xwl_window)
|
||||||
|
xwl_seat->tablet_focus_window = NULL;
|
||||||
|
if (xwl_seat->last_focus_window == xwl_window)
|
||||||
|
xwl_seat->last_focus_window = NULL;
|
||||||
|
if (xwl_seat->cursor_confinement_window == xwl_window)
|
||||||
|
xwl_seat_unconfine_pointer(xwl_seat);
|
||||||
|
if (xwl_seat->pointer_warp_emulator &&
|
||||||
|
xwl_seat->pointer_warp_emulator->locked_window == xwl_window)
|
||||||
|
xwl_seat_destroy_pointer_warp_emulator(xwl_seat);
|
||||||
|
xwl_seat_clear_touch(xwl_seat, xwl_window);
|
||||||
|
}
|
||||||
|
|
||||||
if (xwl_window_has_viewport_enabled(xwl_window))
|
if (xwl_window_has_viewport_enabled(xwl_window))
|
||||||
xwl_window_disable_viewport(xwl_window);
|
xwl_window_disable_viewport(xwl_window);
|
||||||
#ifdef XWL_HAS_GLAMOR
|
#ifdef XWL_HAS_GLAMOR
|
||||||
|
|
Loading…
Reference in New Issue