Compare commits

...

41 Commits

Author SHA1 Message Date
Peter Hutterer
400bf493d1 xf86-input-libinput 0.29.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-12 12:35:51 +10:00
Peter Hutterer
27a88897be Add basic Gitlab CI for testing the build
This merely tests against the devel package in Fedora, not against the xserver
from git. Should be enough, the driver here doesn't change enough to need the
git builds.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-12 11:44:56 +10:00
Peter Hutterer
d5867e5db6 Fix compiler warning about unhandled switch events
This bumps the required libinput version to 1.7 - which has been out for over
two years now. That's conservative enough.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-08-12 10:36:08 +10:00
Peter Hutterer
1ef2ed874e Check for the tool type too when creating subdevices
Fixed #25

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-31 00:32:44 +00:00
Peter Hutterer
3c9052d886 Fix wrong enum type
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-07-31 00:32:44 +00:00
Peter Hutterer
39b0bb4585 Revert "Upgrade the default scroll distance to 120"
This was part of the high-resolution wheel work that was factored out ahead of
time. Problem is: this breaks scroll button emulation in the server as we
use the distance to determine when we click buttons 4-7.

Before: movement of 15 normalized pixel units on a touchpad - one click. Now:
120 of those units. So that's a bit less than ideal.

The change to 120 can be done, but needs the corresponding handling in the
axis distance calculations.

Fixes #24

This reverts commit 055481187d.
2019-07-30 11:51:12 +10:00
David Rosca
8923d18d25 Also use type to match tablet tool with device
On devices with tools having both serial and id 0,
it would fail to create separate subdevices.

Thinkpad X220T (Wacom ISDv4 E6) now correctly registers
Pen and Eraser xinput devices.
2019-02-25 18:43:42 +01:00
Peter Hutterer
055481187d Upgrade the default scroll distance to 120
This is just a number, to be used as divider and shouldn't have any effect in
correctly written clients. With the high-res scrolling coming up however, we
have a few devices where the dist cannot be expressed as an integer fraction
of 15, so let's up it to 120 because we know all hardware wheels have to be an
integer fraction of that that, thanks to Microsoft's API requirements.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-12 15:40:53 +10:00
Peter Hutterer
5a925eaa84 xf86-input-libinput 0.28.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-02-04 13:14:11 +10:00
Peter Hutterer
e7eafa199e Handle scroll wheel events with a discrete of 0
The driver currently assumes that any wheel event has a non-zero discrete
value of 1. This is incorrect, it just hasn't triggered yet with any device.

With the hi-res scroll patches in place in the kernel and libinput, we may get
wheel events with a discrete value of 0. We assume that if this ever happens,
the device has some sensible click angle set so all we need to do is ignore
the discrete 0 events and wait for the first discrete event to come.

Also add an explanatory comment too to make it clear the calculation is only
done once.

Fixes #19

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-25 14:31:11 +10:00
Peter Hutterer
d13ab268bd Return the wheel scroll value instead of just the fraction
This is prep work for the hi-res work but right now, no real functional
changes. It does however fix a bug where we used the vertial scroll dist for
the horizontal wheel as well.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-24 08:29:48 +10:00
Peter Hutterer
347c78387e Split the scroll axis details up for easier extension
If we need more per-axis fields, it's easier to add this way.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-21 13:08:30 +10:00
Peter Hutterer
b63f7994dc conf: add an example snippet for how to assign options
Users still like to copy the whole file, potentially messing things up.
Let's put a warning into the file directly that this is less than ideal.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2019-01-07 16:29:51 +10:00
Alan Coopersmith
04f42d6e0f Update configure.ac bug URL for gitlab migration
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-11-25 12:47:32 -08:00
Alan Coopersmith
5d341d1d6c Update README for gitlab migration
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
2018-11-18 11:48:07 -08:00
Peter Hutterer
4985de5ef3 Remove two dead assignments
Value stored but never read.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-10-15 15:30:55 +10:00
Peter Hutterer
e26fc3c66c xf86-input-libinput 0.28.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-10-15 09:36:36 +10:00
Peter Hutterer
a759610292 Use the seat slot, not the device slot for touch events
The device slot is per-device, so if we have more than one device we may get a
touch down event for a slot already in use.

