92 lines
2.7 KiB
Diff
92 lines
2.7 KiB
Diff
From 19c91044e44dd31deaeb638a919c64e9a9182448 Mon Sep 17 00:00:00 2001
|
|
From: Peter Hutterer <peter.hutterer@who-t.net>
|
|
Date: Tue, 5 May 2015 14:17:10 +1000
|
|
Subject: [PATCH xf86-input-libinput] Use the new unaccelerated valuator
|
|
ValuatorMask features
|
|
|
|
SDL Games like openarena rely on relative input that's handled by the DGA code
|
|
in the server. That code casts the driver's input data to int and sends it to
|
|
the client. libinput does pointer acceleration for us, so sending any deltas
|
|
of less than 1 (likely for slow movements) ends up being 0.
|
|
|
|
Use the new ValuatorMask accelerated/unaccelerated values to pass the
|
|
unaccelerated values along, the server can then decide what to do with it.
|
|
|
|
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
|
|
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
|
|
---
|
|
src/libinput.c | 27 ++++++++++++++++++++++++++-
|
|
1 file changed, 26 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/src/libinput.c b/src/libinput.c
|
|
index c8669fc..3cc4426 100644
|
|
--- a/src/libinput.c
|
|
+++ b/src/libinput.c
|
|
@@ -47,6 +47,12 @@
|
|
#define XI86_SERVER_FD 0x20
|
|
#endif
|
|
|
|
+#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) * 1000 + GET_ABI_MINOR(ABI_XINPUT_VERSION) > 21000
|
|
+#define HAVE_VMASK_UNACCEL 1
|
|
+#else
|
|
+#undef HAVE_VMASK_UNACCEL
|
|
+#endif
|
|
+
|
|
#define TOUCHPAD_NUM_AXES 4 /* x, y, hscroll, vscroll */
|
|
#define TOUCH_MAX_SLOTS 15
|
|
#define XORG_KEYCODE_OFFSET 8
|
|
@@ -88,6 +94,7 @@ struct xf86libinput {
|
|
BOOL has_abs;
|
|
|
|
ValuatorMask *valuators;
|
|
+ ValuatorMask *valuators_unaccelerated;
|
|
|
|
struct options {
|
|
BOOL tapping;
|
|
@@ -700,9 +707,21 @@ xf86libinput_handle_motion(InputInfoPtr pInfo, struct libinput_event_pointer *ev
|
|
y = libinput_event_pointer_get_dy(event);
|
|
|
|
valuator_mask_zero(mask);
|
|
+
|
|
+#if HAVE_VMASK_UNACCEL
|
|
+ {
|
|
+ double ux, uy;
|
|
+
|
|
+ ux = libinput_event_pointer_get_dx_unaccelerated(event);
|
|
+ uy = libinput_event_pointer_get_dy_unaccelerated(event);
|
|
+
|
|
+ valuator_mask_set_unaccelerated(mask, 0, x, ux);
|
|
+ valuator_mask_set_unaccelerated(mask, 1, y, uy);
|
|
+ }
|
|
+#else
|
|
valuator_mask_set_double(mask, 0, x);
|
|
valuator_mask_set_double(mask, 1, y);
|
|
-
|
|
+#endif
|
|
xf86PostMotionEventM(dev, Relative, mask);
|
|
}
|
|
|
|
@@ -1363,6 +1382,10 @@ xf86libinput_pre_init(InputDriverPtr drv,
|
|
if (!driver_data->valuators)
|
|
goto fail;
|
|
|
|
+ driver_data->valuators_unaccelerated = valuator_mask_new(2);
|
|
+ if (!driver_data->valuators_unaccelerated)
|
|
+ goto fail;
|
|
+
|
|
driver_data->scroll.vdist = 15;
|
|
driver_data->scroll.hdist = 15;
|
|
|
|
@@ -1434,6 +1457,8 @@ fail:
|
|
fd_pop(&driver_context, pInfo->fd);
|
|
if (driver_data->valuators)
|
|
valuator_mask_free(&driver_data->valuators);
|
|
+ if (driver_data->valuators_unaccelerated)
|
|
+ valuator_mask_free(&driver_data->valuators_unaccelerated);
|
|
free(path);
|
|
free(driver_data);
|
|
return BadValue;
|
|
--
|
|
2.4.1
|
|
|