xf86-input-libinput 0.8.0

This commit is contained in:
Peter Hutterer 2015-03-06 15:40:13 +10:00
parent 3e6445099d
commit f8aa0f02ad
6 changed files with 7 additions and 269 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
/xf86-input-libinput-0.5.0.tar.bz2
/xf86-input-libinput-0.6.0.tar.bz2
/xf86-input-libinput-0.7.0.tar.bz2
/xf86-input-libinput-0.8.0.tar.bz2

View File

@ -1,29 +0,0 @@
From 2600a4a352185f7d4d828f7d223628e4bb0f2aa3 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Wed, 25 Feb 2015 07:48:18 +1000
Subject: [PATCH xf86-input-libinput] Fix off-by-one error in buttonmap
initialization (#89300)
X.Org Bug 89300 <http://bugs.freedesktop.org/show_bug.cgi?id=89300>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
src/libinput.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/libinput.c b/src/libinput.c
index 9613fbd..eee3bfb 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -372,7 +372,7 @@ init_button_map(unsigned char *btnmap, size_t size)
int i;
memset(btnmap, 0, size);
- for (i = 0; i <= size; i++)
+ for (i = 0; i < size; i++)
btnmap[i] = i;
}
--
2.1.0

View File

@ -1,167 +0,0 @@
From 98ae01b9ae8616d3c2047f5510205aa4e3bc52b5 Mon Sep 17 00:00:00 2001
From: Olivier Fourdan <ofourdan@redhat.com>
Date: Wed, 25 Feb 2015 11:49:19 +0100
Subject: [PATCH xf86-input-libinput] Ignore property changes if the device is
disabled
If the device is present but disabled, the server will still call into
SetProperty. We don't have a libinput device to back it up in this case,
causing a null-pointer dereference.
This is a bug specific to this driver that cannot easily be fixed. All
other drivers can handle property changes even if no device is present,
here we rely on libinput to make the final call. But without a device
path/fd we don't have a libinput reference.
The protocol doesn't mention this case, so let's pick BadMatch as the
least wrong error code. And put a warning in the log, this needs a
workaround in the client.
Also, if we get here and the device is on, then that's definitely a bug,
warn about that.
https://bugs.freedesktop.org/show_bug.cgi?id=89296
Signed-off-by: Olivier Fourdan <ofourdan@redhat.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
src/libinput.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++------
1 file changed, 53 insertions(+), 6 deletions(-)
diff --git a/src/libinput.c b/src/libinput.c
index eee3bfb..0ab240c 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -1293,6 +1293,26 @@ static Atom prop_float;
static Atom prop_device;
static Atom prop_product_id;
+static inline BOOL
+xf86libinput_check_device (DeviceIntPtr dev,
+ Atom atom)
+{
+ InputInfoPtr pInfo = dev->public.devicePrivate;
+ struct xf86libinput *driver_data = pInfo->private;
+ struct libinput_device *device = driver_data->device;
+
+ if (device == NULL) {
+ BUG_WARN(dev->public.on);
+ xf86IDrvMsg(pInfo, X_INFO,
+ "SetProperty on %d called but device is disabled.\n"
+ "This driver cannot change properties on a disabled device\n",
+ atom);
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
static inline int
LibinputSetPropertyTap(DeviceIntPtr dev,
Atom atom,
@@ -1312,6 +1332,9 @@ LibinputSetPropertyTap(DeviceIntPtr dev,
if (*data != 0 && *data != 1)
return BadValue;
+ if (!xf86libinput_check_device (dev, atom))
+ return BadMatch;
+
if (libinput_device_config_tap_get_finger_count(device) == 0)
return BadMatch;
} else {
@@ -1343,6 +1366,9 @@ LibinputSetPropertyCalibration(DeviceIntPtr dev,
data[8] != 1)
return BadValue;
+ if (!xf86libinput_check_device (dev, atom))
+ return BadMatch;
+
if (!libinput_device_config_calibration_has_matrix(device))
return BadMatch;
} else {
@@ -1374,6 +1400,9 @@ LibinputSetPropertyAccel(DeviceIntPtr dev,
if (*data < -1 || *data > 1)
return BadValue;
+ if (!xf86libinput_check_device (dev, atom))
+ return BadMatch;
+
if (libinput_device_config_accel_is_available(device) == 0)
return BadMatch;
} else {
@@ -1403,6 +1432,9 @@ LibinputSetPropertyNaturalScroll(DeviceIntPtr dev,
if (*data != 0 && *data != 1)
return BadValue;
+ if (!xf86libinput_check_device (dev, atom))
+ return BadMatch;
+
if (libinput_device_config_scroll_has_natural_scroll(device) == 0)
return BadMatch;
} else {
@@ -1435,9 +1467,12 @@ LibinputSetPropertySendEvents(DeviceIntPtr dev,
modes |= LIBINPUT_CONFIG_SEND_EVENTS_DISABLED_ON_EXTERNAL_MOUSE;
if (checkonly) {
- uint32_t supported =
- libinput_device_config_send_events_get_modes(device);
+ uint32_t supported;
+ if (!xf86libinput_check_device (dev, atom))
+ return BadMatch;
+
+ supported = libinput_device_config_send_events_get_modes(device);
if ((modes | supported) != supported)
return BadValue;
@@ -1465,9 +1500,13 @@ LibinputSetPropertyLeftHanded(DeviceIntPtr dev,
data = (BOOL*)val->data;
if (checkonly) {
- int supported = libinput_device_config_left_handed_is_available(device);
+ int supported;
int left_handed = *data;
+ if (!xf86libinput_check_device (dev, atom))
+ return BadMatch;
+
+ supported = libinput_device_config_left_handed_is_available(device);
if (!supported && left_handed)
return BadValue;
} else {
@@ -1502,11 +1541,15 @@ LibinputSetPropertyScrollMethods(DeviceIntPtr dev,
modes |= LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN;
if (checkonly) {
- uint32_t supported = libinput_device_config_scroll_get_methods(device);
+ uint32_t supported;
if (__builtin_popcount(modes) > 1)
return BadValue;
+ if (!xf86libinput_check_device (dev, atom))
+ return BadMatch;
+
+ supported = libinput_device_config_scroll_get_methods(device);
if (modes && (modes & supported) == 0)
return BadValue;
} else {
@@ -1534,9 +1577,13 @@ LibinputSetPropertyScrollButton(DeviceIntPtr dev,
if (checkonly) {
uint32_t button = *data;
- uint32_t supported = libinput_device_has_button(device,
- btn_xorg2linux(button));
+ uint32_t supported;
+ if (!xf86libinput_check_device (dev, atom))
+ return BadMatch;
+
+ supported = libinput_device_has_button(device,
+ btn_xorg2linux(button));
if (button && !supported)
return BadValue;
} else {
--
2.1.0

View File

@ -1,63 +0,0 @@
From b6731d3d899e7bb7c64652655faba243dcf1aae6 Mon Sep 17 00:00:00 2001
From: Peter Hutterer <peter.hutterer@who-t.net>
Date: Wed, 4 Mar 2015 14:46:29 +1000
Subject: [PATCH xf86-input-libinput] Up the scroll dist value for touchpads
For source FINGER and CONTINUOUS, the axis value is the same as relative
motion - but scrolling in X usually doesn't have the same speed as finger
movement, it's a lot coarser.
We don't know ahead of time where we'll get the scroll events from. Set a
default scroll distance of 15 and multiply any wheel clicks we get by this
value.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
---
src/libinput.c | 16 ++++++++++------
1 file changed, 10 insertions(+), 6 deletions(-)
diff --git a/src/libinput.c b/src/libinput.c
index 049c15b..5e616c8 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -756,18 +756,22 @@ xf86libinput_handle_axis(InputInfoPtr pInfo, struct libinput_event_pointer *even
axis = LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL;
if (libinput_event_pointer_has_axis(event, axis)) {
- if (source == LIBINPUT_POINTER_AXIS_SOURCE_WHEEL)
+ if (source == LIBINPUT_POINTER_AXIS_SOURCE_WHEEL) {
value = libinput_event_pointer_get_axis_value_discrete(event, axis);
- else
+ value *= driver_data->scroll_vdist;
+ } else {
value = libinput_event_pointer_get_axis_value(event, axis);
+ }
valuator_mask_set_double(mask, 3, value);
}
axis = LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL;
if (libinput_event_pointer_has_axis(event, axis)) {
- if (source == LIBINPUT_POINTER_AXIS_SOURCE_WHEEL)
+ if (source == LIBINPUT_POINTER_AXIS_SOURCE_WHEEL) {
value = libinput_event_pointer_get_axis_value_discrete(event, axis);
- else
+ value *= driver_data->scroll_hdist;
+ } else {
value = libinput_event_pointer_get_axis_value(event, axis);
+ }
valuator_mask_set_double(mask, 2, value);
}
@@ -1189,8 +1193,8 @@ xf86libinput_pre_init(InputDriverPtr drv,
if (!driver_data->valuators)
goto fail;
- driver_data->scroll_vdist = 1;
- driver_data->scroll_hdist = 1;
+ driver_data->scroll_vdist = 15;
+ driver_data->scroll_hdist = 15;
path = xf86SetStrOption(pInfo->options, "Device", NULL);
if (!path)
--
2.1.0

View File

@ -1 +1 @@
cfba685f812ae535fbe2e4da5490207f xf86-input-libinput-0.7.0.tar.bz2
775463bafcd47def681d029245a94868 xf86-input-libinput-0.8.0.tar.bz2

View File

@ -4,18 +4,14 @@
Summary: Xorg X11 libinput input driver
Name: xorg-x11-drv-libinput
Version: 0.7.0
Release: 5%{?dist}
Version: 0.8.0
Release: 1%{?dist}
URL: http://ww.x.org
License: MIT
Source0: ftp://ftp.x.org/pub/individual/driver/%{tarball}-%{version}.tar.bz2
Source1: 90-libinput.conf
Patch01: 0001-Fix-off-by-one-error-in-buttonmap-initialization-893.patch
Patch02: 0001-Ignore-property-changes-if-the-device-is-disabled.patch
Patch03: 0001-Up-the-scroll-dist-value-for-touchpads.patch
ExcludeArch: s390 s390x
BuildRequires: autoconf automake libtool
@ -34,9 +30,6 @@ supporting all devices.
%prep
%setup -q -n %{tarball}-%{version}
%patch01 -p1
%patch02 -p1
%patch03 -p1
%build
autoreconf --force -v --install || exit 1
@ -72,6 +65,9 @@ Xorg X11 libinput input driver development files.
%{_includedir}/xorg/libinput-properties.h
%changelog
* Fri Mar 06 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.8.0-1
- xf86-input-libinput 0.8.0
* Thu Mar 05 2015 Peter Hutterer <peter.hutterer@redhat.com> 0.7.0-5
- Fix two-finger scrolling speed (#1198467)