[PATCH libinput 4/7] touchpad: move updating of buttons.old_state to the process function

Peter Hutterer peter.hutterer at who-t.net
Wed Sep 17 21:20:20 PDT 2014


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.hutterer at 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



More information about the wayland-devel mailing list