x11: check and document the correct range of device IDs

The actual value is 127, not 255.

https://bugs.freedesktop.org/show_bug.cgi?id=104321

Reported-by: Gatis Paeglis <gatis.paeglis@qt.io>
Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2017-12-18 16:41:21 +02:00
parent b82e3b764e
commit 4fccdee383
2 changed files with 7 additions and 7 deletions

View File

@ -1155,7 +1155,7 @@ xkb_x11_keymap_new_from_device(struct xkb_context *ctx,
return NULL; return NULL;
} }
if (device_id < 0 || device_id > 255) { if (device_id < 0 || device_id > 127) {
log_err_func(ctx, "illegal device ID: %d\n", device_id); log_err_func(ctx, "illegal device ID: %d\n", device_id);
return NULL; return NULL;
} }

View File

@ -64,10 +64,9 @@ extern "C" {
* *
* The XKB extension supports using separate keymaps and states for * The XKB extension supports using separate keymaps and states for
* different keyboard devices. The devices are identified by an integer * different keyboard devices. The devices are identified by an integer
* device ID and are managed by another X11 extension, XInput (or its * device ID and are managed by another X11 extension, XInput. The
* successor, XInput2). The original X11 protocol only had one keyboard * original X11 protocol only had one keyboard device, called the "core
* device, called the "core keyboard", which is still supported as a * keyboard", which is still supported as a "virtual device".
* "virtual device".
* *
* 3. We will use the core keyboard as an example. To get its device ID, * 3. We will use the core keyboard as an example. To get its device ID,
* use either the xcb_xkb_get_device_info() request directly, or the * use either the xcb_xkb_get_device_info() request directly, or the
@ -197,8 +196,9 @@ xkb_x11_get_core_keyboard_device_id(xcb_connection_t *connection);
* @param connection * @param connection
* An XCB connection to the X server. * An XCB connection to the X server.
* @param device_id * @param device_id
* An XInput 1 device ID (in the range 0-255) with input class KEY. * An XInput device ID (in the range 0-127) with input class KEY.
* Passing values outside of this range is an error. * Passing values outside of this range is an error (the XKB protocol
* predates the XInput2 protocol, which first allowed IDs > 127).
* @param flags * @param flags
* Optional flags for the keymap, or 0. * Optional flags for the keymap, or 0.
* *