commit 590c6d7

Michael Forney  ·  2014-08-01 03:00:38 +0000 UTC
parent a9233e9
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 files changed,  +4, -0
+4, -0
 1@@ -253,6 +253,10 @@ void keyboard_handle_key(struct keyboard * keyboard, uint32_t time,
 2         }
 3     }
 4 
 5+    /* If we get a unpaired release event, just ignore it. */
 6+    if (state == WL_KEYBOARD_KEY_STATE_RELEASED)
 7+        return;
 8+
 9     key = wl_array_add(&keyboard->keys, sizeof *key);
10 
11     if (!key)