mirror of
https://github.com/X11Libre/xf86-input-libinput.git
synced 2026-03-24 17:44:05 +00:00
Compare commits
41 Commits
xf86-input
...
xf86-input
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
400bf493d1 | ||
|
|
27a88897be | ||
|
|
d5867e5db6 | ||
|
|
1ef2ed874e | ||
|
|
3c9052d886 | ||
|
|
39b0bb4585 | ||
|
|
8923d18d25 | ||
|
|
055481187d | ||
|
|
5a925eaa84 | ||
|
|
e7eafa199e | ||
|
|
d13ab268bd | ||
|
|
347c78387e | ||
|
|
b63f7994dc | ||
|
|
04f42d6e0f | ||
|
|
5d341d1d6c | ||
|
|
4985de5ef3 | ||
|
|
e26fc3c66c | ||
|
|
a759610292 | ||
|
|
21ff2ca7d1 | ||
|
|
c67f191d5b | ||
|
|
1978a2555b | ||
|
|
0909a1a765 | ||
|
|
20bb8d6b9f | ||
|
|
1e88664d95 | ||
|
|
d84e0035d1 | ||
|
|
6c75acfcdf | ||
|
|
eaf847be16 | ||
|
|
d319092d55 | ||
|
|
18cc042e68 | ||
|
|
0db82219bb | ||
|
|
f93bc148d4 | ||
|
|
0d4b50fd6e | ||
|
|
9d9f59fd4c | ||
|
|
7353481490 | ||
|
|
6d3bd4544a | ||
|
|
2be6487de4 | ||
|
|
6ce3d0249d | ||
|
|
87f9fe3a6f | ||
|
|
0c657e0dcf | ||
|
|
ac3574958f | ||
|
|
8772a593b4 |
64
.gitlab-ci.yml
Normal file
64
.gitlab-ci.yml
Normal 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
|
||||
14
README.md
14
README.md
@@ -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
|
||||
|
||||
@@ -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"
|
||||
|
||||
23
configure.ac
23
configure.ac
@@ -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,
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user