Commit 1345f804 authored by Olivier Fourdan's avatar Olivier Fourdan
Browse files

xwayland: confine motion events to the confined window

When an X11 client has an active grab on the pointer, all events are
reported relative to the window with the grab.

For Xwayland, if an X11 client has a grab with a pointer confinement
active, while pointer focus is on another window, motion events should
not be reported to the client with the grab, because that sets the X11
client appart, the events would be reported when the pointer is on any
X11 window but not on Wayland native surfaces.

Therefore, if the pointer is confined on a window and that window
differs from the actual pointer focus window, just pretend we lost
pointer focus to another window.
Signed-off-by: default avatarOlivier Fourdan <>
Closes: xorg/xserver#962

Reviewed-by: Carlos Garnacho's avatarCarlos Garnacho <>
Reviewed-by: Peter Hutterer's avatarPeter Hutterer <>
parent 5929b789
......@@ -2544,8 +2544,15 @@ sprite_check_lost_focus(SpritePtr sprite, WindowPtr window)
* devices so we can find out the xwl_seat, but those don't actually own
* their sprite, so the match doesn't mean a lot.
if (master->lastSlave == xwl_seat->pointer &&
xwl_seat->focus_window == NULL &&
if (master->lastSlave != xwl_seat->pointer)
return FALSE;
if (xwl_seat->focus_window != NULL &&
xwl_seat->cursor_confinement_window != NULL &&
xwl_seat->focus_window != xwl_seat->cursor_confinement_window)
return TRUE;
if (xwl_seat->focus_window == NULL &&
xwl_seat->last_xwindow != NullWindow &&
IsParent(xwl_seat->last_xwindow, window))
return TRUE;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment