Xwayland grabs optional focus lock
With current code in mutter, X11 grabs can be emulated (using the Xwayland grab protocol) but the feature is disabled by default.
To emulate X11 grabs, mutter as a Wayland compositor would disable its own keyboard shortcuts and when the X11 window is an override redirect window (which never receives focus), it also forces keyboard focus into that X11 O-R window so that all keyboard events are routed to the window, just like an X11 server would.
This is to allow X11 clients using O-R window with grabs to work under Xwayland, see https://bugs.freedesktop.org/show_bug.cgi?id=96547
Because this can be problematic, to say the least (potentially going against the user's will to focus another window when teh X11 grab is on an override redirect window), X11 grabs emulation is disabled by default in mutter (the gsettings “xwayland-allow-grabs” is
false by default).
But that's a bit of a “all-or-nothing” approach which prevents applications that would legitimately grab the keyboard under X11 (like virtual machine viewers) to work by default.
@jwrdegoede suggested (in a private email thread) to decorrelate the two behaviours, so that we could enable X11 grabs in mutter on Wayland by default (so that !569 (closed) would be sufficient to have working grabs in Xwayland) but still not allow for the keyboard focus locks with O-R window which would become a separate option kept disabled by default.
The following Merge request is to implement @jwrdegoede's suggestion and let people discuss its acceptability.