swc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/swc
Log | Files | Refs | README | LICENSE

commit 590c6d735a5288a855d604264855b89da87b2ddb
parent a9233e93623694396ee63d1959c83afb470406b1
Author: Michael Forney <mforney@mforney.org>
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.

Diffstat:
Mlibswc/keyboard.c | 4++++
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) + return; + key = wl_array_add(&keyboard->keys, sizeof *key); if (!key)