Fixes https://gitlab.freedesktop.org/libinput/libinput/issues/153

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-10-04 11:47:46 +10:00
Peter Hutterer
21ff2ca7d1 Remove unused assignment
dev is our list iterator below, this is a dead assignment

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2018-07-19 15:58:06 +10:00
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
Peter Hutterer
2be6487de4 xf86-input-libinput 0.26.0
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-09-15 11:26:54 +10:00
Peter Hutterer
6ce3d0249d Post a motion event before a tablet button down
Not all clients update the pointer position correctly from the button events
(for historical reasons) so we need to send a motion event before the button
event that represents a tip state change.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-08-17 15:20:29 +10:00
Peter Hutterer
87f9fe3a6f Only initialize properties that match capabilities on a subdevice
If a device is split into multiple subdevices, usually pointer+keyboard, we
initialized properties matching the libinput device on both devices. This
results in the keyboard having e.g. a Accel Speed or Left Handed settings even
though it cannot send any events of that type.

Filter by capabilities on the subdevice so we only get those properties that
match the subdevice's capabilities.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-29 08:15:20 +10:00
Peter Hutterer
0c657e0dcf Update copyright years
because why not

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-18 14:03:06 +10:00
Niklas Haas
ac3574958f man: add missing documentation for Accel Profile
This seems to have been simply missing from 0163482e.

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

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-15 11:41:46 +10:00
Martin Kepplinger
8772a593b4 Fix config comment description to match the config
Since the config matches on tablets too, update the describing comment
accordingly.

Signed-off-by: Martin Kepplinger <martin.kepplinger@ginzinger.com>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2017-05-08 10:33:58 +10:00
8 changed files with 424 additions and 86 deletions

64
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,64 @@
# vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0:
include:
- project: 'wayland/ci-templates'
ref: 955e61e67cf29327cf907432f668df9eec4ca6a2 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
file: '/templates/fedora.yml'
variables:
FEDORA_RPMS: 'git autoconf automake libtool make xorg-x11-server-devel libudev-devel libevdev-devel libinput-devel xorg-x11-util-macros'
FEDORA_TAG: '2019-08-12.0'
UPSTREAM_REPO: xorg/drivers/xf86-input-libinput
BUILDAH_IMAGE: $CI_REGISTRY/wayland/ci-templates/buildah:latest
FEDORA_CONTAINER_IMAGE: $CI_REGISTRY_IMAGE/fedora/$FEDORA_VERSION:$FEDORA_TAG
stages:
- containers-build
- build
container_build:
extends: .fedora@container-ifnot-exists
stage: containers-build
variables:
GIT_STRATEGY: none
FEDORA_VERSION: 30
.default_artifacts: &default_artifacts
artifacts:
name: "automake-logs-$CI_JOB_NAME"
when: always
expire_in: 1 week
paths:
- _builddir/config.log
.default_build: &default_build
script:
- mkdir _builddir _inst
- pushd _builddir > /dev/null
- ../autogen.sh --prefix=$(realpath ../_inst) --disable-silent-rules
- make && make check
- make install
- popd > /dev/null
.build@template:
stage: build
<<: *default_artifacts
<<: *default_build
dependencies: []
.fedora-build@template:
extends: .build@template
image: $FEDORA_CONTAINER_IMAGE
fedora:30@default-build:
extends: .fedora-build@template
variables:
FEDORA_VERSION: 30

View File

@@ -2,7 +2,7 @@ xf86-input-libinput - a libinput-based X driver
===============================================
The official repository for this driver is
http://cgit.freedesktop.org/xorg/driver/xf86-input-libinput/
https://gitlab.freedesktop.org/xorg/driver/xf86-input-libinput
This is an X driver based on libinput. It is a thin wrapper around libinput,
so while it does provide all features that libinput supports it does little
@@ -20,10 +20,10 @@ xorg-x11-server-devel package or similar) and libinput (check your
distribution for libinput-devel or similar).
To get libinput from source, see:
http://www.freedesktop.org/wiki/Software/libinput/
https://www.freedesktop.org/wiki/Software/libinput/
To build the X server from source:
http://www.x.org/wiki/Building_the_X_Window_System/
https://www.x.org/wiki/Building_the_X_Window_System/
Building
--------
@@ -48,8 +48,8 @@ This will assign this driver to *all* devices. Use with caution.
Bugs
----
Bugs in libinput go to the "libinput" component of wayland:
https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland
Bugs in libinput go to the Issues section of the libinput gitlab project:
https://gitlab.freedesktop.org/libinput/libinput/issues
Bugs in this driver go to the "Input/libinput" component of xorg:
https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
Bugs in this driver go to the Issues section of its gitlab project:
https://gitlab.freedesktop.org/xorg/driver/xf86-input-libinput/issues

