xserver-xorg-input-libinput: Changes to 'upstream-unstable'
Makefile.am | 4
conf/90-libinput.conf | 28 ++++++
conf/99-libinput.conf | 6 -
configure.ac | 11 ++
include/libinput-properties.h | 12 ++
man/libinput.man | 9 ++
src/xf86libinput.c | 185 +++++++++++++++++++++++++++++++++++++++---
7 files changed, 234 insertions(+), 21 deletions(-)
New commits:
commit 44f4b2ed7075d424e3621f30815e11875b364c27
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Tue Oct 27 17:08:59 2015 +1000
xf86-input-libinput 0.15.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/configure.ac b/configure.ac
index 61cad3a..268e030 100644
--- a/configure.ac
+++ b/configure.ac
@@ -23,7 +23,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xf86-input-libinput],
- [0.14.0],
+ [0.15.0],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
[xf86-input-libinput])
AC_CONFIG_SRCDIR([Makefile.am])
commit 0163482e22ad65ec51e3636cf31f9f39e29ff709
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu Sep 3 18:03:00 2015 +1000
Add property support for the accel profiles
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/configure.ac b/configure.ac
index f42fee3..61cad3a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,7 +45,7 @@ XORG_DEFAULT_OPTIONS
# Obtain compiler/linker options from server and required extensions
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10] xproto [inputproto >= 2.2])
-PKG_CHECK_MODULES(LIBINPUT, [libinput >= 0.21.0])
+PKG_CHECK_MODULES(LIBINPUT, [libinput >= 1.0.901])
# Define a configure option for an alternate input module directory
AC_ARG_WITH(xorg-module-dir,
diff --git a/include/libinput-properties.h b/include/libinput-properties.h
index 06fad7f..098ce48 100644
--- a/include/libinput-properties.h
+++ b/include/libinput-properties.h
@@ -48,6 +48,18 @@
/* Pointer accel speed: FLOAT, 1 value, 32 bit, read-only*/
#define LIBINPUT_PROP_ACCEL_DEFAULT "libinput Accel Speed Default"
+/* Pointer accel profile: BOOL, 2 values in oder adaptive, flat,
+ * only one is enabled at a time at max, read-only */
+#define LIBINPUT_PROP_ACCEL_PROFILES_AVAILABLE "libinput Accel Profiles Available"
+
+/* Pointer accel profile: BOOL, 2 values in order adaptive, flat,
+ only one is enabled at a time at max, read-only */
+#define LIBINPUT_PROP_ACCEL_PROFILE_ENABLED_DEFAULT "libinput Accel Profile Enabled Default"
+
+/* Pointer accel profile: BOOL, 2 values in order adaptive, flat,
+ only one is enabled at a time at max */
+#define LIBINPUT_PROP_ACCEL_PROFILE_ENABLED "libinput Accel Profile Enabled"
+
/* Natural scrolling: BOOL, 1 value */
#define LIBINPUT_PROP_NATURAL_SCROLL "libinput Natural Scrolling Enabled"
diff --git a/man/libinput.man b/man/libinput.man
index 196686d..b6f476e 100644
--- a/man/libinput.man
+++ b/man/libinput.man
@@ -50,6 +50,15 @@ directives, this option is set by the server.
The mapping from device node to hardware is system-dependent. Property:
"Device Node" (read-only).
.TP 7
+.BI "Option \*qAccelProfile\*q \*q" string \*q
+Sets the pointer acceleration profile to the given profile. Permitted values
+are
+.BI adaptive,
+.BI flat.
+Not all devices support this option or all profiles. If a profile is
+unsupported, the default profile for this is used. For a description on the
+profiles and their behavior, see the libinput documentation.
+.TP 7
.BI "Option \*qAccelSpeed\*q \*q" float \*q
Sets the pointer acceleration speed within the range [-1, 1]
.TP 7
diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index c1b13ff..3ca7514 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -110,6 +110,7 @@ struct xf86libinput {
float matrix[9];
enum libinput_config_scroll_method scroll_method;
enum libinput_config_click_method click_method;
+ enum libinput_config_accel_profile accel_profile;
unsigned char btnmap[MAX_BUTTONS + 1];
@@ -193,6 +194,28 @@ LibinputApplyConfig(DeviceIntPtr dev)
xf86IDrvMsg(pInfo, X_ERROR,
"Failed to set speed %.2f\n",
driver_data->options.speed);
+
+ if (libinput_device_config_accel_get_profiles(device) &&
+ driver_data->options.accel_profile != LIBINPUT_CONFIG_ACCEL_PROFILE_NONE &&
+ libinput_device_config_accel_set_profile(device,
+ driver_data->options.accel_profile) !=
+ LIBINPUT_CONFIG_STATUS_SUCCESS) {
+ const char *profile;
+
+ switch (driver_data->options.accel_profile) {
+ case LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE:
+ profile = "adaptive";
+ break;
+ case LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT:
+ profile = "flat";
+ break;
+ default:
+ profile = "unknown";
+ break;
+ }
+ xf86IDrvMsg(pInfo, X_ERROR, "Failed to set profile %s\n", profile);
+ }
+
if (libinput_device_config_tap_get_finger_count(device) > 0 &&
libinput_device_config_tap_set_enabled(device,
driver_data->options.tapping) != LIBINPUT_CONFIG_STATUS_SUCCESS)
@@ -1074,6 +1097,34 @@ xf86libinput_parse_accel_option(InputInfoPtr pInfo,
return speed;
}
+static inline enum libinput_config_accel_profile
+xf86libinput_parse_accel_profile_option(InputInfoPtr pInfo,
+ struct libinput_device *device)
+{
+ enum libinput_config_accel_profile profile;
+ char *str;
+
+ if (libinput_device_config_accel_get_profiles(device) ==
+ LIBINPUT_CONFIG_ACCEL_PROFILE_NONE)
+ return LIBINPUT_CONFIG_ACCEL_PROFILE_NONE;
+
+ str = xf86SetStrOption(pInfo->options, "AccelProfile", NULL);
+ if (!str)
+ profile = libinput_device_config_accel_get_profile(device);
+ else if (strncasecmp(str, "adaptive", 9) == 0)
+ profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
+ else if (strncasecmp(str, "flat", 4) == 0)
+ profile = LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
+ else {
+ xf86IDrvMsg(pInfo, X_ERROR,
+ "Unknown accel profile '%s'. Using default.\n",
+ str);
+ profile = libinput_device_config_accel_get_profile(device);
+ }
+
+ return profile;
+}
+
static inline BOOL
xf86libinput_parse_natscroll_option(InputInfoPtr pInfo,
struct libinput_device *device)
@@ -1406,6 +1457,7 @@ xf86libinput_parse_options(InputInfoPtr pInfo,
options->tapping = xf86libinput_parse_tap_option(pInfo, device);
options->tap_drag_lock = xf86libinput_parse_tap_drag_lock_option(pInfo, device);
options->speed = xf86libinput_parse_accel_option(pInfo, device);
+ options->accel_profile = xf86libinput_parse_accel_profile_option(pInfo, device);
options->natural_scrolling = xf86libinput_parse_natscroll_option(pInfo, device);
options->sendevents = xf86libinput_parse_sendevents_option(pInfo, device);
options->left_handed = xf86libinput_parse_lefthanded_option(pInfo, device);
@@ -1590,6 +1642,9 @@ static Atom prop_calibration;
static Atom prop_calibration_default;
static Atom prop_accel;
static Atom prop_accel_default;
+static Atom prop_accel_profile_enabled;
+static Atom prop_accel_profile_default;
+static Atom prop_accel_profiles_available;
static Atom prop_natural_scroll;
static Atom prop_natural_scroll_default;
static Atom prop_sendevents_available;
@@ -1770,6 +1825,47 @@ LibinputSetPropertyAccel(DeviceIntPtr dev,
}
static inline int
+LibinputSetPropertyAccelProfile(DeviceIntPtr dev,
+ Atom atom,
+ XIPropertyValuePtr val,
+ BOOL checkonly)
+{
+ InputInfoPtr pInfo = dev->public.devicePrivate;
+ struct xf86libinput *driver_data = pInfo->private;
+ struct libinput_device *device = driver_data->device;
+ BOOL* data;
+ uint32_t profiles = 0;
+
+ if (val->format != 8 || val->size != 2 || val->type != XA_INTEGER)
+ return BadMatch;
+
+ data = (BOOL*)val->data;
+
+ if (data[0])
+ profiles |= LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
+ if (data[1])
+ profiles |= LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
+
+ if (checkonly) {
+ uint32_t supported;
+
+ if (__builtin_popcount(profiles) > 1)
+ return BadValue;
+
+ if (!xf86libinput_check_device (dev, atom))
+ return BadMatch;
+
+ supported = libinput_device_config_accel_get_profiles(device);
+ if (profiles && (profiles & supported) == 0)
+ return BadValue;
+ } else {
+ driver_data->options.accel_profile = profiles;
+ }
+
+ return Success;
+}
+
+static inline int
LibinputSetPropertyNaturalScroll(DeviceIntPtr dev,
Atom atom,
XIPropertyValuePtr val,
@@ -2174,6 +2270,8 @@ LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
checkonly);
else if (atom == prop_accel)
rc = LibinputSetPropertyAccel(dev, atom, val, checkonly);
+ else if (atom == prop_accel_profile_enabled)
+ rc = LibinputSetPropertyAccelProfile(dev, atom, val, checkonly);
else if (atom == prop_natural_scroll)
rc = LibinputSetPropertyNaturalScroll(dev, atom, val, checkonly);
else if (atom == prop_sendevents_enabled)
@@ -2199,6 +2297,7 @@ LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
atom == prop_tap_drag_lock_default ||
atom == prop_calibration_default ||
atom == prop_accel_default ||
+ atom == prop_accel_profile_default ||
atom == prop_natural_scroll_default ||
atom == prop_sendevents_default ||
atom == prop_sendevents_available ||
@@ -2332,6 +2431,9 @@ LibinputInitAccelProperty(DeviceIntPtr dev,
struct libinput_device *device)
{
float speed = driver_data->options.speed;
+ uint32_t profile_mask;
+ enum libinput_config_accel_profile profile;
+ BOOL profiles[2] = {FALSE};
if (!libinput_device_config_accel_is_available(device))
return;
@@ -2348,6 +2450,68 @@ LibinputInitAccelProperty(DeviceIntPtr dev,
LIBINPUT_PROP_ACCEL_DEFAULT,
prop_float, 32,
1, &speed);
+
+ profile_mask = libinput_device_config_accel_get_profiles(device);
+ if (profile_mask == LIBINPUT_CONFIG_ACCEL_PROFILE_NONE)
+ return;
+
+ if (profile_mask & LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE)
+ profiles[0] = TRUE;
+ if (profile_mask & LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE)
+ profiles[1] = TRUE;
+
+ prop_accel_profiles_available = LibinputMakeProperty(dev,
+ LIBINPUT_PROP_ACCEL_PROFILES_AVAILABLE,
+ XA_INTEGER, 8,
+ ARRAY_SIZE(profiles),
+ profiles);
+ if (!prop_accel_profiles_available)
+ return;
+
+ memset(profiles, 0, sizeof(profiles));
+
+ profile = libinput_device_config_accel_get_profile(device);
+ switch(profile) {
+ case LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE:
+ profiles[0] = TRUE;
+ break;
+ case LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT:
+ profiles[1] = TRUE;
+ break;
+ default:
+ break;
+ }
+
+ prop_accel_profile_enabled = LibinputMakeProperty(dev,
+ LIBINPUT_PROP_ACCEL_PROFILE_ENABLED,
+ XA_INTEGER, 8,
+ ARRAY_SIZE(profiles),
+ profiles);
+ if (!prop_accel_profile_enabled)
+ return;
+
+ memset(profiles, 0, sizeof(profiles));
+
+ profile = libinput_device_config_accel_get_default_profile(device);
+ switch(profile) {
+ case LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE:
+ profiles[0] = TRUE;
+ break;
+ case LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT:
+ profiles[1] = TRUE;
+ break;
+ default:
+ break;
+ }
+
+ prop_accel_profile_default = LibinputMakeProperty(dev,
+ LIBINPUT_PROP_ACCEL_PROFILE_ENABLED_DEFAULT,
+ XA_INTEGER, 8,
+ ARRAY_SIZE(profiles),
+ profiles);
+ if (!prop_accel_profile_default)
+ return;
+
}
static void
commit 80c356f58fed47080eb6fa5756a122dbe14e5f6f
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri Sep 18 00:27:13 2015 +1000
conf: install the libinput xorg.conf.d snippet
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/Makefile.am b/Makefile.am
index e67d235..4001f94 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -27,6 +27,8 @@ MAINTAINERCLEANFILES = ChangeLog INSTALL
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = xorg-libinput.pc
+dist_xorgconf_DATA = conf/90-libinput.conf
+
.PHONY: ChangeLog INSTALL
INSTALL:
@@ -37,4 +39,4 @@ ChangeLog:
dist-hook: ChangeLog INSTALL
-EXTRA_DIST = conf/90-libinput.conf README.md
+EXTRA_DIST = README.md
diff --git a/configure.ac b/configure.ac
index bfb1d75..f42fee3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -56,6 +56,13 @@ AC_ARG_WITH(xorg-module-dir,
inputdir=${moduledir}/input
AC_SUBST(inputdir)
+AC_ARG_WITH(xorg-conf-dir,
+ AC_HELP_STRING([--with-xorg-conf-dir=DIR],
+ [Default xorg.conf.d directory [[default=$prefix/share/X11/xorg.conf.d/]]]),
+ [xorgconfdir="$withval"],
+ [xorgconfdir="$prefix/share/X11/xorg.conf.d"])
+AC_SUBST(xorgconfdir)
+
# X Server SDK location is required to install header files
sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
commit 1645a79c343ea3cf8bbd71a36e9106b22e541c71
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri Sep 18 00:28:36 2015 +1000
conf: don't hook onto tablets and joysticks
If we install the config file by default, we shouldn't use libinput for
devices we know we can't handle.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/conf/90-libinput.conf b/conf/90-libinput.conf
index 6c52e79..97afd07 100644
--- a/conf/90-libinput.conf
+++ b/conf/90-libinput.conf
@@ -1,6 +1,28 @@
-# Use the libinput driver for all event devices
+# Match on all types of devices but tablet devices and joysticks
Section "InputClass"
- Identifier "libinput"
- Driver "libinput"
- MatchDevicePath "/dev/input/event*"
+ Identifier "libinput pointer catchall"
+ MatchIsPointer "on"
+ MatchDevicePath "/dev/input/event*"
+ Driver "libinput"
+EndSection
+
+Section "InputClass"
+ Identifier "libinput keyboard catchall"
+ MatchIsKeyboard "on"
+ MatchDevicePath "/dev/input/event*"
+ Driver "libinput"
+EndSection
+
+Section "InputClass"
+ Identifier "libinput touchpad catchall"
+ MatchIsTouchpad "on"
+ MatchDevicePath "/dev/input/event*"
+ Driver "libinput"
+EndSection
+
+Section "InputClass"
+ Identifier "libinput touchscreen catchall"
+ MatchIsTouchscreen "on"
+ MatchDevicePath "/dev/input/event*"
+ Driver "libinput"
EndSection
commit b7f8db12a3389affaa16c584e03d452624ea8bf8
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Fri Sep 18 00:24:13 2015 +1000
conf: rename 99-libinput.conf to 90-libinput.conf
This way it still sorts after the usual subjects, but it's easier to stack
extra config in afterwards.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/Makefile.am b/Makefile.am
index ef17c35..e67d235 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -37,4 +37,4 @@ ChangeLog:
dist-hook: ChangeLog INSTALL
-EXTRA_DIST = conf/99-libinput.conf README.md
+EXTRA_DIST = conf/90-libinput.conf README.md
diff --git a/conf/90-libinput.conf b/conf/90-libinput.conf
new file mode 100644
index 0000000..6c52e79
--- /dev/null
+++ b/conf/90-libinput.conf
@@ -0,0 +1,6 @@
+# Use the libinput driver for all event devices
+Section "InputClass"
+ Identifier "libinput"
+ Driver "libinput"
+ MatchDevicePath "/dev/input/event*"
+EndSection
diff --git a/conf/99-libinput.conf b/conf/99-libinput.conf
deleted file mode 100644
index 6c52e79..0000000
--- a/conf/99-libinput.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-# Use the libinput driver for all event devices
-Section "InputClass"
- Identifier "libinput"
- Driver "libinput"
- MatchDevicePath "/dev/input/event*"
-EndSection
commit 6abd341279ea54e7c0ce56b1a2ad310a496be2b5
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu Sep 3 17:42:20 2015 +1000
Fix invalid pointer passed to the properties
Takes a void*, not a void**
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index 0f48ea0..c1b13ff 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -2480,7 +2480,7 @@ LibinputInitScrollMethodsProperty(DeviceIntPtr dev,
LIBINPUT_PROP_SCROLL_METHODS_AVAILABLE,
XA_INTEGER, 8,
ARRAY_SIZE(methods),
- &methods);
+ methods);
if (!prop_scroll_methods_available)
return;
@@ -2505,7 +2505,7 @@ LibinputInitScrollMethodsProperty(DeviceIntPtr dev,
LIBINPUT_PROP_SCROLL_METHOD_ENABLED,
XA_INTEGER, 8,
ARRAY_SIZE(methods),
- &methods);
+ methods);
if (!prop_scroll_method_enabled)
return;
@@ -2521,7 +2521,7 @@ LibinputInitScrollMethodsProperty(DeviceIntPtr dev,
LIBINPUT_PROP_SCROLL_METHOD_ENABLED_DEFAULT,
XA_INTEGER, 8,
ARRAY_SIZE(methods),
- &methods);
+ methods);
/* Scroll button */
if (libinput_device_config_scroll_get_methods(device) &
LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN) {
@@ -2564,7 +2564,7 @@ LibinputInitClickMethodsProperty(DeviceIntPtr dev,
LIBINPUT_PROP_CLICK_METHODS_AVAILABLE,
XA_INTEGER, 8,
ARRAY_SIZE(methods),
- &methods);
+ methods);
if (!prop_click_methods_available)
return;
@@ -2586,7 +2586,7 @@ LibinputInitClickMethodsProperty(DeviceIntPtr dev,
LIBINPUT_PROP_CLICK_METHOD_ENABLED,
XA_INTEGER, 8,
ARRAY_SIZE(methods),
- &methods);
+ methods);
if (!prop_click_method_enabled)
return;
@@ -2609,7 +2609,7 @@ LibinputInitClickMethodsProperty(DeviceIntPtr dev,
LIBINPUT_PROP_CLICK_METHOD_ENABLED_DEFAULT,
XA_INTEGER, 8,
ARRAY_SIZE(methods),
- &methods);
+ methods);
}
static void
commit 19b42f242dddef7d6381b74b13930d6dd2734898
Author: Peter Hutterer <peter.hutterer@who-t.net>
Date: Thu Sep 3 17:33:40 2015 +1000
Move the read-only properties into the same condition
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
diff --git a/src/xf86libinput.c b/src/xf86libinput.c
index 7ecc0e6..0f48ea0 100644
--- a/src/xf86libinput.c
+++ b/src/xf86libinput.c
@@ -2176,20 +2176,14 @@ LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
rc = LibinputSetPropertyAccel(dev, atom, val, checkonly);
else if (atom == prop_natural_scroll)
rc = LibinputSetPropertyNaturalScroll(dev, atom, val, checkonly);
- else if (atom == prop_sendevents_available)
- return BadAccess; /* read-only */
else if (atom == prop_sendevents_enabled)
rc = LibinputSetPropertySendEvents(dev, atom, val, checkonly);
else if (atom == prop_left_handed)
rc = LibinputSetPropertyLeftHanded(dev, atom, val, checkonly);
- else if (atom == prop_scroll_methods_available)
- return BadAccess; /* read-only */
else if (atom == prop_scroll_method_enabled)
rc = LibinputSetPropertyScrollMethods(dev, atom, val, checkonly);
else if (atom == prop_scroll_button)
rc = LibinputSetPropertyScrollButton(dev, atom, val, checkonly);
- else if (atom == prop_click_methods_available)
- return BadAccess; /* read-only */
else if (atom == prop_click_method_enabled)
rc = LibinputSetPropertyClickMethod(dev, atom, val, checkonly);
else if (atom == prop_middle_emulation)
@@ -2207,10 +2201,13 @@ LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
atom == prop_accel_default ||
atom == prop_natural_scroll_default ||
atom == prop_sendevents_default ||
+ atom == prop_sendevents_available ||
atom == prop_left_handed_default ||
atom == prop_scroll_method_default ||
+ atom == prop_scroll_methods_available ||
atom == prop_scroll_button_default ||
atom == prop_click_method_default ||
+ atom == prop_click_methods_available ||
atom == prop_middle_emulation_default ||
atom == prop_disable_while_typing_default)
return BadAccess; /* read-only */
Reply to: