GNOME Bugzilla – Bug 771859
wayland: Some more Xwayland pointer constraint fixes
Last modified: 2016-10-13 05:03:53 UTC
These patches fixes the following issue: * Pointer warping via Xwayland done by wine should now work. Needs yet to be published Xwayland patches though. * Minecraft should no longer get stuck in click means window resize issues happening for example when going from fullscreen to windowed mode.
Created attachment 336134 [details] [review] wayland/pointer-constraints: Disable or remove when grab is cancelled When the grab is cancelled, for example because of an Alt-tab, VT switch etc, disable or remove (depending on the constraint type) the constraint. This avoids a re-entry issue when the focus is returned and the focus listener tries to re-enable a disabled constraint.
Created attachment 336135 [details] [review] wayland/pointer-constraints: Unify requirements for enablement Put the conditions for enabling a pointer constraint in a helper function, and use that in both maybe_enable() and maybe_remove(). The constraint region checking is still only done in maybe_enable() however. This changes the conditions for maybe disabling the constraint on focus change and other trigger points, namely it makes constraints by Xwayland not disable when they shouldn't due to the constraining window being an override-redirect window.
Created attachment 336136 [details] [review] wayland/pointer-constraints: Don't include window frame in region When Xwayland confines, the surface dimensions will include the server side window manager decorations. We don't want the decorations to be included in the constraint region so intersect the calculated input region with the parts of the buffer rect that is not part of the window frame.
Comment on attachment 336134 [details] [review] wayland/pointer-constraints: Disable or remove when grab is cancelled LGTM. As a matter of personal taste, I'd like "deactivate" more than "remove_or_disable". I have the feeling that internal API is growing too verbose here :).
Comment on attachment 336135 [details] [review] wayland/pointer-constraints: Unify requirements for enablement Makes sense, should we maybe add comments in the places where we are loosening restrictions for xwayland? although I guess boils down to the callers of this function.
Comment on attachment 336136 [details] [review] wayland/pointer-constraints: Don't include window frame in region Looks good, I guess the "x11" check happens implicitly as window->frame != NULL, maybe do it explicitly so it's clearer?
Comment on attachment 336134 [details] [review] wayland/pointer-constraints: Disable or remove when grab is cancelled I missed that there's no addition of the cancel method in the grab vtable, nor callers of this method, is this perhaps in another bug?
Comment on attachment 336134 [details] [review] wayland/pointer-constraints: Disable or remove when grab is cancelled Please ignore me, I see it's already in master.
Pushed with the rename as suggested, and an extra g_assert (is-wayland-surface) in the frame intersection path to make it obvious this is about Xwayland. I didn't add any extra documentation about Xwayland related rules, since there already is a comment explaining that. Attachment 336134 [details] pushed as 7ae4b28 - wayland/pointer-constraints: Disable or remove when grab is cancelled Attachment 336135 [details] pushed as 6cc8450 - wayland/pointer-constraints: Unify requirements for enablement Attachment 336136 [details] pushed as 6480a7e - wayland/pointer-constraints: Don't include window frame in region