Compare commits

..

16 Commits

Author SHA1 Message Date
Peter Hutterer
c67f191d5b xf86-input-libinput 0.28.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-11 11:06:59 +10:00
Peter Hutterer
1978a2555b Minor whitespace fix
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-11 10:59:20 +10:00
Peter Hutterer
0909a1a765 draglock: fix memory overwrite during draglock parsing
Passing in the size of the array but using it as "number of elements" inside
the function. Rename a bunch of arguments to avoid this.

https://bugs.freedesktop.org/show_bug.cgi?id=107166

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-10 11:17:50 +10:00
Peter Hutterer
20bb8d6b9f Revert "Implement the custom acceleration curve options"
Custom pointer acceleration curves were reverted in libinput, so no point
having this code here.

This reverts commit d84e0035d1.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-23 08:14:23 +10:00
Peter Hutterer
1e88664d95 Use the libinput touch count to init the right number of touches
Initial version by Johannes Pointner <h4nn35.work@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-05-02 13:59:00 +10:00
Peter Hutterer
d84e0035d1 Implement the custom acceleration curve options
One new property, and the existing accel profile gets extended to keep one
extra value. The new property libinput Accel Curve Points is a list of pairs
of points to be added to the acceleration curve.

libinput only supports adding points to the curve so we simply declare the
behavior as undefined when the curve is set multiple times. Also helps to
identify those that bother to read the man page before playing with random
driver values.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-04-20 14:04:25 +10:00
Peter Hutterer
6c75acfcdf Use xf86SetStrOption to check for string options
This one shows up in the log and marks it as used.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-04-20 13:34:23 +10:00
Peter Hutterer
eaf847be16 man: whitespace fixes in man page
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-04-17 15:11:12 +10:00
Peter Hutterer
d319092d55 man: fix formatting issue caused by invalid tag
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-04-17 13:52:33 +10:00
Peter Hutterer
18cc042e68 xf86-input-libinput 0.27.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-04-10 09:19:52 +10:00
Evangelos Foutras
0db82219bb Fix "left handed" property not set on all pointers
Remove conditional that prevents the LIBINPUT_PROP_LEFT_HANDED{,DEFAULT}
properties from being set on all pointer devices (only the first got it).
This appears to be a debugging left-over accidentally merged in
6d3bd4544a.

https://bugs.freedesktop.org/show_bug.cgi?id=105667

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-22 10:59:01 +10:00
Peter Hutterer
f93bc148d4 xf86-input-libinput 0.27.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-03-20 11:23:57 +10:00
Peter Hutterer
0d4b50fd6e man: note that we don't do /dev/input/by-id or /dev/input/by-path
For logind-setups we need to match the path libinput wants to open with the
Option Device path that the device has so we know when to return the
server-fd. This doesn't work for by-id or by-path because libinput resolves
those (through udev) to the actual eventX node so our paths look different
when they are the same device.

This could be fixed but since this is easy enough to work around with a
InputClass section and rather a niche case, it's not really worth the effort.

https://bugs.freedesktop.org/show_bug.cgi?id=105562

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Adam Jackson <ajax@redhat.com>
2018-03-20 10:48:04 +10:00
Peter Hutterer
9d9f59fd4c Apply the capabilities checks on subdevices when applying the config
Properties are initialized on the correct devices only but on resume we'd just
blindly apply the config from our device. Depending on the resume order, this
would mean we'd apply a previously set config with a default config.

Example:
* pointer device with keyboard subdevice
* pointer device exports natural scrolling, keyboard device does not and
  remains at default (off)
* client enables natural scrolling on the pointer device
* VT switch away, VT switch back
* pointer device gets enabled first, enables natural scrolling on the
  libinput device
* keyboard device gets enabled second, resets to the default value

Reported-by: Yuxuan Shui <yshuiv7@gmail.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Tested-by: Yuxuan Shui <yshuiv7@gmail.com>
2018-02-21 09:53:12 +10:00
Peter Hutterer
7353481490 Split LibinputDeviceApplyConfig into helper functions
No functional changes
2018-02-02 14:25:44 +10:00
Peter Hutterer
6d3bd4544a Move the subdevice capabilities check into the properties
87f9fe3a6fafe60134c6's intention was to not create properties that a subdevice
doesn't have configuration options for (i.e. if you have a pointer+keyboard
device, don't expose tapping configuration on the keyboard subdevice).