View File

@@ -1,4 +1,21 @@
# Match on all types of devices but tablet devices and joysticks
# Match on all types of devices but joysticks
#
# If you want to configure your devices, do not copy this file.
# Instead, use a config snippet that contains something like this:
#
# Section "InputClass"
# Identifier "something or other"
# MatchDriver "libinput"
#
# MatchIsTouchpad "on"
# ... other Match directives ...
# Option "someoption" "value"
# EndSection
#
# This applies the option any libinput device also matched by the other
# directives. See the xorg.conf(5) man page for more info on
# matching devices.
Section "InputClass"
Identifier "libinput pointer catchall"
MatchIsPointer "on"

View File

@@ -23,8 +23,8 @@
# Initialize Autoconf
AC_PREREQ([2.60])
AC_INIT([xf86-input-libinput],
[0.25.1],
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
[0.29.0],
[https://gitlab.freedesktop.org/xorg/driver/xf86-input-libinput/issues],
[xf86-input-libinput])
AC_CONFIG_SRCDIR([Makefile.am])
AC_CONFIG_HEADERS([config.h])
@@ -45,7 +45,24 @@ 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 >= 1.4.901])
PKG_CHECK_MODULES(LIBINPUT, [libinput >= 1.7.0])
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,

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
@@ -203,6 +203,14 @@ on the device. The following properties are provided by the
.B libinput
driver.
.TP 7
.BI "libinput Accel Profiles Available"
2 boolean values (8 bit, 0 or 1), in order "adaptive", "flat".
Indicates which acceleration profiles are available on this device.
.TP 7
.BI "libinput Accel Profile Enabled"
2 boolean values (8 bit, 0 or 1), in order "adaptive", "flat".
Indicates which acceleration profile is currently enabled on this device.
.TP 7
.BI "libinput Accel Speed"
1 32-bit float value, defines the pointer speed. Value range -1, 1
.TP 7
@@ -269,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
@@ -373,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

