[PATCH] window: Use constant keycode offset of 8

Daniel Stone daniel at fooishbar.org
Thu Feb 16 04:48:00 PST 2012


The X11 compositor currently posts its key presses as keycode - 8; this
is due to X11 having a historical minimum keycode of 8, whereas evdev is
numbered starting from 1.  So while the KEY_* constants begin with
KEY_ESC at 1, the corresponding keycode in both X11 and the XKB keymaps
is 9.

window, on the other hand, was relying on xkb->min_key_code being 8 to
translate its keycodes back to useful values in the XKB 'evdev' keycode
map.  min_key_code may not always be 8, for restricted subsets of the
keycode map.

Perhaps not the best solution, but at least consistent.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>
---
 clients/window.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/clients/window.c b/clients/window.c
index c0cd5d3..1d70540 100644
--- a/clients/window.c
+++ b/clients/window.c
@@ -1550,7 +1550,7 @@ input_handle_key(void *data, struct wl_input_device *input_device,
 	struct display *d = input->display;
 	uint32_t code, sym, level;
 
-	code = key + d->xkb->min_key_code;
+	code = key + 8;
 	if (!window || window->keyboard_device != input)
 		return;
 
-- 
1.7.9



More information about the wayland-devel mailing list