touchpad: when clearing the touchpad state, release fake touches too
authorPeter Hutterer <peter.hutterer@who-t.net>
Thu, 30 Apr 2015 04:48:42 +0000 (14:48 +1000)
committerPeter Hutterer <peter.hutterer@who-t.net>
Mon, 4 May 2015 21:44:18 +0000 (07:44 +1000)
Causes an error message in the device_disable_release_tap_n_drag test. When
the touchpad is suspended, all touches are ended in tp_clear_state. Since the
hovering support was added, this returns the touches to TOUCH_HOVERING, a
subsequent tp_handle_state() will turn them back into TOUCH_BEGIN based on
BTN_TOUCH and BTN_TOOL_FINGER still being down.

Clear the fake touch buttons as well after ending the touches, this way the
touch points are reset to TOUCH_NONE as intended.
Once we do that we don't need to manually change the tap finger count when
releasing taps, we can just let the count reset naturally.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
src/evdev-mt-touchpad.c

index d5ce88036b34c3ccae92f08bd08b2e23a3e88ee6..e017559d52633a3f35df03b55ea7b501ee939a81 100644 (file)
@@ -749,6 +749,12 @@ tp_destroy(struct evdev_dispatch *dispatch)
        free(tp);
 }
 
+static void
+tp_release_fake_touches(struct tp_dispatch *tp)
+{
+       tp->fake_touches = 0;
+}
+
 static void
 tp_clear_state(struct tp_dispatch *tp)
 {
@@ -772,6 +778,7 @@ tp_clear_state(struct tp_dispatch *tp)
        tp_for_each_touch(tp, t) {
                tp_end_sequence(tp, t, now);
        }
+       tp_release_fake_touches(tp);
 
        tp_handle_state(tp, now);
 }