After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 771050 - wayland: Patches needed for Xwayland pointer warp emulation
wayland: Patches needed for Xwayland pointer warp emulation
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: wayland
unspecified
Other All
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2016-09-08 11:10 UTC by Jonas Ådahl
Modified: 2016-09-09 03:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
wayland: Make seat devices GObjects (42.07 KB, patch)
2016-09-08 11:10 UTC, Jonas Ådahl
committed Details | Review
xwayland: Add 'window-associated' signal to role (2.21 KB, patch)
2016-09-08 11:10 UTC, Jonas Ådahl
committed Details | Review
MetaWaylandSurface: Move destroy signal even earlier (2.49 KB, patch)
2016-09-08 11:10 UTC, Jonas Ådahl
committed Details | Review
MetaWaylandPointerConstraints: Handle delayed window surface association (6.53 KB, patch)
2016-09-08 11:11 UTC, Jonas Ådahl
committed Details | Review
MetaWaylandPointer: Add 'focus-surface-changed' signal (1.85 KB, patch)
2016-09-08 11:11 UTC, Jonas Ådahl
committed Details | Review
MetaWaylandPointerConstraints: Require pointer focus to enable (1.15 KB, patch)
2016-09-08 11:11 UTC, Jonas Ådahl
committed Details | Review
MetaWaylandPointerConstraints: Relax enable requirements for Xwayland (2.72 KB, patch)
2016-09-08 11:11 UTC, Jonas Ådahl
committed Details | Review
wayland/pointer-constraints: Maybe constrain on pointer focus change (3.18 KB, patch)
2016-09-08 11:11 UTC, Jonas Ådahl
committed Details | Review

Description Jonas Ådahl 2016-09-08 11:10:45 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.
Comment 1 Jonas Ådahl 2016-09-08 11:10:50 UTC
Created attachment 335085 [details] [review]
wayland: Make seat devices GObjects

This will make it possible to add signals and other GObject features.
Comment 2 Jonas Ådahl 2016-09-08 11:10:54 UTC
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.
Comment 3 Jonas Ådahl 2016-09-08 11:10:59 UTC
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.
Comment 4 Jonas Ådahl 2016-09-08 11:11:05 UTC
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.
Comment 5 Jonas Ådahl 2016-09-08 11:11:10 UTC
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.
Comment 6 Jonas Ådahl 2016-09-08 11:11:14 UTC
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.
Comment 7 Jonas Ådahl 2016-09-08 11:11:19 UTC
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.
Comment 8 Jonas Ådahl 2016-09-08 11:11:24 UTC
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.
Comment 9 Rui Matos 2016-09-08 17:12:15 UTC
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" ?
Comment 10 Rui Matos 2016-09-08 17:12:29 UTC
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/ ?
Comment 11 Rui Matos 2016-09-08 17:13:45 UTC
Review of attachment 335090 [details] [review]:

ok
Comment 12 Rui Matos 2016-09-08 17:13:56 UTC
Review of attachment 335089 [details] [review]:

sure
Comment 13 Rui Matos 2016-09-08 17:14:31 UTC
Review of attachment 335088 [details] [review]:

looks good
Comment 14 Rui Matos 2016-09-08 17:15:13 UTC
Review of attachment 335087 [details] [review]:

ok
Comment 15 Rui Matos 2016-09-08 17:15:38 UTC
Review of attachment 335086 [details] [review]:

++
Comment 16 Rui Matos 2016-09-08 17:16:05 UTC
Review of attachment 335085 [details] [review]:

cool
Comment 17 Jonas Ådahl 2016-09-09 03:12:05 UTC
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