[PATCH 1/2] Introduce keyboard grabbing protocol for Xwayland

Olivier Fourdan ofourdan at redhat.com
Tue Apr 4 10:11:53 UTC 2017


> I cannot see why this api cannot be correctly emulated using some
> wayland api that normal wayland clients can also use. Allowing X
> clients to have more rights and abilities than Wayland clients seems
> horrendously wrong.
> The X emulation does not have to do 1:1 translation of X11 calls into
> Wayland requests.
> In this case I would think an attempt to grab the keyboard would
> instead send an "activate" or "raise" or "needs attention" (that seems
> to be a popular name) request. The X client would then get keystrokes
> (possibly after some more user interaction such as clicking or of
> de-iconizing the client). Because the X11 app may not expect to lose
> the focus until the grab is lost, the X emulator would also re-request
> the focus if it is lost at any time it could, such as on mouse clicks
> or mouse enter events.
> I suppose the plan is that this does not actually do something that
> Wayland clients can't do, but in that case you are just moving "how to
> replicate what X does" from the X emulator into the compositor. That
> still seems wrong, since compositors may differ, making it impossible
> for the client to be rewritten to not use the X emulator but still
> have the same behavior. I would much rather see this done by the X
> emulator.

Again, even though the protocol does not specifically target override-redirect windows, those are the main problem here, sensible X11 window managers do not "manage" those, so setting EWMH properties such as "activate" or "demand attention" will be ignored by most X11 window managers on O-R windows.

I have attached a simple code sample to demonstrate this - And this is not an hypothetical issue, this is https://bugs.freedesktop.org/show_bug.cgi?id=96547 - This works fine on X11 thanks to the Xserver issuing the requested grab, it cannot work on Xwayland because Wayland has no similar mechanism.

But if you can solve this issue reliably for all X11 window managers/Wayland compositors in Xwayland alone without the help of any additional protocol, best would be to send your patches for Xwayland to xorg-devel.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: grab.c
Type: text/x-c++src
Size: 3760 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/wayland-devel/attachments/20170404/a642c970/attachment-0001.c>

More information about the wayland-devel mailing list