@@ -1,5 +1,5 @@
/*
* Copyright © 2013-2015 Red Hat, Inc.
* Copyright © 2013-2017 Red Hat, Inc.
*
* Permission to use, copy, modify, distribute, and sell this software
* and its documentation for any purpose is hereby granted without
@@ -128,11 +128,10 @@ struct xf86libinput {
uint32_t capabilities;
struct {
int vdist;
int hdist;
double vdist_fraction;
double hdist_fraction;
struct scroll_axis {
int dist;
double fraction;
} v, h;
} scroll;
struct {
@@ -212,6 +211,10 @@ update_mode_prop(InputInfoPtr pInfo,
static enum event_handling
xf86libinput_handle_event(struct libinput_event *event);
static void
xf86libinput_post_tablet_motion(InputInfoPtr pInfo,
struct libinput_event_tablet_tool *event);
static inline int
use_server_fd(const InputInfoPtr pInfo) {
return pInfo->fd > -1 && (pInfo->flags & XI86_SERVER_FD);
@@ -394,7 +397,7 @@ xf86libinput_shared_disable(struct xf86libinput_device *shared_device)
libinput_device_set_user_data(device, NULL);
libinput_path_remove_device(device);
device = libinput_device_unref(device);
libinput_device_unref(device);
shared_device->device = NULL;
}
@@ -457,19 +460,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,
@@ -477,6 +495,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,
@@ -484,6 +513,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,
@@ -512,6 +552,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,
@@ -548,6 +599,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,
@@ -560,6 +622,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,
@@ -567,6 +640,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) {
@@ -587,12 +671,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) {
@@ -610,6 +707,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,
@@ -617,6 +725,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,
@@ -624,13 +743,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
@@ -786,8 +935,8 @@ xf86libinput_init_pointer(InputInfoPtr pInfo)
XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y),
min, max, res * 1000, 0, res * 1000, Relative);
SetScrollValuator(dev, 2, SCROLL_TYPE_HORIZONTAL, driver_data->scroll.hdist, 0);
SetScrollValuator(dev, 3, SCROLL_TYPE_VERTICAL, driver_data->scroll.vdist, 0);
SetScrollValuator(dev, 2, SCROLL_TYPE_HORIZONTAL, driver_data->scroll.h.dist, 0);
SetScrollValuator(dev, 3, SCROLL_TYPE_VERTICAL, driver_data->scroll.v.dist, 0);
return Success;
}
@@ -834,8 +983,8 @@ xf86libinput_init_pointer_absolute(InputInfoPtr pInfo)
XIGetKnownProperty(AXIS_LABEL_PROP_ABS_Y),
min, max, res * 1000, 0, res * 1000, Absolute);
SetScrollValuator(dev, 2, SCROLL_TYPE_HORIZONTAL, driver_data->scroll.hdist, 0);
SetScrollValuator(dev, 3, SCROLL_TYPE_VERTICAL, driver_data->scroll.vdist, 0);
SetScrollValuator(dev, 2, SCROLL_TYPE_HORIZONTAL, driver_data->scroll.h.dist, 0);
SetScrollValuator(dev, 3, SCROLL_TYPE_VERTICAL, driver_data->scroll.v.dist, 0);
driver_data->has_abs = TRUE;
@@ -908,11 +1057,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));
@@ -936,7 +1087,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);
}
@@ -1407,40 +1564,58 @@ xf86libinput_handle_key(InputInfoPtr pInfo, struct libinput_event_keyboard *even
* e.g. a 2 degree click angle requires 8 clicks before a legacy event is
* sent, but each of those clicks will send XI2.1 smooth scroll data for
* compatible clients.
*
* Starting with kernel v5.0 we should get REL_WHEEL_HI_RES from those
* devices for the fine-grained scrolling and REL_WHEEL for the normal one,
* so the use-case above shouldn't matter anymore.
*/
static inline double
get_scroll_fraction(struct xf86libinput *driver_data,
struct libinput_event_pointer *event,
enum libinput_pointer_axis axis)
get_wheel_scroll_value(struct xf86libinput *driver_data,
struct libinput_event_pointer *event,
enum libinput_pointer_axis axis)
{
double *fraction;
struct scroll_axis *s;
double f;
double angle;
int discrete;
switch (axis) {
case LIBINPUT_POINTER_AXIS_SCROLL_HORIZONTAL:
fraction = &driver_data->scroll.hdist_fraction;
s = &driver_data->scroll.h;
break;
case LIBINPUT_POINTER_AXIS_SCROLL_VERTICAL:
fraction = &driver_data->scroll.vdist_fraction;
s = &driver_data->scroll.v;
break;
default:
return 0.0;
}
if (*fraction != 0.0)
return *fraction;
/* Calculate the angle per single scroll event */
angle = libinput_event_pointer_get_axis_value(event, axis);
discrete = libinput_event_pointer_get_axis_value_discrete(event, axis);
/* We only need to guess the fraction on the first set of
* scroll events until a discrete value arrives. Once known, we
* re-use the fraction until the device goes away.
*/
if (s->fraction != 0.0)
goto out;
/* if we get a discrete of 0, assume REL_WHEEL_HI_RES exists and
* normal scroll events are sent correctly, so skip all the
* guesswork.
*/
if (discrete == 0) {
s->fraction = 1.0;
goto out;
}
/* Calculate the angle per single scroll event */
angle /= discrete;
/* We only do magic for click angles smaller than 10 degrees */
if (angle >= 10) {
*fraction = 1.0;
return 1.0;
s->fraction = 1.0;
goto out;
}
/* Figure out something that gets close to 15 degrees (the general
@@ -1451,9 +1626,10 @@ get_scroll_fraction(struct xf86libinput *driver_data,
*/
f = round(15.0/angle);
*fraction = f;
s->fraction = f;
return f;
out:
return s->dist/s->fraction * discrete;
}
static inline bool
@@ -1470,11 +1646,7 @@ calculate_axis_value(struct xf86libinput *driver_data,
source = libinput_event_pointer_get_axis_source(event);
if (source == LIBINPUT_POINTER_AXIS_SOURCE_WHEEL) {
double scroll_fraction;
value = libinput_event_pointer_get_axis_value_discrete(event, axis);
scroll_fraction = get_scroll_fraction(driver_data, event, axis);
value *= driver_data->scroll.vdist/scroll_fraction;
value = get_wheel_scroll_value(driver_data, event, axis);
} else {
value = libinput_event_pointer_get_axis_value(event, axis);
}
@@ -1547,7 +1719,7 @@ xf86libinput_handle_touch(InputInfoPtr pInfo,
if ((driver_data->capabilities & CAP_TOUCH) == 0)
return;
slot = libinput_event_touch_get_slot(event);
slot = libinput_event_touch_get_seat_slot(event);
switch (event_type) {
case LIBINPUT_EVENT_TOUCH_DOWN:
@@ -1619,7 +1791,9 @@ xf86libinput_pick_device(struct xf86libinput_device *shared_device,
if (libinput_tablet_tool_get_serial(driver_data->tablet_tool) ==
libinput_tablet_tool_get_serial(tool) &&
libinput_tablet_tool_get_tool_id(driver_data->tablet_tool) ==
libinput_tablet_tool_get_tool_id(tool))
libinput_tablet_tool_get_tool_id(tool) &&
libinput_tablet_tool_get_type(driver_data->tablet_tool) ==
libinput_tablet_tool_get_type(tool))
return driver_data->pInfo;
}
}
@@ -1716,12 +1890,15 @@ static enum event_handling
xf86libinput_handle_tablet_tip(InputInfoPtr pInfo,
struct libinput_event_tablet_tool *event)
{
DeviceIntPtr pDev = pInfo->dev;
enum libinput_tablet_tool_tip_state state;
const BOOL is_absolute = TRUE;
if (xf86libinput_tool_queue_event(event))
return EVENT_QUEUED;
xf86libinput_post_tablet_motion(pDev->public.devicePrivate, event);
state = libinput_event_tablet_tool_get_tip_state(event);
xf86PostButtonEventP(pInfo->dev,
@@ -1887,6 +2064,7 @@ xf86libinput_create_tool_subdevice(InputInfoPtr pInfo,
struct xf86libinput_tablet_tool *t;
struct xf86libinput_tablet_tool_event_queue *queue;
struct libinput_tablet_tool *tool;
enum libinput_tablet_tool_type tool_type;
uint64_t serial, tool_id;
XF86OptionPtr options = NULL;
char name[64];
@@ -1906,12 +2084,14 @@ xf86libinput_create_tool_subdevice(InputInfoPtr pInfo,
tool = libinput_event_tablet_tool_get_tool(event);
serial = libinput_tablet_tool_get_serial(tool);
tool_id = libinput_tablet_tool_get_tool_id(tool);
tool_type = libinput_tablet_tool_get_type(tool);
t->tool = libinput_tablet_tool_ref(tool);
xorg_list_append(&t->node, &shared_device->unclaimed_tablet_tool_list);
options = xf86ReplaceIntOption(options, "_libinput/tablet-tool-serial", serial);
options = xf86ReplaceIntOption(options, "_libinput/tablet-tool-id", tool_id);
options = xf86ReplaceIntOption(options, "_libinput/tablet-tool-type", tool_type);
/* Convert the name to "<base name> <tool type> (serial number)" */
if (snprintf(name,
sizeof(name),
@@ -1931,18 +2111,20 @@ static inline DeviceIntPtr
xf86libinput_find_device_for_tool(InputInfoPtr pInfo,
struct libinput_tablet_tool *tool)
{
struct xf86libinput *dev = pInfo->private;
struct xf86libinput *dev;
struct xf86libinput *driver_data = pInfo->private;
struct xf86libinput_device *shared_device = driver_data->shared_device;
uint64_t serial = libinput_tablet_tool_get_serial(tool);
uint64_t tool_id = libinput_tablet_tool_get_tool_id(tool);
enum libinput_tablet_tool_type tool_type = libinput_tablet_tool_get_type(tool);
xorg_list_for_each_entry(dev,
&shared_device->device_list,
shared_device_link) {
if (dev->tablet_tool &&
libinput_tablet_tool_get_serial(dev->tablet_tool) == serial &&
libinput_tablet_tool_get_tool_id(dev->tablet_tool) == tool_id) {
libinput_tablet_tool_get_tool_id(dev->tablet_tool) == tool_id &&
libinput_tablet_tool_get_type(dev->tablet_tool) == tool_type) {
return dev->pInfo->dev;
}
}
@@ -2157,6 +2339,8 @@ xf86libinput_handle_event(struct libinput_event *event)
xf86libinput_handle_tablet_pad_strip(pInfo,
libinput_event_get_tablet_pad_event(event));
break;
case LIBINPUT_EVENT_SWITCH_TOGGLE:
break;
}
out:
@@ -2531,9 +2715,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;
@@ -2761,7 +2945,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",
@@ -3121,16 +3305,19 @@ claim_tablet_tool(InputInfoPtr pInfo)
struct xf86libinput_device *shared_device = driver_data->shared_device;
struct xf86libinput_tablet_tool_event_queue *queue;
struct xf86libinput_tablet_tool *t;
enum libinput_tablet_tool_type tool_type;
uint64_t serial, tool_id;
serial = (uint32_t)xf86CheckIntOption(pInfo->options, "_libinput/tablet-tool-serial", 0);
tool_id = (uint32_t)xf86CheckIntOption(pInfo->options, "_libinput/tablet-tool-id", 0);
tool_type = (uint32_t)xf86CheckIntOption(pInfo->options, "_libinput/tablet-tool-type", 0);
xorg_list_for_each_entry(t,
&shared_device->unclaimed_tablet_tool_list,
node) {
if (libinput_tablet_tool_get_serial(t->tool) == serial &&
libinput_tablet_tool_get_tool_id(t->tool) == tool_id) {
libinput_tablet_tool_get_tool_id(t->tool) == tool_id &&
libinput_tablet_tool_get_type(t->tool) == tool_type) {
driver_data->tablet_tool = t->tool;
queue = libinput_tablet_tool_get_user_data(t->tool);
if (queue)
@@ -3240,8 +3427,8 @@ xf86libinput_pre_init(InputDriverPtr drv,
* affect touchpad scroll speed. For wheels it doesn't matter as
* we're using the discrete value only.
*/
driver_data->scroll.vdist = 15;
driver_data->scroll.hdist = 15;
driver_data->scroll.v.dist = 15;
driver_data->scroll.h.dist = 15;
if (!is_subdevice) {
if (libinput_device_has_capability(device, LIBINPUT_DEVICE_CAP_POINTER))
@@ -3463,13 +3650,13 @@ update_mode_prop_cb(ClientPtr client, pointer closure)
groups[idx] = mode;
driver_data->allow_mode_group_updates = true;
rc = XIChangeDeviceProperty(pInfo->dev,
prop_mode_groups,
XA_INTEGER, 8,
PropModeReplace,
val->size,
groups,
TRUE);
XIChangeDeviceProperty(pInfo->dev,
prop_mode_groups,
XA_INTEGER, 8,
PropModeReplace,
val->size,
groups,
TRUE);
driver_data->allow_mode_group_updates = false;
out:
@@ -4422,6 +4609,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;
@@ -4448,6 +4638,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;
@@ -4472,6 +4665,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;
@@ -4497,6 +4693,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)
@@ -4547,6 +4746,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;
@@ -4584,6 +4786,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;
@@ -4671,6 +4876,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;
@@ -4753,6 +4961,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;
@@ -4780,6 +4991,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;
@@ -4867,6 +5081,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;
@@ -4935,6 +5152,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;
@@ -4961,6 +5181,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;
@@ -4993,6 +5216,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;
@@ -5126,7 +5352,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,
@@ -5247,17 +5473,17 @@ LibinputInitProperty(DeviceIntPtr dev)
LibinputInitTapDragProperty(dev, driver_data, device);
LibinputInitTapDragLockProperty(dev, driver_data, device);
LibinputInitTapButtonmapProperty(dev, driver_data, device);
LibinputInitCalibrationProperty(dev, driver_data, device);
LibinputInitAccelProperty(dev, driver_data, device);
LibinputInitNaturalScrollProperty(dev, driver_data, device);
LibinputInitSendEventsProperty(dev, driver_data, device);
LibinputInitLeftHandedProperty(dev, driver_data, device);
LibinputInitDisableWhileTypingProperty(dev, driver_data, device);
LibinputInitScrollMethodsProperty(dev, driver_data, device);
LibinputInitClickMethodsProperty(dev, driver_data, device);
LibinputInitMiddleEmulationProperty(dev, driver_data, device);
LibinputInitDisableWhileTypingProperty(dev, driver_data, device);
LibinputInitModeGroupProperties(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;