From a4bd36071e8540719593bac2d6fbf3f1d19501d8 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Mon, 7 Apr 2014 13:50:11 +0200 Subject: [PATCH] touchpad: Ignore non left clicks on clickpads We should never get any non left button events on clickpads, but if we do these might confuse our state, so complain about it and ignore these. Signed-off-by: Hans de Goede Reviewed-by: Peter Hutterer --- src/evdev-mt-touchpad-buttons.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c index a124e126..c65cd8a3 100644 --- a/src/evdev-mt-touchpad-buttons.c +++ b/src/evdev-mt-touchpad-buttons.c @@ -367,6 +367,14 @@ tp_process_button(struct tp_dispatch *tp, uint32_t time) { uint32_t mask = 1 << (e->code - BTN_LEFT); + + /* Ignore other buttons on clickpads */ + if (tp->buttons.is_clickpad && e->code != BTN_LEFT) { + log_bug("received %s button event on a clickpad (kernel bug?)\n", + libevdev_event_code_get_name(EV_KEY, e->code)); + return 0; + } + if (e->value) { tp->buttons.state |= mask; tp->queued |= TOUCHPAD_EVENT_BUTTON_PRESS;