[mutter] MetaWaylandPointerConstraints: Relax enable requirements for Xwayland
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] MetaWaylandPointerConstraints: Relax enable requirements for Xwayland
- Date: Fri, 9 Sep 2016 03:11:03 +0000 (UTC)
commit 33ba06504b23d5144b7cf5350781e3e3e608a263
Author: Jonas Ådahl <jadahl gmail com>
Date: Fri Apr 1 21:13:10 2016 +0800
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
src/wayland/meta-wayland-pointer-constraints.c | 29 ++++++++++++++++++++++-
1 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/src/wayland/meta-wayland-pointer-constraints.c b/src/wayland/meta-wayland-pointer-constraints.c
index 88a3b56..4930723 100644
--- a/src/wayland/meta-wayland-pointer-constraints.c
+++ b/src/wayland/meta-wayland-pointer-constraints.c
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]