Use the new unnaccelerated valuator masks, fixes nonmoving mouse in SDL

(#1208992)
This commit is contained in:
Peter Hutterer 2015-05-26 09:41:34 +10:00
parent ab0fd39539
commit 765f14a60a
2 changed files with 102 additions and 1 deletions

View File

@ -0,0 +1,91 @@
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

View File

@ -5,7 +5,7 @@
Summary: Xorg X11 libinput input driver Summary: Xorg X11 libinput input driver
Name: xorg-x11-drv-libinput Name: xorg-x11-drv-libinput
Version: 0.10.0 Version: 0.10.0
Release: 2%{?dist} Release: 3%{?dist}
URL: http://ww.x.org URL: http://ww.x.org
License: MIT License: MIT
@ -13,6 +13,8 @@ Source0: ftp://ftp.x.org/pub/individual/driver/%{tarball}-%{version}.tar.bz2
Source1: 90-libinput.conf Source1: 90-libinput.conf
Patch01: 0001-Only-init-abs-axes-if-we-don-t-have-acceleration.patch Patch01: 0001-Only-init-abs-axes-if-we-don-t-have-acceleration.patch
# Bug 1208992 - Mouse cursor doesn't move when moving the physical mouse slowly
Patch02: 0001-Use-the-new-unaccelerated-valuator-ValuatorMask-feat.patch
ExcludeArch: s390 s390x ExcludeArch: s390 s390x
@ -26,6 +28,9 @@ Requires: Xorg %(xserver-sdk-abi-requires xinput)
Requires: xkeyboard-config Requires: xkeyboard-config
Requires: libinput >= 0.8.0 Requires: libinput >= 0.8.0
# For the unaccelerated valuator masks, drop in F23
Requires: xorg-x11-server-Xorg >= 1.17.1-14
%description %description
A generic input driver for the X.Org X11 X server based on libinput, A generic input driver for the X.Org X11 X server based on libinput,
supporting all devices. supporting all devices.
@ -33,6 +38,7 @@ supporting all devices.
%prep %prep
%setup -q -n %{tarball}-%{version} %setup -q -n %{tarball}-%{version}
%patch01 -p1 %patch01 -p1
%patch02 -p1
%build %build
autoreconf --force -v --install || exit 1 autoreconf --force -v --install || exit 1
@ -68,6 +74,10 @@ Xorg X11 libinput input driver development files.
%{_includedir}/xorg/libinput-properties.h %{_includedir}/xorg/libinput-properties.h
%changelog %changelog
* Tue May 26 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.10.0-3
- Use the new unnaccelerated valuator masks, fixes nonmoving mouse in SDL
(#1208992)
* Fri May 22 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.10.0-2 * Fri May 22 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.10.0-2
- Init mixed rel/abs devices as rel devices (#1223619) - Init mixed rel/abs devices as rel devices (#1223619)