The result was messy, the checker function had a confusing triple-negation and
some properties weren't checked - e.g. left-handed was allowed for touch/tablet
but not for pointer, dwt was allowed for any device.

Fix this by moving the check into the property init function directly and
inverting the helper function to be easier to read.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-02-02 14:25:31 +10:00
5 changed files with 256 additions and 67 deletions

View File

@@ -23,7 +23,7 @@
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xf86-input-libinput],
[0.26.0],
[0.28.0],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
[xf86-input-libinput])
AC_CONFIG_SRCDIR([Makefile.am])
@@ -47,6 +47,23 @@ XORG_DEFAULT_OPTIONS
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10] xproto [inputproto >= 2.2])
PKG_CHECK_MODULES(LIBINPUT, [libinput >= 1.4.901])
OLD_LIBS=$LIBS
OLD_CFLAGS=$CFLAGS
LIBS="$LIBS $LIBINPUT_LIBS"
CFLAGS="$CFLAGS $LIBINPUT_CFLAGS"
AC_MSG_CHECKING([if libinput_device_touch_get_touch_count is available])
AC_LINK_IFELSE(
[AC_LANG_PROGRAM([[#include <libinput.h>]],
[[libinput_device_touch_get_touch_count(NULL)]])],
[AC_MSG_RESULT([yes])
AC_DEFINE(HAVE_LIBINPUT_TOUCH_COUNT, [1],
[libinput_device_touch_get_touch_count() is available])
[libinput_have_touch_count=yes]],
[AC_MSG_RESULT([no])
[libinput_have_touch_count=no]])
LIBS=$OLD_LIBS
CFLAGS=$OLD_CFLAGS
# Define a configure option for an alternate input module directory
AC_ARG_WITH(xorg-module-dir,
AC_HELP_STRING([--with-xorg-module-dir=DIR],

View File

@@ -15,11 +15,11 @@ libinput \- libinput-based X.Org input driver
.SH NOTE
This is the man page for the X input driver. If you are looking for the
library documentation, go to
library documentation, go to
.BI http://wayland.freedesktop.org/libinput/doc/
.SH DESCRIPTION
.B libinput
.B libinput
is an __xservername__ input driver based on libinput. It
therefore supports all input devices that libinput can handle, including
most mice, keyboards, tablets and touchscreens.
@@ -37,7 +37,7 @@ Please refer to __xconfigfile__(__filemansuffix__) for general configuration
details and for options that can be used with all input drivers. This
section only covers configuration details specific to this driver.
.PP
The following driver
The following driver
.B Options
are supported:
.TP 7
@@ -277,7 +277,7 @@ enabled on this device.
.BI "libinput Tablet Tool Pressurecurve"
4 32-bit float values [0.0 to 1.0]. See section
.B TABLET TOOL PRESSURE CURVE
.TP7
.TP 7
.BI "libinput Tablet Tool Area Ratio"
2 32-bit values, corresponding to width and height. Special value 0, 0
resets to the default ratio. See section
@@ -381,6 +381,12 @@ it takes left-handed-ness into account.
.TP
This feature is provided by this driver, not by libinput.
.SH BUGS
This driver does not work with \fBOption \*qDevice\*q\fR set to an event
node in \fI/dev/input/by-id\fR and \fI/dev/input/by-path\fR. This can be
usually be worked by using \fBSection \*qInputClass\*q\fR with an
appropriate \fBMatch*\fR statement in the __xconfigfile__(__filemansuffix__).
.SH AUTHORS
Peter Hutterer
.SH "SEE ALSO"

View File

@@ -116,7 +116,7 @@ draglock_get_meta(const struct draglock *dl)
}
size_t
draglock_get_pairs(const struct draglock *dl, int *array, size_t sz)
draglock_get_pairs(const struct draglock *dl, int *array, size_t nelem)
{
unsigned int i;
size_t last = 0;
@@ -131,8 +131,8 @@ draglock_get_pairs(const struct draglock *dl, int *array, size_t sz)
}
/* size N array with a[0] == 0, the rest ordered by button number */
memset(array, 0, sz * sizeof(array[0]));
for (i = 0; i < sz && i < ARRAY_SIZE(dl->lock_pair); i++) {
memset(array, 0, nelem * sizeof(array[0]));
for (i = 0; i < nelem && i < ARRAY_SIZE(dl->lock_pair); i++) {
array[i] = dl->lock_pair[i];
if (array[i] != 0 && i > last)
last = i;
@@ -153,20 +153,20 @@ draglock_set_meta(struct draglock *dl, int meta_button)
}
int
draglock_set_pairs(struct draglock *dl, const int *array, size_t sz)
draglock_set_pairs(struct draglock *dl, const int *array, size_t nelem)
{
unsigned int i;
if (sz == 0 || array[0] != 0)
if (nelem == 0 || array[0] != 0)
return 1;
for (i = 0; i < sz; i++) {
for (i = 0; i < nelem; i++) {
if (array[i] < 0 || array[i] >= DRAGLOCK_MAX_BUTTONS)
return 1;
}
dl->mode = DRAGLOCK_DISABLED;
for (i = 0; i < sz; i++) {
for (i = 0; i < nelem; i++) {
dl->lock_pair[i] = array[i];
if (dl->lock_pair[i])
dl->mode = DRAGLOCK_PAIRS;

View File

@@ -107,13 +107,13 @@ draglock_get_meta(const struct draglock *dl);
* @note Button numbers start at 1, array[0] is always 0.
*
* @param[in|out] array Caller-allocated array to hold the button mappings.
* @param[in] sz Maximum number of elements in array
* @param[in] nelem Maximum number of elements in array
*
* @return The number of valid elements in array or 0 if the current mode is
* not DRAGLOCK_PAIRS
*/
size_t
draglock_get_pairs(const struct draglock *dl, int *array, size_t sz);
draglock_get_pairs(const struct draglock *dl, int *array, size_t nelem);
/**
* Set the drag lock config to the DRAGLOCK_META mode, with the given
@@ -140,7 +140,7 @@ draglock_set_meta(struct draglock *dl, int meta_button);
* @return 0 on successor nonzero otherwise
*/
int
draglock_set_pairs(struct draglock *dl, const int *array, size_t sz);
draglock_set_pairs(struct draglock *dl, const int *array, size_t nelem);
/**
* Process the given button event through the drag lock state machine.

View File

@@ -461,19 +461,34 @@ xf86libinput_set_area_ratio(struct xf86libinput *driver_data,
}
}
/**
* returns true if the device has one or more of the given capabilities or
* if the device isn't a subdevice
*/
static inline bool
subdevice_has_capabilities(DeviceIntPtr dev, uint32_t capabilities)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
struct xf86libinput *driver_data = pInfo->private;
if (!xf86libinput_is_subdevice(pInfo))
return true;
return !!(driver_data->capabilities & capabilities);
}
static int
LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
BOOL checkonly);
static void
LibinputInitProperty(DeviceIntPtr dev);
static inline void
LibinputApplyConfig(DeviceIntPtr dev)
static void
LibinputApplyConfigSendEvents(DeviceIntPtr dev,
struct xf86libinput *driver_data,
struct libinput_device *device)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
struct xf86libinput *driver_data = pInfo->private;
struct libinput_device *device = driver_data->shared_device->device;
unsigned int scroll_button;
if (libinput_device_config_send_events_get_modes(device) != LIBINPUT_CONFIG_SEND_EVENTS_ENABLED &&
libinput_device_config_send_events_set_mode(device,
@@ -481,6 +496,17 @@ LibinputApplyConfig(DeviceIntPtr dev)
xf86IDrvMsg(pInfo, X_ERROR,
"Failed to set SendEventsMode %u\n",
driver_data->options.sendevents);
}
static void
LibinputApplyConfigNaturalScroll(DeviceIntPtr dev,
struct xf86libinput *driver_data,
struct libinput_device *device)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
if (!subdevice_has_capabilities(dev, CAP_POINTER))
return;
if (libinput_device_config_scroll_has_natural_scroll(device) &&
libinput_device_config_scroll_set_natural_scroll_enabled(device,
@@ -488,6 +514,17 @@ LibinputApplyConfig(DeviceIntPtr dev)
xf86IDrvMsg(pInfo, X_ERROR,
"Failed to set NaturalScrolling to %d\n",
driver_data->options.natural_scrolling);
}
static void
LibinputApplyConfigAccel(DeviceIntPtr dev,
struct xf86libinput *driver_data,
struct libinput_device *device)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
if (!subdevice_has_capabilities(dev, CAP_POINTER))
return;
if (libinput_device_config_accel_is_available(device) &&
libinput_device_config_accel_set_speed(device,
@@ -516,6 +553,17 @@ LibinputApplyConfig(DeviceIntPtr dev)
}
xf86IDrvMsg(pInfo, X_ERROR, "Failed to set profile %s\n", profile);
}
}
static inline void
LibinputApplyConfigTap(DeviceIntPtr dev,
struct xf86libinput *driver_data,
struct libinput_device *device)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
if (!subdevice_has_capabilities(dev, CAP_POINTER))
return;
if (libinput_device_config_tap_get_finger_count(device) > 0 &&
libinput_device_config_tap_set_enabled(device,
@@ -552,6 +600,17 @@ LibinputApplyConfig(DeviceIntPtr dev)
xf86IDrvMsg(pInfo, X_ERROR,
"Failed to set Tapping Drag to %d\n",
driver_data->options.tap_drag);
}
static void
LibinputApplyConfigCalibration(DeviceIntPtr dev,
struct xf86libinput *driver_data,
struct libinput_device *device)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
if (!subdevice_has_capabilities(dev, CAP_TOUCH|CAP_TABLET))
return;
if (libinput_device_config_calibration_has_matrix(device) &&
libinput_device_config_calibration_set_matrix(device,
@@ -564,6 +623,17 @@ LibinputApplyConfig(DeviceIntPtr dev)
driver_data->options.matrix[4], driver_data->options.matrix[5],
driver_data->options.matrix[6], driver_data->options.matrix[7],
driver_data->options.matrix[8]);
}
static void
LibinputApplyConfigLeftHanded(DeviceIntPtr dev,
struct xf86libinput *driver_data,
struct libinput_device *device)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
if (!subdevice_has_capabilities(dev, CAP_POINTER|CAP_TABLET))
return;
if (libinput_device_config_left_handed_is_available(device) &&
libinput_device_config_left_handed_set(device,
@@ -571,6 +641,17 @@ LibinputApplyConfig(DeviceIntPtr dev)
xf86IDrvMsg(pInfo, X_ERROR,
"Failed to set LeftHanded to %d\n",
driver_data->options.left_handed);
}
static void
LibinputApplyConfigScrollMethod(DeviceIntPtr dev,
struct xf86libinput *driver_data,
struct libinput_device *device)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
if (!subdevice_has_capabilities(dev, CAP_POINTER))
return;
if (libinput_device_config_scroll_set_method(device,
driver_data->options.scroll_method) != LIBINPUT_CONFIG_STATUS_SUCCESS) {
@@ -591,12 +672,25 @@ LibinputApplyConfig(DeviceIntPtr dev)
}
if (libinput_device_config_scroll_get_methods(device) & LIBINPUT_CONFIG_SCROLL_ON_BUTTON_DOWN) {
unsigned int scroll_button;
scroll_button = btn_xorg2linux(driver_data->options.scroll_button);
if (libinput_device_config_scroll_set_button(device, scroll_button) != LIBINPUT_CONFIG_STATUS_SUCCESS)
xf86IDrvMsg(pInfo, X_ERROR,
"Failed to set ScrollButton to %u\n",
driver_data->options.scroll_button);
}
}
static void
LibinputApplyConfigClickMethod(DeviceIntPtr dev,
struct xf86libinput *driver_data,
struct libinput_device *device)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
if (!subdevice_has_capabilities(dev, CAP_POINTER))
return;
if (libinput_device_config_click_set_method(device,
driver_data->options.click_method) != LIBINPUT_CONFIG_STATUS_SUCCESS) {
@@ -614,6 +708,17 @@ LibinputApplyConfig(DeviceIntPtr dev)
"Failed to set click method to %s\n",
method);
}
}
static void
LibinputApplyConfigMiddleEmulation(DeviceIntPtr dev,
struct xf86libinput *driver_data,
struct libinput_device *device)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
if (!subdevice_has_capabilities(dev, CAP_POINTER))
return;
if (libinput_device_config_middle_emulation_is_available(device) &&
libinput_device_config_middle_emulation_set_enabled(device,
@@ -621,6 +726,17 @@ LibinputApplyConfig(DeviceIntPtr dev)
xf86IDrvMsg(pInfo, X_ERROR,
"Failed to set MiddleEmulation to %d\n",
driver_data->options.middle_emulation);
}
static void
LibinputApplyConfigDisableWhileTyping(DeviceIntPtr dev,
struct xf86libinput *driver_data,
struct libinput_device *device)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
if (!subdevice_has_capabilities(dev, CAP_POINTER))
return;
if (libinput_device_config_dwt_is_available(device) &&
libinput_device_config_dwt_set_enabled(device,
@@ -628,13 +744,43 @@ LibinputApplyConfig(DeviceIntPtr dev)
xf86IDrvMsg(pInfo, X_ERROR,
"Failed to set DisableWhileTyping to %d\n",
driver_data->options.disable_while_typing);
}
static void
LibinputApplyConfigRotation(DeviceIntPtr dev,
struct xf86libinput *driver_data,
struct libinput_device *device)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
if (!subdevice_has_capabilities(dev, CAP_POINTER))
return;
if (libinput_device_config_rotation_is_available(device) &&
libinput_device_config_rotation_set_angle(device, driver_data->options.rotation_angle) != LIBINPUT_CONFIG_STATUS_SUCCESS)
xf86IDrvMsg(pInfo, X_ERROR,
"Failed to set RotationAngle to %.2f\n",
driver_data->options.rotation_angle);
}
static inline void
LibinputApplyConfig(DeviceIntPtr dev)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
struct xf86libinput *driver_data = pInfo->private;
struct libinput_device *device = driver_data->shared_device->device;
LibinputApplyConfigSendEvents(dev, driver_data, device);
LibinputApplyConfigNaturalScroll(dev, driver_data, device);
LibinputApplyConfigAccel(dev, driver_data, device);
LibinputApplyConfigTap(dev, driver_data, device);
LibinputApplyConfigCalibration(dev, driver_data, device);
LibinputApplyConfigLeftHanded(dev, driver_data, device);
LibinputApplyConfigScrollMethod(dev, driver_data, device);
LibinputApplyConfigClickMethod(dev, driver_data, device);
LibinputApplyConfigMiddleEmulation(dev, driver_data, device);
LibinputApplyConfigDisableWhileTyping(dev, driver_data, device);
LibinputApplyConfigRotation(dev, driver_data, device);
}
static int
@@ -912,11 +1058,13 @@ xf86libinput_init_touch(InputInfoPtr pInfo)
{
DeviceIntPtr dev = pInfo->dev;
struct xf86libinput *driver_data = pInfo->private;
struct libinput_device *device = driver_data->shared_device->device;
int min, max, res;
unsigned char btnmap[MAX_BUTTONS + 1];
Atom btnlabels[MAX_BUTTONS];
Atom axislabels[TOUCHPAD_NUM_AXES];
int nbuttons = 7;
int ntouches = TOUCH_MAX_SLOTS;
init_button_map(btnmap, ARRAY_SIZE(btnmap));
init_button_labels(btnlabels, ARRAY_SIZE(btnlabels));
@@ -940,7 +1088,13 @@ xf86libinput_init_touch(InputInfoPtr pInfo)
xf86InitValuatorAxisStruct(dev, 1,
XIGetKnownProperty(AXIS_LABEL_PROP_ABS_MT_POSITION_Y),
min, max, res * 1000, 0, res * 1000, Absolute);
InitTouchClassDeviceStruct(dev, TOUCH_MAX_SLOTS, XIDirectTouch, 2);
#if HAVE_LIBINPUT_TOUCH_COUNT
ntouches = libinput_device_touch_get_touch_count(device);
if (ntouches == 0) /* unknown - mtdev */
ntouches = TOUCH_MAX_SLOTS;
#endif
InitTouchClassDeviceStruct(dev, ntouches, XIDirectTouch, 2);
}
@@ -2538,9 +2692,9 @@ xf86libinput_parse_calibration_option(InputInfoPtr pInfo,
libinput_device_config_calibration_get_matrix(device, matrix);
memcpy(matrix_out, matrix, sizeof(matrix));
str = xf86CheckStrOption(pInfo->options,
"CalibrationMatrix",
NULL);
str = xf86SetStrOption(pInfo->options,
"CalibrationMatrix",
NULL);
if (!str)
return;
@@ -2768,7 +2922,7 @@ xf86libinput_parse_draglock_option(InputInfoPtr pInfo,
{
char *str;
str = xf86CheckStrOption(pInfo->options, "DragLockButtons",NULL);
str = xf86SetStrOption(pInfo->options, "DragLockButtons", NULL);
if (draglock_init_from_string(&driver_data->draglock, str) != 0)
xf86IDrvMsg(pInfo, X_ERROR,
"Invalid DragLockButtons option: \"%s\"\n",
@@ -4429,6 +4583,9 @@ LibinputInitTapProperty(DeviceIntPtr dev,
{
BOOL tap = driver_data->options.tapping;
if (!subdevice_has_capabilities(dev, CAP_POINTER))
return;
if (libinput_device_config_tap_get_finger_count(device) == 0)
return;
@@ -4455,6 +4612,9 @@ LibinputInitTapDragProperty(DeviceIntPtr dev,
{
BOOL drag = driver_data->options.tap_drag;
if (!subdevice_has_capabilities(dev, CAP_POINTER))
return;
if (libinput_device_config_tap_get_finger_count(device) == 0)
return;
@@ -4479,6 +4639,9 @@ LibinputInitTapDragLockProperty(DeviceIntPtr dev,
{
BOOL drag_lock = driver_data->options.tap_drag_lock;
if (!subdevice_has_capabilities(dev, CAP_POINTER))
return;
if (libinput_device_config_tap_get_finger_count(device) == 0)
return;
@@ -4504,6 +4667,9 @@ LibinputInitTapButtonmapProperty(DeviceIntPtr dev,
enum libinput_config_tap_button_map map;
BOOL data[2] = {0};
if (!subdevice_has_capabilities(dev, CAP_POINTER))
return;
map = driver_data->options.tap_button_map;
if (libinput_device_config_tap_get_finger_count(device) == 0)
@@ -4554,6 +4720,9 @@ LibinputInitCalibrationProperty(DeviceIntPtr dev,
{
float calibration[9];
if (!subdevice_has_capabilities(dev, CAP_POINTER|CAP_TOUCH|CAP_TABLET))
return;
if (!libinput_device_config_calibration_has_matrix(device))
return;
@@ -4591,6 +4760,9 @@ LibinputInitAccelProperty(DeviceIntPtr dev,
enum libinput_config_accel_profile profile;
BOOL profiles[2] = {FALSE};
if (!subdevice_has_capabilities(dev, CAP_POINTER))
return;
if (!libinput_device_config_accel_is_available(device) ||
driver_data->capabilities & CAP_TABLET)
return;
@@ -4678,6 +4850,9 @@ LibinputInitNaturalScrollProperty(DeviceIntPtr dev,
{
BOOL natural_scroll = driver_data->options.natural_scrolling;
if (!subdevice_has_capabilities(dev, CAP_POINTER))
return;
if (!libinput_device_config_scroll_has_natural_scroll(device))
return;
@@ -4760,6 +4935,9 @@ LibinputInitLeftHandedProperty(DeviceIntPtr dev,
{
BOOL left_handed = driver_data->options.left_handed;
if (!subdevice_has_capabilities(dev, CAP_POINTER|CAP_TABLET))
return;
if (!libinput_device_config_left_handed_is_available(device) ||
driver_data->capabilities & CAP_TABLET)
return;
@@ -4787,6 +4965,9 @@ LibinputInitScrollMethodsProperty(DeviceIntPtr dev,
enum libinput_config_scroll_method method;
BOOL methods[3] = {FALSE};
if (!subdevice_has_capabilities(dev, CAP_POINTER))
return;
scroll_methods = libinput_device_config_scroll_get_methods(device);
if (scroll_methods == LIBINPUT_CONFIG_SCROLL_NO_SCROLL)
return;
@@ -4874,6 +5055,9 @@ LibinputInitClickMethodsProperty(DeviceIntPtr dev,
enum libinput_config_click_method method;
BOOL methods[2] = {FALSE};
if (!subdevice_has_capabilities(dev, CAP_POINTER))
return;
click_methods = libinput_device_config_click_get_methods(device);
if (click_methods == LIBINPUT_CONFIG_CLICK_METHOD_NONE)
return;
@@ -4942,6 +5126,9 @@ LibinputInitMiddleEmulationProperty(DeviceIntPtr dev,
{
BOOL middle = driver_data->options.middle_emulation;
if (!subdevice_has_capabilities(dev, CAP_POINTER))
return;
if (!libinput_device_config_middle_emulation_is_available(device))
return;
@@ -4968,6 +5155,9 @@ LibinputInitDisableWhileTypingProperty(DeviceIntPtr dev,
{
BOOL dwt = driver_data->options.disable_while_typing;
if (!subdevice_has_capabilities(dev, CAP_POINTER))
return;
if (!libinput_device_config_dwt_is_available(device))
return;
@@ -5000,6 +5190,9 @@ LibinputInitModeGroupProperties(DeviceIntPtr dev,
associations[MAX_BUTTONS] = {0};
int g, b, r, s;
if (!subdevice_has_capabilities(dev, CAP_TABLET_PAD))
return;
if (!libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_TABLET_PAD))
return;
@@ -5133,7 +5326,7 @@ LibinputInitDragLockProperty(DeviceIntPtr dev,
break;
case DRAGLOCK_PAIRS:
sz = draglock_get_pairs(&driver_data->draglock,
dl_values, sizeof(dl_values));
dl_values, ARRAY_SIZE(dl_values));
break;
default:
xf86IDrvMsg(dev->public.devicePrivate,
@@ -5238,19 +5431,6 @@ LibinputInitTabletAreaRatioProperty(DeviceIntPtr dev,
2, data);
}
static inline bool
subdevice_filter_for_capabilities(DeviceIntPtr dev,
uint32_t capabilities)
{
InputInfoPtr pInfo = dev->public.devicePrivate;
struct xf86libinput *driver_data = pInfo->private;
if (!xf86libinput_is_subdevice(pInfo))
return false;
return !(driver_data->capabilities & capabilities);
}
static void
LibinputInitProperty(DeviceIntPtr dev)
{
@@ -5263,35 +5443,21 @@ LibinputInitProperty(DeviceIntPtr dev)
prop_float = XIGetKnownProperty("FLOAT");
/* On a subdevice, we likely only have a keyboard, so filter out the
* properties for the capabilities we don't have */
if (!subdevice_filter_for_capabilities(dev, CAP_POINTER|CAP_TOUCH)) {
LibinputInitTapProperty(dev, driver_data, device);
LibinputInitTapDragProperty(dev, driver_data, device);
LibinputInitTapDragLockProperty(dev, driver_data, device);
LibinputInitTapButtonmapProperty(dev, driver_data, device);
LibinputInitNaturalScrollProperty(dev, driver_data, device);
}
if (!subdevice_filter_for_capabilities(dev, CAP_TOUCH|CAP_TABLET)) {
LibinputInitCalibrationProperty(dev, driver_data, device);
LibinputInitLeftHandedProperty(dev, driver_data, device);
LibinputInitAccelProperty(dev, driver_data, device);
}
if (!subdevice_filter_for_capabilities(dev, CAP_POINTER)) {
LibinputInitScrollMethodsProperty(dev, driver_data, device);
LibinputInitClickMethodsProperty(dev, driver_data, device);
LibinputInitMiddleEmulationProperty(dev, driver_data, device);
LibinputInitRotationAngleProperty(dev, driver_data, device);
}
if (!subdevice_filter_for_capabilities(dev, CAP_TABLET_PAD)) {
LibinputInitModeGroupProperties(dev, driver_data, device);
}
LibinputInitSendEventsProperty(dev, driver_data, device);
LibinputInitTapProperty(dev, driver_data, device);
LibinputInitTapDragProperty(dev, driver_data, device);
LibinputInitTapDragLockProperty(dev, driver_data, device);
LibinputInitTapButtonmapProperty(dev, driver_data, device);
LibinputInitNaturalScrollProperty(dev, driver_data, device);
LibinputInitDisableWhileTypingProperty(dev, driver_data, device);
LibinputInitScrollMethodsProperty(dev, driver_data, device);
LibinputInitClickMethodsProperty(dev, driver_data, device);
LibinputInitMiddleEmulationProperty(dev, driver_data, device);
LibinputInitRotationAngleProperty(dev, driver_data, device);
LibinputInitAccelProperty(dev, driver_data, device);
LibinputInitCalibrationProperty(dev, driver_data, device);
LibinputInitLeftHandedProperty(dev, driver_data, device);
LibinputInitModeGroupProperties(dev, driver_data, device);
LibinputInitSendEventsProperty(dev, driver_data, device);
/* Device node property, read-only */
device_node = driver_data->path;