touchpad: Ignore non left clicks on clickpads
authorHans de Goede <hdegoede@redhat.com>
Mon, 7 Apr 2014 11:50:11 +0000 (13:50 +0200)
committerHans de Goede <hdegoede@redhat.com>
Thu, 22 May 2014 12:51:41 +0000 (14:51 +0200)
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 <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
src/evdev-mt-touchpad-buttons.c

index a124e1263ae1b75b270f4fcaae49a99a42d00b86..c65cd8a3b3ad31f92c3638a09a242d0dbbb7d7df 100644 (file)
@@ -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;