Update the old_state once we've posted the respective buttons rather than
waiting for post_process to kick in. This allows calling our function multiple
times without double-posting the events.

Signed-off-by: Peter Hutterer <peter.hutte...@who-t.net>
---
 src/evdev-mt-touchpad-buttons.c | 7 +++++++
 src/evdev-mt-touchpad.c         | 1 -
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
index fae6a13..2d4b2b9 100644
--- a/src/evdev-mt-touchpad-buttons.c
+++ b/src/evdev-mt-touchpad-buttons.c
@@ -640,6 +640,9 @@ tp_post_clickfinger_buttons(struct tp_dispatch *tp, 
uint64_t time)
                                            button,
                                            state);
        }
+
+       tp->buttons.old_state = tp->buttons.state;
+
        return 1;
 }
 
@@ -672,6 +675,8 @@ tp_post_physical_buttons(struct tp_dispatch *tp, uint64_t 
time)
                old >>= 1;
        }
 
+       tp->buttons.old_state = tp->buttons.state;
+
        return 0;
 }
 
@@ -775,6 +780,8 @@ tp_post_softbutton_buttons(struct tp_dispatch *tp, uint64_t 
time)
        if (button)
                tp_notify_softbutton(tp, time, button, is_top, state);
 
+       tp->buttons.old_state = tp->buttons.state;
+
        return 1;
 }
 
diff --git a/src/evdev-mt-touchpad.c b/src/evdev-mt-touchpad.c
index 26517b9..f9efc5f 100644
--- a/src/evdev-mt-touchpad.c
+++ b/src/evdev-mt-touchpad.c
@@ -460,7 +460,6 @@ tp_post_process_state(struct tp_dispatch *tp, uint64_t time)
        }
 
        tp->old_nfingers_down = tp->nfingers_down;
-       tp->buttons.old_state = tp->buttons.state;
 
        tp->queued = TOUCHPAD_EVENT_NONE;
 }
-- 
1.9.3

_______________________________________________
wayland-devel mailing list
wayland-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/wayland-devel

Reply via email to