xwayland: Allow grabs based on apparent fullscreen

Closed Olivier Fourdan requested to merge ofourdan/mutter:grab-xwayland-legacy-games into main

Many legacy games will map a window, issue a grab keyboard and do an XRandR resolution change to match their window.

Under Wayland/Xwayland, that translates as a xwayland keyboard grab request followed by a viewporter requtest (to match the XRandR resolution).

By default, mutter/gnome-shell will not grant keyboard grab request unless the client is whitelisted (using "xwayland-grab-access-rules"), and even less let an override-redirect window have a keyboard focus lock ("xwayland-allow-grabs").

That means that those legacy games will not work out of the box in Xwayland, unless the user changes the default settings to explicitly grant keyboard grabs for those games.

To make things more user friendly with legacy games out of the box, add a special case where we allow surfaces appearing as fullscreen to issue the grabs.

As the grab can occur while the XRAndr emulation is pending, we also listen to the pending state and recheck for the grab when the pending state is applied.


Edited by Florian Müllner

Merge request reports