Author: Michael Forney <email@example.com>
Date: Thu, 31 Jul 2014 20:00:38 -0700
keyboard: Ignore unpaired key release events
If we see a release for a key we didn't know was pressed, it is because
the key was pressed when we opened the device. These are safe to ignore
because our internal state of the keyboard considered them unpressed.
This fixes a crash when the swc VT is switched to from a text VT, due to
accidently handling a key release like a key press.
1 file changed, 4 insertions(+), 0 deletions(-)
diff --git a/libswc/keyboard.c b/libswc/keyboard.c
@@ -253,6 +253,10 @@ void keyboard_handle_key(struct keyboard * keyboard, uint32_t time,
+ /* If we get a unpaired release event, just ignore it. */
+ if (state == WL_KEYBOARD_KEY_STATE_RELEASED)
key = wl_array_add(&keyboard->keys, sizeof *key);