protocol: Add keymap version negotiation to wl_keyboard

Enable to negotiate the keymap format in `wl_keyboard`, in order to
introduce keymap formats which are backward-incompatible.

The keymap format negotiation is made mandatory from this new version of
the `wl_keyboard` interface.

- Added the `wl_keyboard::set_supported_keymap_formats` request
- Added the `wl_keyboard::error` enum to handle error triggered by the
  previous request.
- Added `xkb_v2` to the `wl_keyboard::keymap_format` enum, to denote
  the keymap format v2 provided by libxkbcommon.

Signed-off-by: Pierre Le Marre <dev@wismill.eu>
This commit is contained in:
Pierre Le Marre 2025-11-28 10:28:58 +01:00
parent bbb5fa66a7
commit 4380e5ddb9
No known key found for this signature in database
GPG key ID: 3BFB00E5C59E818E

View file

@ -1906,7 +1906,7 @@
</event>
</interface>
<interface name="wl_seat" version="10">
<interface name="wl_seat" version="11">
<description summary="group of input devices">
A seat is a group of keyboards, pointer and touch devices. This
object is published as a global during start up, or when such a
@ -2040,7 +2040,7 @@
</interface>
<interface name="wl_pointer" version="10">
<interface name="wl_pointer" version="11">
<description summary="pointer input device">
The wl_pointer interface represents one or more input devices,
such as mice, which control the pointer location and pointer_focus
@ -2453,7 +2453,7 @@
</event>
</interface>
<interface name="wl_keyboard" version="10">
<interface name="wl_keyboard" version="11">
<description summary="keyboard input device">
The wl_keyboard interface represents one or more keyboards
associated with a seat.
@ -2467,6 +2467,18 @@
By default, the active surface is null, the keys currently logically down
are empty, the active modifiers and the active group are 0.
Since version 11, clients must first negotiate the keymap format in order
to receive any keyboard event:
1. Client sends a set_supported_keymap_formats request,
2. Server responds with either:
- a keymap event, with the corresponding keymap_format being supported
by both the server and the client; the server is advised to use the
format with most features.
- a no_supported_keymap_format error if no common supported format is
found.
</description>
<enum name="keymap_format">
@ -2477,6 +2489,8 @@
<entry name="no_keymap" value="0"
summary="no keymap; client must understand how to interpret the raw keycode"/>
<entry name="xkb_v1" value="1"
summary="libxkbcommon and X11 compatible, null-terminated string; to determine the xkb keycode, clients must add 8 to the key event keycode"/>
<entry name="xkb_v2" value="2" since="11"
summary="libxkbcommon compatible, null-terminated string; to determine the xkb keycode, clients must add 8 to the key event keycode"/>
</enum>
@ -2632,9 +2646,32 @@
<arg name="delay" type="int"
summary="delay in milliseconds since key down until repeating starts"/>
</event>
<!-- Version 11 additions -->
<request name="set_supported_keymap_formats" since="11">
<description summary="set the keymap formats supported by the client">
Inform the server of the keymap formats supported by the client, in
ascending order.
If none of the formats is supported by the server, then a
no_supported_keymap_format error is triggered.
Otherwise the server selects one of the provided format that it supports
itself and may start to send keyboard events. It is advised, but not
mandatory, to select the format with most features.
</description>
<arg name="formats" type="array"
summary="A list of keymap_format values, in ascending order"/>
</request>
<enum name="error" since="11">
<entry name="no_supported_keymap_format" value="0" since="11"
summary="none of the keymap formats provided by the client is supported"/>
</enum>
</interface>
<interface name="wl_touch" version="10">
<interface name="wl_touch" version="11">
<description summary="touchscreen input device">
The wl_touch interface represents a touchscreen
associated with a seat.