From ee58c4e23c1a5d317631cb07e94eb58e8e2ea2ba Mon Sep 17 00:00:00 2001 From: "S.F" Date: Mon, 4 Dec 2017 18:30:39 +0100 Subject: [PATCH 1/1] FIX 104030: hacky way of detecting modifiers prior to other keys. --- src/evdev-fallback.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/evdev-fallback.c b/src/evdev-fallback.c index 52a3bde1..b81e0b12 100644 --- a/src/evdev-fallback.c +++ b/src/evdev-fallback.c @@ -832,6 +832,22 @@ fallback_handle_state(struct fallback_dispatch *dispatch, /* Buttons and keys */ if (dispatch->pending_event & EVDEV_KEY) { + + // handle modifiers first. + // hacky fix for Bug [104030](https://bugs.freedesktop.org/show_bug.cgi?id=104030) + // @TODO: Should handle modifiers press prior to other keys, and release after them + unsigned int modifier_codes[] = { KEY_LEFTSHIFT, KEY_RIGHTSHIFT, KEY_LEFTCTRL, KEY_RIGHTCTRL, KEY_LEFTALT, KEY_RIGHTALT, KEY_LEFTMETA, KEY_RIGHTMETA, KEY_COMPOSE }; + for (unsigned int mod = 0; mod < sizeof(modifier_codes)/sizeof(unsigned int); ++mod) { + unsigned int code = modifier_codes[mod]; + if (!hw_key_has_changed(dispatch, code)) + continue; + bool new_state = hw_is_key_down(dispatch, code); + fallback_keyboard_notify_key( dispatch, device, time, code, + new_state ? LIBINPUT_KEY_STATE_PRESSED : LIBINPUT_KEY_STATE_RELEASED); + // evdev_log_error(device, "Modifier code %d handled first.\n", code); + } + + bool want_debounce = false; for (unsigned int code = 0; code <= KEY_MAX; code++) { bool new_state; -- 2.15.1