mirror of
https://gitlab.freedesktop.org/xorg/xserver.git
synced 2025-12-20 12:50:04 +01:00
Merge branch 'xwayland-fix-pointer-lost' into 'master'
xwayland: Check for pointer caps on lock / warp Closes #1829 See merge request xorg/xserver!2042
This commit is contained in:
commit
a82f3df8af
3 changed files with 61 additions and 1 deletions
|
|
@ -1720,6 +1720,19 @@ init_pointer(struct xwl_seat *xwl_seat)
|
||||||
ActivateDevice(xwl_seat->pointer, TRUE);
|
ActivateDevice(xwl_seat->pointer, TRUE);
|
||||||
}
|
}
|
||||||
enable_device(xwl_seat, xwl_seat->pointer);
|
enable_device(xwl_seat, xwl_seat->pointer);
|
||||||
|
|
||||||
|
/* If the pointer comes back after we got a request for a pointer locking
|
||||||
|
* or confinement, try again now that we've got our pointer back.
|
||||||
|
*/
|
||||||
|
if (xwl_seat->pending_pointer_lock.has_pending_pointer_warp)
|
||||||
|
xwl_seat_emulate_pointer_warp(xwl_seat,
|
||||||
|
xwl_seat->pending_pointer_lock.xwl_window,
|
||||||
|
NULL,
|
||||||
|
xwl_seat->pending_pointer_lock.pending_x,
|
||||||
|
xwl_seat->pending_pointer_lock.pending_y);
|
||||||
|
if (xwl_seat->pending_pointer_lock.has_pending_confined_pointer)
|
||||||
|
xwl_seat_confine_pointer(xwl_seat,
|
||||||
|
xwl_seat->pending_pointer_lock.xwl_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -3380,6 +3393,17 @@ xwl_pointer_warp_emulator_maybe_lock(struct xwl_pointer_warp_emulator *warp_emul
|
||||||
struct xwl_seat *xwl_seat = warp_emulator->xwl_seat;
|
struct xwl_seat *xwl_seat = warp_emulator->xwl_seat;
|
||||||
GrabPtr pointer_grab = xwl_seat->pointer->deviceGrab.grab;
|
GrabPtr pointer_grab = xwl_seat->pointer->deviceGrab.grab;
|
||||||
|
|
||||||
|
/* Can't lock the pointer without pointer caps */
|
||||||
|
if (!xwl_seat->wl_pointer) {
|
||||||
|
xwl_seat->pending_pointer_lock.has_pending_pointer_warp = TRUE;
|
||||||
|
xwl_seat->pending_pointer_lock.xwl_window = xwl_window;
|
||||||
|
xwl_seat->pending_pointer_lock.pending_x = x;
|
||||||
|
xwl_seat->pending_pointer_lock.pending_y = y;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
xwl_seat->pending_pointer_lock.has_pending_pointer_warp = FALSE;
|
||||||
|
|
||||||
if (warp_emulator->locked_pointer)
|
if (warp_emulator->locked_pointer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -3410,6 +3434,17 @@ xwl_pointer_warp_emulator_warp(struct xwl_pointer_warp_emulator *warp_emulator,
|
||||||
SpritePtr sprite,
|
SpritePtr sprite,
|
||||||
int x, int y)
|
int x, int y)
|
||||||
{
|
{
|
||||||
|
struct xwl_seat *xwl_seat = warp_emulator->xwl_seat;
|
||||||
|
|
||||||
|
if (!xwl_seat->wl_pointer) {
|
||||||
|
xwl_seat->pending_pointer_lock.has_pending_pointer_warp = TRUE;
|
||||||
|
xwl_seat->pending_pointer_lock.xwl_window = xwl_window;
|
||||||
|
xwl_seat->pending_pointer_lock.pending_x = x;
|
||||||
|
xwl_seat->pending_pointer_lock.pending_y = y;
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
xwl_pointer_warp_emulator_maybe_lock(warp_emulator,
|
xwl_pointer_warp_emulator_maybe_lock(warp_emulator,
|
||||||
xwl_window,
|
xwl_window,
|
||||||
sprite,
|
sprite,
|
||||||
|
|
@ -3596,8 +3631,11 @@ xwl_seat_confine_pointer(struct xwl_seat *xwl_seat,
|
||||||
if (!pointer_constraints)
|
if (!pointer_constraints)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!xwl_seat->wl_pointer)
|
if (!xwl_seat->wl_pointer) {
|
||||||
|
xwl_seat->pending_pointer_lock.has_pending_confined_pointer = TRUE;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
xwl_seat->pending_pointer_lock.has_pending_confined_pointer = FALSE;
|
||||||
|
|
||||||
if (xwl_seat->cursor_confinement_window == xwl_window &&
|
if (xwl_seat->cursor_confinement_window == xwl_window &&
|
||||||
xwl_seat->confined_pointer)
|
xwl_seat->confined_pointer)
|
||||||
|
|
@ -3632,11 +3670,22 @@ void
|
||||||
xwl_seat_unconfine_pointer(struct xwl_seat *xwl_seat)
|
xwl_seat_unconfine_pointer(struct xwl_seat *xwl_seat)
|
||||||
{
|
{
|
||||||
xwl_seat->cursor_confinement_window = NULL;
|
xwl_seat->cursor_confinement_window = NULL;
|
||||||
|
xwl_seat->pending_pointer_lock.has_pending_confined_pointer = FALSE;
|
||||||
|
|
||||||
if (xwl_seat->confined_pointer)
|
if (xwl_seat->confined_pointer)
|
||||||
xwl_seat_destroy_confined_pointer(xwl_seat);
|
xwl_seat_destroy_confined_pointer(xwl_seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void xwl_seat_clear_pending_pointer_lock(struct xwl_seat *xwl_seat,
|
||||||
|
struct xwl_window *xwl_window)
|
||||||
|
{
|
||||||
|
if (xwl_seat->pending_pointer_lock.xwl_window == xwl_window) {
|
||||||
|
xwl_seat->pending_pointer_lock.has_pending_pointer_warp = FALSE;
|
||||||
|
xwl_seat->pending_pointer_lock.has_pending_confined_pointer = FALSE;
|
||||||
|
xwl_seat->pending_pointer_lock.xwl_window = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
InitInput(int argc, char *argv[])
|
InitInput(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -125,6 +125,14 @@ struct xwl_seat {
|
||||||
struct xorg_list tablet_tools;
|
struct xorg_list tablet_tools;
|
||||||
struct xorg_list tablet_pads;
|
struct xorg_list tablet_pads;
|
||||||
struct zwp_xwayland_keyboard_grab_v1 *keyboard_grab;
|
struct zwp_xwayland_keyboard_grab_v1 *keyboard_grab;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
Bool has_pending_pointer_warp;
|
||||||
|
Bool has_pending_confined_pointer;
|
||||||
|
struct xwl_window *xwl_window;
|
||||||
|
int pending_x;
|
||||||
|
int pending_y;
|
||||||
|
} pending_pointer_lock;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct xwl_tablet {
|
struct xwl_tablet {
|
||||||
|
|
@ -213,4 +221,6 @@ void xwl_seat_unconfine_pointer(struct xwl_seat *xwl_seat);
|
||||||
|
|
||||||
void xwl_screen_release_tablet_manager(struct xwl_screen *xwl_screen);
|
void xwl_screen_release_tablet_manager(struct xwl_screen *xwl_screen);
|
||||||
|
|
||||||
|
void xwl_seat_clear_pending_pointer_lock(struct xwl_seat *xwl_seat,
|
||||||
|
struct xwl_window *xwl_window);
|
||||||
#endif /* XWAYLAND_INPUT_H */
|
#endif /* XWAYLAND_INPUT_H */
|
||||||
|
|
|
||||||
|
|
@ -1700,6 +1700,7 @@ xwl_window_dispose(struct xwl_window *xwl_window)
|
||||||
xwl_seat->pointer_warp_emulator->locked_window == xwl_window)
|
xwl_seat->pointer_warp_emulator->locked_window == xwl_window)
|
||||||
xwl_seat_destroy_pointer_warp_emulator(xwl_seat);
|
xwl_seat_destroy_pointer_warp_emulator(xwl_seat);
|
||||||
xwl_seat_clear_touch(xwl_seat, xwl_window);
|
xwl_seat_clear_touch(xwl_seat, xwl_window);
|
||||||
|
xwl_seat_clear_pending_pointer_lock(xwl_seat, xwl_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (xwl_window_has_viewport_enabled(xwl_window))
|
if (xwl_window_has_viewport_enabled(xwl_window))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue