From: Hans de Goede Date: Tue, 16 Sep 2014 14:22:40 +0000 (+0200) Subject: touchpad: Put state unrolling code in a tp_clear_state() helper function X-Git-Tag: 0.7.0~123 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0f434cf73b13feda70b0741a653df6f0225fb904;p=platform%2Fupstream%2Flibinput.git touchpad: Put state unrolling code in a tp_clear_state() helper function For touchpads with top softbuttons we don't want to fully disable the touchpad on suspend, as we want to keep the top softbuttons working for the trackpoint. So in the suspended state some of the touchpad sub-statemachines will keep running (e.g. buttons) where others (e.g. tap) will not. This means that we will need to clear the touchpad state on resume too, to avoid things being in an inconsistent state after resume. This commit factors out the state clearing code into a helper functions, so that the same code can be used on resume. No functional changes. Signed-off-by: Hans de Goede Reviewed-by: Peter Hutterer Signed-off-by: Peter Hutterer --- diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c index bed6256..522f111 100644 --- a/src/evdev-mt-touchpad.c +++ b/src/evdev-mt-touchpad.c @@ -602,7 +602,7 @@ tp_destroy(struct evdev_dispatch *dispatch) } static void -tp_suspend(struct tp_dispatch *tp, struct evdev_device *device) +tp_clear_state(struct tp_dispatch *tp, struct evdev_device *device) { uint64_t now = libinput_now(tp->device->base.seat->libinput); struct tp_touch *t; @@ -626,7 +626,12 @@ tp_suspend(struct tp_dispatch *tp, struct evdev_device *device) } tp_handle_state(tp, now); +} +static void +tp_suspend(struct tp_dispatch *tp, struct evdev_device *device) +{ + tp_clear_state(tp, device); evdev_device_suspend(device); }