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 <hdegoede@redhat.com>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Hans de Goede 2014-09-16 16:22:41 +02:00 committed by Peter Hutterer
parent 0f434cf73b
commit b264c52a8b
2 changed files with 27 additions and 2 deletions

View 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);
}

View 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