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

Quentin Glidic sardemff7+wayland at sardemff7.net
Sun Apr 2 01:22:31 UTC 2017


On 4/2/17 2:57 AM, Peter Hutterer wrote:
> woohoo, grabs. My favourite topic! ;)
> On Wed, Mar 22, 2017 at 05:27:22PM +0100, Olivier Fourdan wrote:
 >> [snip]
>> +  <description summary="Protocol for grabbing the keyboard from Xwayland">
>> +	This protocol specifies a way for Xwayland to request all keyboard
>> +	events to be forwarded to a surface even when the surface does not
>> +	have keyboard focus.
>> +
>> +	Unlike the X11 protocol, Wayland doesn't have the notion of
>> +	active grab on the keyboard.
>> +
>> +	When an	X11 client acquires an active grab on the keyboard, all
>> +	key events are reported only to the grabbing X11 client.
>> +	When running in Xwayland, X11 applications may acquire an active
>> +	grab but that cannot be translated to the Wayland compositor who
>> +	may set the input focus to some other surface, thus breaking the
>> +	X11 client assumption that all key events are reported.
>> +
>> +	When an X11 client requests a keyboard grab, the Wayland compositor
>> +	may either inform or ask the user for the right to forward all key
>> +	events to the given client surface.
> 
> this is confusing :) paragraph 3 talks aobut what's not working and
> paragraph 4 about what this protocol should fix. How about something like:
> 
>          This protocol is application-specific to meet the needs of the X11
>          protocol through Xwayland. It provides a way for XWayland to request
>          all keyboard events to be forwarded to a surface even when the
>          surface does not have keyboard focus.
> 
>          In the X11 protocol, a client may request an "active grab" on the
>          keyboard. On success, all key events are reported only to the
>          grabbing X11 client. For details, see XGrabKeyboard(3).
> 
>          The core Wayland protocol does not have a notion of an active
>          keyboard grab. When running in Xwayland, X11 applications may
>          acquire an active grab inside XWayland but that cannot be translated
>          to the Wayland compositor who may set the input focus to some other
>          surface. In doing so, it breaks the X11 client assumption that all
>          key events are reported to the grabbing client.
> 
> 	This protocol specifies a way for Xwayland to request all keyboard
>          be directed to the given surface. The protocol does not guarantee
>          that the compositor will honor this request and it does not
>          prescribe user interfaces on how to handle the respond. For example,
>          a compositor may inform the user that all key events are now
>          forwarded to the given client surface, or it may ask the user for
>          permission to do so.
> 
>          Warning! Things may go boom... etc. etc.

I think it may be worth it to add a little safety net:
“Compositors are required to restrict this interface to Xwayland alone, 
and raise a protocol error for native Wayland clients.”

Cheers,

-- 

Quentin “Sardem FF7” Glidic


More information about the xorg-devel mailing list