From: Hans de Goede Date: Tue, 16 Sep 2014 14:22:41 +0000 (+0200) Subject: touchpad: When disabling a TOPBUTTONPAD, leave the top buttons enabled X-Git-Tag: 0.7.0~122 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b264c52a8b69dc23774c37f7628eb8f94bc8ffed;p=platform%2Fupstream%2Flibinput.git touchpad: When disabling a TOPBUTTONPAD, leave the top buttons enabled On a TOPBUTTONPAD, we can't disable the touchpad altogether - the trackstick relies on the touchpad's top software buttons. Signed-off-by: Hans de Goede Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c index b6aee24d..fae6a13e 100644 --- a/src/evdev-mt-touchpad-buttons.c +++ b/src/evdev-mt-touchpad-buttons.c @@ -697,6 +697,10 @@ tp_notify_softbutton(struct tp_dispatch *tp, return; } + /* Ignore button events not for the trackpoint while suspended */ + if (tp->device->suspended) + return; + evdev_pointer_notify_button(tp->device, time, button, state); } diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index 522f1113..70a4e40f 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -523,6 +523,12 @@ tp_post_events(struct tp_dispatch *tp, uint64_t time) double dx, dy; int consumed = 0; + /* Only post (top) button events while suspended */ + if (tp->device->suspended) { + tp_post_button_events(tp, time); + return; + } + consumed |= tp_tap_handle_state(tp, time); consumed |= tp_post_button_events(tp, time); @@ -632,13 +638,28 @@ static void tp_suspend(struct tp_dispatch *tp, struct evdev_device *device) { tp_clear_state(tp, device); - evdev_device_suspend(device); + + /* On devices with top softwarebuttons we don't actually suspend the + * device, to keep the "trackpoint" buttons working. tp_post_events() + * will only send events for the trackpoint while suspended. + */ + if (tp->buttons.has_topbuttons) { + evdev_notify_suspended_device(device); + } else { + evdev_device_suspend(device); + } } static void tp_resume(struct tp_dispatch *tp, struct evdev_device *device) { - evdev_device_resume(device); + if (tp->buttons.has_topbuttons) { + /* tap state-machine is offline while suspended, reset state */ + tp_clear_state(tp, device); + evdev_notify_resumed_device(device); + } else { + evdev_device_resume(device); + } } static void