[PATCH libinput 1/6] test: use the touchpad size for the 7mm movement

Peter Hutterer peter.hutterer at who-t.net
Mon Aug 17 16:20:29 PDT 2015


Makes the code more straightforward, and we now require the devices to
have a height/width anyway.

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 test/touchpad.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/test/touchpad.c b/test/touchpad.c
index bbdbc21..ef262f9 100644
--- a/test/touchpad.c
+++ b/test/touchpad.c
@@ -150,20 +150,17 @@ START_TEST(touchpad_2fg_scroll_slow_distance)
 	struct libinput *li = dev->libinput;
 	struct libinput_event *event;
 	struct libinput_event_pointer *ptrev;
-	const struct input_absinfo *y;
-	double y_move;
+	double width, height;
+	double y_move = 100;
 
 	if (!litest_has_2fg_scroll(dev))
 		return;
 
 	/* We want to move > 5 mm. */
-	y = libevdev_get_abs_info(dev->evdev, ABS_Y);
-	if (y->resolution) {
-		y_move = 7.0 * y->resolution /
-					(y->maximum - y->minimum) * 100;
-	} else {
-		y_move = 20.0;
-	}
+	ck_assert_int_eq(libinput_device_get_size(dev->libinput_device,
+						  &width,
+						  &height), 0);
+	y_move = 100.0/height * 7;
 
 	litest_enable_2fg_scroll(dev);
 	litest_drain_events(li);
-- 
2.4.3



More information about the wayland-devel mailing list