touchpad: When disabling a TOPBUTTONPAD, leave the top buttons enabled
authorHans de Goede <hdegoede@redhat.com>
Tue, 16 Sep 2014 14:22:41 +0000 (16:22 +0200)
committerPeter Hutterer <peter.hutterer@who-t.net>
Thu, 18 Sep 2014 22:20:04 +0000 (08:20 +1000)
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 <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
src/evdev-mt-touchpad-buttons.c
src/evdev-mt-touchpad.c

index b6aee24..fae6a13 100644 (file)
@@ -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);
 }
 
index 522f111..70a4e40 100644 (file)
@@ -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