mirror of
https://github.com/brl/mutter.git
synced 2024-11-25 09:30:45 -05:00
MetaWaylandPointerConstraints: Relax enable requirements for Xwayland
Xwayland surfaces are special, because there is no reliable way to associate a window with its corresponding "application window" (the one which was given focus). Many games that require pointer warping and confining pointer grabs may for example create override redirect windows and make that window receive input even though it will never be the focus window. Therefore, the requirements for enabling a constraint for a wl_surface from Xwayland needs to be relaxed in order. This commit changes Xwayland wl_surfaces to not require being focused to be enabled; it'll be enabled as long as any X11 window is the one with focus. https://bugzilla.gnome.org/show_bug.cgi?id=771050
This commit is contained in:
parent
10c7035a71
commit
33ba06504b
@ -449,8 +449,33 @@ meta_wayland_pointer_constraint_maybe_enable (MetaWaylandPointerConstraint *cons
|
||||
return;
|
||||
}
|
||||
|
||||
if (!meta_window_appears_focused (constraint->surface->window))
|
||||
return;
|
||||
if (meta_xwayland_is_xwayland_surface (constraint->surface))
|
||||
{
|
||||
MetaDisplay *display = meta_get_display ();
|
||||
|
||||
/*
|
||||
* We need to handle Xwayland surfaces differently in order to allow
|
||||
* Xwayland to be able to lock the pointer. For example, we cannot require
|
||||
* the locked window to "appear focused" because the surface Xwayland
|
||||
* locks might not be able to appear focused (for example it may be a
|
||||
* override redirect window).
|
||||
*
|
||||
* Since we don't have any way to know what focused window an override
|
||||
* redirect is associated with, nor have a way to know if the override
|
||||
* redirect window even shares the same connection as a focused window,
|
||||
* we simply can only really restrict it to enable the lock if any
|
||||
* Xwayland window appears focused.
|
||||
*/
|
||||
|
||||
if (display->focus_window &&
|
||||
display->focus_window->client_type != META_WINDOW_CLIENT_TYPE_X11)
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!meta_window_appears_focused (constraint->surface->window))
|
||||
return;
|
||||
}
|
||||
|
||||
meta_wayland_pointer_get_relative_coordinates (constraint->seat->pointer,
|
||||
constraint->surface,
|
||||
|
Loading…
Reference in New Issue
Block a user