[PATCH libinput 4/6] touchpad: change clickfinger check distance function to a bool

Peter Hutterer peter.hutterer at who-t.net
Tue Jul 19 00:49:27 UTC 2016


And rename to make it more obvious what the return value will mean.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/evdev-mt-touchpad-buttons.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/evdev-mt-touchpad-buttons.c b/src/evdev-mt-touchpad-buttons.c
index 95603f9..2fb4832 100644
--- a/src/evdev-mt-touchpad-buttons.c
+++ b/src/evdev-mt-touchpad-buttons.c
@@ -928,13 +928,13 @@ tp_post_physical_buttons(struct tp_dispatch *tp, uint64_t time)
 	return 0;
 }
 
-static inline int
-tp_check_clickfinger_distance(struct tp_dispatch *tp,
-			      struct tp_touch *t1,
-			      struct tp_touch *t2)
+static inline bool
+tp_clickfinger_within_distance(struct tp_dispatch *tp,
+			       struct tp_touch *t1,
+			       struct tp_touch *t2)
 {
 	double x, y;
-	int within_distance = 0;
+	bool within_distance = false;
 	int xres, yres;
 	int bottom_threshold;
 
@@ -958,7 +958,7 @@ tp_check_clickfinger_distance(struct tp_dispatch *tp,
 	if (x > 40 || y > 30)
 		goto out;
 
-	within_distance = 1;
+	within_distance = true;
 
 	/* if y spread is <= 20mm, they're definitely together. */
 	if (y <= 20)
@@ -1016,7 +1016,7 @@ tp_clickfinger_set_button(struct tp_dispatch *tp)
 		goto out;
 	}
 
-	if (tp_check_clickfinger_distance(tp, first, second))
+	if (tp_clickfinger_within_distance(tp, first, second))
 		nfingers = 2;
 	else
 		nfingers = 1;
-- 
2.7.4



More information about the wayland-devel mailing list