GNOME Bugzilla – Bug 771050
wayland: Patches needed for Xwayland pointer warp emulation
Last modified: 2016-09-09 03:12:37 UTC
We can't really use the same semantics for Wayland clients and Xwayland, since Xwayland has no way to "do the right thing". These patches loosens up the restrictions for enabling a constraint when its Xwayland that requests it. See "MetaWaylandPointerConstraints: Relax enable requirements for Xwayland" for details.
Created attachment 335085 [details] [review] wayland: Make seat devices GObjects This will make it possible to add signals and other GObject features.
Created attachment 335086 [details] [review] xwayland: Add 'window-associated' signal to role When the Xwayland wl_surface is created, it may not yet be possible to associate it with the corresponding X11 Window. Add a signal to the Xwayland role to communicate with any interested parties.
Created attachment 335087 [details] [review] MetaWaylandSurface: Move destroy signal even earlier Move the MetaWaylandSurface::destroy signal before starting the actual destruction, in wl_surface_destructor, so that all fields (e.g. surface role) are intact when the listeners are invoked.
Created attachment 335088 [details] [review] MetaWaylandPointerConstraints: Handle delayed window surface association For Xwayland, a newly created wl_surface and X11 Window pair may not be immediately associated, but Xwayland may still request a pointer constraint on some of its wl_surface's. Handle the situation by postponing maybe enabling the constraint until the window and surface has been associated.
Created attachment 335089 [details] [review] MetaWaylandPointer: Add 'focus-surface-changed' signal Add a signal that is emitted when the pointer focus surface of the pointer device changes. This will later be used by the pointer constraints to maybe enable pointer constraints when a surface receives pointer focus.
Created attachment 335090 [details] [review] MetaWaylandPointerConstraints: Require pointer focus to enable Require pointer focus to enable, otherwise we can't guarantee it has entered the surface, as the focus may have been given to a subsurface, override-redirect or other sub window covering the surface that was requested to have o pointer constraint.
Created attachment 335091 [details] [review] 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.
Created attachment 335092 [details] [review] wayland/pointer-constraints: Maybe constrain on pointer focus change Since Xwayland surface constraints might need to enable not only because the constrained window appears focused, add a pointer focus listener and try constrain whenever the pointer focus changes. It's still required that a Xwayland window appears focused to change.
Review of attachment 335092 [details] [review]: > It's still required that a Xwayland window appears focused to change. Sounds confusing given the previous patch. Maybe "It's still required that a Xwayland window is focused to activate" ?
Review of attachment 335091 [details] [review]: makes sense ::: src/wayland/meta-wayland-pointer-constraints.c @@ +464,3 @@ + * 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 rely restrict it to enable the lock if any Xwayland s/rely/really/ ?
Review of attachment 335090 [details] [review]: ok
Review of attachment 335089 [details] [review]: sure
Review of attachment 335088 [details] [review]: looks good
Review of attachment 335087 [details] [review]: ok
Review of attachment 335086 [details] [review]: ++
Review of attachment 335085 [details] [review]: cool
Attachment 335085 [details] pushed as e5a359a - wayland: Make seat devices GObjects Attachment 335086 [details] pushed as 3a41b0f - xwayland: Add 'window-associated' signal to role Attachment 335087 [details] pushed as fccdd00 - MetaWaylandSurface: Move destroy signal even earlier Attachment 335088 [details] pushed as 262b52d - MetaWaylandPointerConstraints: Handle delayed window surface association Attachment 335089 [details] pushed as e6a20a0 - MetaWaylandPointer: Add 'focus-surface-changed' signal Attachment 335090 [details] pushed as 10c7035 - MetaWaylandPointerConstraints: Require pointer focus to enable Attachment 335091 [details] pushed as 33ba065 - MetaWaylandPointerConstraints: Relax enable requirements for Xwayland Attachment 335092 [details] pushed as abee020 - wayland/pointer-constraints: Maybe constrain on pointer focus change