mirror of
https://github.com/X11Libre/xf86-input-libinput.git
synced 2026-03-24 09:34:04 +00:00
Compare commits
24 Commits
xf86-input
...
xf86-input
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c712930ef4 | ||
|
|
db7cfbe5c2 | ||
|
|
cb80d7f82d | ||
|
|
7c5635cd6f | ||
|
|
b396ba3697 | ||
|
|
0bcb60e744 | ||
|
|
3a33984cce | ||
|
|
bb41cc730c | ||
|
|
72c8eb25f8 | ||
|
|
74335c6fd6 | ||
|
|
b791b30b1f | ||
|
|
a7d2994256 | ||
|
|
c6b4d2732f | ||
|
|
6ed6814489 | ||
|
|
a24f467576 | ||
|
|
b254d491e2 | ||
|
|
0dc42f0e4e | ||
|
|
46af622e9d | ||
|
|
5e20d16dd4 | ||
|
|
310db4206f | ||
|
|
94a52a8488 | ||
|
|
a4dfadee2f | ||
|
|
141aa867a6 | ||
|
|
57b049d376 |
17
.editorconfig
Normal file
17
.editorconfig
Normal file
@@ -0,0 +1,17 @@
|
||||
# https://editorconfig.org/
|
||||
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.{c,h}]
|
||||
indent_size = 8
|
||||
indent_style = tab
|
||||
|
||||
[{meson.build,meson_options.txt}]
|
||||
indent_size = 8
|
||||
indent_style = tab
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -84,3 +84,4 @@ core
|
||||
test-driver
|
||||
tags
|
||||
.vimdir
|
||||
test/test-bezier
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
# Please see the ci-templates documentation for details:
|
||||
# https://freedesktop.pages.freedesktop.org/ci-templates/
|
||||
|
||||
.templates_sha: &template_sha c5626190ec14b475271288dda7a7dae8dbe0cd76 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
|
||||
.templates_sha: &template_sha 84052757dacc5fd65f5ace92b7fe63c60f6c8558 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
|
||||
|
||||
include:
|
||||
- project: 'freedesktop/ci-templates'
|
||||
@@ -26,10 +26,10 @@ stages:
|
||||
|
||||
.fedora:
|
||||
variables:
|
||||
FDO_DISTRIBUTION_VERSION: 33
|
||||
FDO_DISTRIBUTION_VERSION: 39
|
||||
FDO_DISTRIBUTION_PACKAGES: 'git autoconf automake libtool make xorg-x11-server-devel libudev-devel libevdev-devel libinput-devel xorg-x11-util-macros'
|
||||
FDO_DISTRIBUTION_EXEC: 'env FDO_CI_CONCURRENT=${FDO_CI_CONCURRENT} bash .gitlab-ci/fedora-install.sh'
|
||||
FDO_DISTRIBUTION_TAG: '2021-09-15.0'
|
||||
FDO_DISTRIBUTION_TAG: '2024-02-20.0'
|
||||
|
||||
|
||||
fedora@container_build:
|
||||
@@ -58,7 +58,7 @@ fedora@container_build:
|
||||
- _builddir/config.log
|
||||
|
||||
|
||||
fedora:33@default-build:
|
||||
fedora@default-build:
|
||||
extends:
|
||||
- .fedora
|
||||
- .fdo.distribution-image@fedora
|
||||
|
||||
24
configure.ac
24
configure.ac
@@ -23,7 +23,7 @@
|
||||
# Initialize Autoconf
|
||||
AC_PREREQ([2.60])
|
||||
AC_INIT([xf86-input-libinput],
|
||||
[1.3.0],
|
||||
[1.5.0],
|
||||
[https://gitlab.freedesktop.org/xorg/driver/xf86-input-libinput/issues],
|
||||
[xf86-input-libinput])
|
||||
AC_CONFIG_SRCDIR([Makefile.am])
|
||||
@@ -89,6 +89,28 @@ AC_LINK_IFELSE(
|
||||
[AC_MSG_RESULT([no])
|
||||
[libinput_have_custom_accel=no]])
|
||||
|
||||
AC_MSG_CHECKING([if libinput_tablet_tool_config_pressure_range_set is available])
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#include <libinput.h>]],
|
||||
[[libinput_tablet_tool_config_pressure_range_set(0)]])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_LIBINPUT_PRESURE_RANGE, [1],
|
||||
[libinput_tablet_tool_config_pressure_range_set() is available])
|
||||
[libinput_have_pressure_range=yes]],
|
||||
[AC_MSG_RESULT([no])
|
||||
[libinput_have_pressure_range=no]])
|
||||
|
||||
AC_MSG_CHECKING([if libinput_device_config_click_set_clickfinger_button_map is available])
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#include <libinput.h>]],
|
||||
[[libinput_device_config_click_set_clickfinger_button_map(NULL, 0)]])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_LIBINPUT_CLICKFINGER_BUTTON_MAP, [1],
|
||||
[libinput_device_config_click_set_clickfinger_button_map() is available])
|
||||
[libinput_have_clickfinger_button_map=yes]],
|
||||
[AC_MSG_RESULT([no])
|
||||
[libinput_have_clickfinger_button_map=no]])
|
||||
|
||||
LIBS=$OLD_LIBS
|
||||
CFLAGS=$OLD_CFLAGS
|
||||
|
||||
|
||||
@@ -51,6 +51,13 @@
|
||||
/* Tap button default order: BOOL, 2 values in order LRM, LMR, read-only */
|
||||
#define LIBINPUT_PROP_TAP_BUTTONMAP_DEFAULT "libinput Tapping Button Mapping Default"
|
||||
|
||||
/* Clickfinger button order: BOOL, 2 values in order LRM, LMR, only one may be set
|
||||
at any time */
|
||||
#define LIBINPUT_PROP_CLICKFINGER_BUTTONMAP "libinput Clickfinger Button Mapping Enabled"
|
||||
|
||||
/* Clickfinger button default order: BOOL, 2 values in order LRM, LMR, read-only */
|
||||
#define LIBINPUT_PROP_CLICKFINGER_BUTTONMAP_DEFAULT "libinput Clickfinger Button Mapping Default"
|
||||
|
||||
/* Calibration matrix: FLOAT, 9 values of a 3x3 matrix, in rows */
|
||||
#define LIBINPUT_PROP_CALIBRATION "libinput Calibration Matrix"
|
||||
|
||||
@@ -222,6 +229,15 @@
|
||||
*/
|
||||
#define LIBINPUT_PROP_TABLET_TOOL_PRESSURECURVE "libinput Tablet Tool Pressurecurve"
|
||||
|
||||
/* Tablet tool pressure range: float, 2 values, 32 bit
|
||||
* Value range is [0.0, 1.0] for min and max physical pressure to map to the logical range
|
||||
* Default value: 0.0 1.0
|
||||
*/
|
||||
#define LIBINPUT_PROP_TABLET_TOOL_PRESSURE_RANGE "libinput Tablet Tool Pressure Range"
|
||||
|
||||
/* Tablet tool pressure range: float, 2 values, 32 bit, read-only */
|
||||
#define LIBINPUT_PROP_TABLET_TOOL_PRESSURE_RANGE_DEFAULT "libinput Tablet Tool Pressure Range Default"
|
||||
|
||||
/* Tablet tool area ratio: CARD32, 2 values, w and h */
|
||||
#define LIBINPUT_PROP_TABLET_TOOL_AREA_RATIO "libinput Tablet Tool Area Ratio"
|
||||
|
||||
@@ -229,4 +245,19 @@
|
||||
* If disabled, high-resolution wheel scroll events are discarded */
|
||||
#define LIBINPUT_PROP_HIRES_WHEEL_SCROLL_ENABLED "libinput High Resolution Wheel Scroll Enabled"
|
||||
|
||||
/* The tablet tool unique serial number: CARD32, 1 value, constant for the
|
||||
* lifetime of the device.
|
||||
*
|
||||
* If this property exists and is zero, the tool does not have a unique serial
|
||||
* number.
|
||||
*/
|
||||
#define LIBINPUT_PROP_TABLET_TOOL_SERIAL "libinput Tablet Tool Serial"
|
||||
|
||||
/* The tablet tool hardware ID: CARD32, 1 value, constant for the lifetime of the device.
|
||||
*
|
||||
* This property only exists if the device has a known tool ID.
|
||||
* See libinput_tablet_tool_get_tool_id() in the libinput documentation for details.
|
||||
*/
|
||||
#define LIBINPUT_PROP_TABLET_TOOL_ID "libinput Tablet Tool ID"
|
||||
|
||||
#endif /* _LIBINPUT_PROPERTIES_H_ */
|
||||
|
||||
101
man/libinput.man
101
man/libinput.man
@@ -54,23 +54,29 @@ on the profiles and their behavior, see the libinput documentation.
|
||||
.BI "Option \*qAccelSpeed\*q \*q" float \*q
|
||||
Sets the pointer acceleration speed within the range [-1, 1].
|
||||
This only applies to the flat or adaptive profile.
|
||||
.BI "Option \*AccelPointsFallback\*q \*q" string \*q
|
||||
Sets the points of the Fallback acceleration function, (see the libinput documentation).
|
||||
.TP 7
|
||||
.BI "Option \*qAccelPointsFallback\*q \*q" string \*q
|
||||
.TQ
|
||||
.BI "Option \*qAccelPointsMotion\*q \*q" string \*q
|
||||
.TQ
|
||||
.BI "Option \*qAccelPointsScroll\*q \*q" string \*q
|
||||
Sets the points of the Fallback/Motion/Scroll acceleration functions.
|
||||
The string must be a space-separated list of floating point non-negative numbers, e.g.
|
||||
"0.0 1.0 2.4 2.5".
|
||||
This only applies to the custom profile.
|
||||
.BI "Option \*AccelStepFallback\*q \*q" float \*q
|
||||
Sets the step between the points of the Fallback acceleration function, (see the libinput documentation).
|
||||
When a step of 0.0 is provided, libinput's default Fallback acceleration function is used.
|
||||
See section
|
||||
.B CUSTOM ACCELERATION PROFILE
|
||||
.TP 7
|
||||
.BI "Option \*qAccelStepFallback\*q \*q" float \*q
|
||||
.TQ
|
||||
.BI "Option \*qAccelStepMotion\*q \*q" float \*q
|
||||
.TQ
|
||||
.BI "Option \*qAccelStepScroll\*q \*q" float \*q
|
||||
Sets the step between the points of the Fallback/Motion/Scroll acceleration functions.
|
||||
When a step of 0.0 is provided, libinput's Fallback acceleration function is used.
|
||||
This only applies to the custom profile.
|
||||
.BI "Option \*AccelPointsMotion\*q \*q" string \*q
|
||||
Equivalent to AccelPointsFallback but applies to the Motion acceleration function.
|
||||
.BI "Option \*AccelStepMotion\*q \*q" float \*q
|
||||
Equivalent to AccelStepFallback but applies to the Motion acceleration function.
|
||||
.BI "Option \*AccelPointsScroll\*q \*q" string \*q
|
||||
Equivalent to AccelPointsFallback but applies to the Scroll acceleration function.
|
||||
.BI "Option \*AccelStepScroll\*q \*q" float \*q
|
||||
Equivalent to AccelStepFallback but applies to the Scroll acceleration function.
|
||||
See section
|
||||
.B CUSTOM ACCELERATION PROFILE
|
||||
.TP 7
|
||||
.BI "Option \*qButtonMapping\*q \*q" string \*q
|
||||
Sets the logical button mapping for this device, see
|
||||
@@ -204,6 +210,14 @@ points. The respective x/y coordinate must be in the [0.0, 1.0] range. For
|
||||
more information see section
|
||||
.B TABLET STYLUS PRESSURE CURVE.
|
||||
.TP 7
|
||||
.BI "Option \*qTabletToolPressureRange\*q \*q" "min max" \*q
|
||||
Set the pressure range for a tablet stylus to the given subset of the physical
|
||||
range. The min/max values must be in the [0.0, 1.0] range. For
|
||||
example a min of 0.3 means the tablet will send 0 pressure for anything equal
|
||||
or below 30% of the physical pressure range and a max of 0.7 means
|
||||
the tablet sends its maximum pressure value for any pressure equal or higher to
|
||||
70% of the physical pressure range.
|
||||
.TP 7
|
||||
.BI "Option \*qTabletToolAreaRatio\*q \*q" "w:h" \*q
|
||||
Sets the area ratio for a tablet tool. The area always starts at the
|
||||
origin (0/0) and expands to the largest available area with the specified
|
||||
@@ -247,15 +261,41 @@ on the device. The following properties are provided by the
|
||||
driver.
|
||||
.TP 7
|
||||
.BI "libinput Accel Profiles Available"
|
||||
2 boolean values (8 bit, 0 or 1), in order "adaptive", "flat".
|
||||
3 boolean values (8 bit, 0 or 1), in order "adaptive", "flat", "custom".
|
||||
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".
|
||||
3 boolean values (8 bit, 0 or 1), in order "adaptive", "flat", "custom".
|
||||
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
|
||||
1 32-bit float value, defines the pointer speed. Value range -1, 1.
|
||||
This only applies to the flat or adaptive profile.
|
||||
.TP 7
|
||||
.BI "libinput Accel Custom Fallback Points"
|
||||
.TQ
|
||||
.BI "libinput Accel Custom Motion Points"
|
||||
.TQ
|
||||
.BI "libinput Accel Custom Scroll Points"
|
||||
A space-separated list of 32-bit floating point non-negative numbers, e.g.
|
||||
"0.0 1.0 2.4 2.5".
|
||||
Sets the points of the Fallback/Motion/Scroll acceleration functions.
|
||||
This only applies to the custom profile.
|
||||
See section
|
||||
.B CUSTOM ACCELERATION PROFILE
|
||||
.TP 7
|
||||
.BI "libinput Accel Custom Fallback Step"
|
||||
.TQ
|
||||
.BI "libinput Accel Custom Motion Step"
|
||||
.TQ
|
||||
.BI "libinput Accel Custom Scroll Step"
|
||||
1 32-bit float value, sets the step between the points of the
|
||||
Fallback/Motion/Scroll acceleration functions.
|
||||
When a step of 0.0 is provided, libinput's Fallback acceleration
|
||||
function is used.
|
||||
This only applies to the custom profile.
|
||||
See section
|
||||
.B CUSTOM ACCELERATION PROFILE
|
||||
.TP 7
|
||||
.BI "libinput Button Scrolling Button"
|
||||
1 32-bit value. Sets the button number to use for button scrolling. This
|
||||
@@ -449,6 +489,35 @@ libinput provides scroll data in pixels. The \fBScrollPixelDistance\fR
|
||||
option defines the amount of movement equivalent to one wheel click. For
|
||||
example, a value of 50 means the user has to move a finger by 50 pixels to
|
||||
generate one logical click event and each pixel is 1/50th of a wheel click.
|
||||
|
||||
.SH CUSTOM ACCELERATION PROFILE
|
||||
The custom pointer acceleration profile gives users full control over the
|
||||
acceleration behavior at different speeds. libinput exposes an acceleration
|
||||
function f(x) where the x-axis is the device speed in device units per millisecond
|
||||
and the y-axis is the pointer speed.
|
||||
.PP
|
||||
The custom acceleration function is defined using n points which are spaced
|
||||
uniformly along the x-axis, starting from 0 and continuing in constant steps.
|
||||
Thus the points defining the custom function are:
|
||||
.EX
|
||||
(0 * step, f[0]), (1 * step, f[1]), ..., ((n-1) * step, f[n-1])
|
||||
.EE
|
||||
When a velocity value does not lie exactly on those points,
|
||||
a linear interpolation/extrapolation of the two closest points will be calculated.
|
||||
.PP
|
||||
There are 3 custom acceleration function, which are used for different movement types:
|
||||
.TS
|
||||
tab(;) allbox;
|
||||
l l l.
|
||||
Movement type; Uses; supported by
|
||||
Fallback; Catch-all default movement type; All devices
|
||||
Motion; Used for pointer motion; All devices
|
||||
Scroll; Used for scroll movement; Mouse, Touchpad
|
||||
.TE
|
||||
.PP
|
||||
See libinput library documentation of more details:
|
||||
https://wayland.freedesktop.org/libinput/doc/latest/pointer-acceleration.html#the-custom-acceleration-profile
|
||||
|
||||
.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
|
||||
|
||||
13
meson.build
13
meson.build
@@ -1,5 +1,5 @@
|
||||
project('xf86-input-libinput', 'c',
|
||||
version: '1.3.0', # bump version in configure.ac
|
||||
version: '1.5.0', # bump version in configure.ac
|
||||
default_options: ['warning_level=2'],
|
||||
meson_version: '>= 0.50.0')
|
||||
|
||||
@@ -57,6 +57,17 @@ if cc.has_function('libinput_config_accel_create',
|
||||
dependencies: dep_libinput)
|
||||
config_h.set('HAVE_LIBINPUT_CUSTOM_ACCEL', 1)
|
||||
endif
|
||||
if cc.has_function('libinput_tablet_tool_config_pressure_range_set',
|
||||
dependencies: dep_libinput)
|
||||
config_h.set('HAVE_LIBINPUT_PRESSURE_RANGE', 1)
|
||||
endif
|
||||
if cc.has_function('libinput_device_config_click_set_clickfinger_button_map',
|
||||
dependencies: dep_libinput)
|
||||
config_h.set('HAVE_LIBINPUT_CLICKFINGER_BUTTON_MAP', 1)
|
||||
endif
|
||||
if cc.has_header_symbol('libinput.h', 'LIBINPUT_LED_COMPOSE')
|
||||
config_h.set('HAVE_LIBINPUT_COMPOSE_AND_KANA', 1)
|
||||
endif
|
||||
|
||||
dir_headers = get_option('sdkdir')
|
||||
if dir_headers == ''
|
||||
|
||||
@@ -80,13 +80,15 @@
|
||||
#define TABLET_STRIP_AXIS_MAX 4096
|
||||
#define TABLET_RING_AXIS_MAX 71
|
||||
|
||||
#define CAP_KEYBOARD 0x1
|
||||
#define CAP_POINTER 0x2
|
||||
#define CAP_TOUCH 0x4
|
||||
#define CAP_TABLET 0x8
|
||||
#define CAP_TABLET_TOOL 0x10
|
||||
#define CAP_TABLET_PAD 0x20
|
||||
#define CAP_GESTURE 0x40
|
||||
enum capabilities {
|
||||
CAP_KEYBOARD = 0x1,
|
||||
CAP_POINTER = 0x2,
|
||||
CAP_TOUCH = 0x4,
|
||||
CAP_TABLET = 0x8,
|
||||
CAP_TABLET_TOOL = 0x10,
|
||||
CAP_TABLET_PAD = 0x20,
|
||||
CAP_GESTURE = 0x40,
|
||||
};
|
||||
|
||||
#if HAVE_INPUTPROTO24
|
||||
#if ABI_XINPUT_VERSION >= SET_ABI_VERSION(24, 4)
|
||||
@@ -177,6 +179,9 @@ struct xf86libinput {
|
||||
float matrix[9];
|
||||
enum libinput_config_scroll_method scroll_method;
|
||||
enum libinput_config_click_method click_method;
|
||||
#if HAVE_LIBINPUT_CLICKFINGER_BUTTON_MAP
|
||||
enum libinput_config_clickfinger_button_map clickfinger_button_map;
|
||||
#endif
|
||||
enum libinput_config_accel_profile accel_profile;
|
||||
#if HAVE_LIBINPUT_CUSTOM_ACCEL
|
||||
struct accel_points accel_points_fallback;
|
||||
@@ -190,6 +195,9 @@ struct xf86libinput {
|
||||
|
||||
float rotation_angle;
|
||||
struct bezier_control_point pressurecurve[4];
|
||||
struct range {
|
||||
float min, max;
|
||||
} pressure_range;
|
||||
struct ratio {
|
||||
int x, y;
|
||||
} area;
|
||||
@@ -254,6 +262,7 @@ btn_linux2xorg(unsigned int b)
|
||||
/* tablet button range */
|
||||
case BTN_STYLUS: button = 2; break;
|
||||
case BTN_STYLUS2: button = 3; break;
|
||||
case BTN_STYLUS3: button = 8; break;
|
||||
default:
|
||||
button = 8 + b - BTN_SIDE;
|
||||
break;
|
||||
@@ -452,6 +461,25 @@ xf86libinput_set_pressurecurve(struct xf86libinput *driver_data,
|
||||
driver_data->pressurecurve.sz);
|
||||
}
|
||||
|
||||
static inline bool
|
||||
xf86libinput_set_pressure_range(struct xf86libinput *driver_data,
|
||||
const struct range *range)
|
||||
{
|
||||
#if HAVE_LIBINPUT_PRESSURE_RANGE
|
||||
struct libinput_tablet_tool *tool = driver_data->tablet_tool;
|
||||
|
||||
if (!tool)
|
||||
return FALSE;
|
||||
|
||||
return libinput_tablet_tool_config_pressure_range_is_available(tool) &&
|
||||
libinput_tablet_tool_config_pressure_range_set(tool,
|
||||
range->min,
|
||||
range->max) == LIBINPUT_CONFIG_STATUS_SUCCESS;
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
xf86libinput_set_area_ratio(struct xf86libinput *driver_data,
|
||||
const struct ratio *ratio)
|
||||
@@ -498,8 +526,10 @@ subdevice_has_capabilities(DeviceIntPtr dev, uint32_t capabilities)
|
||||
}
|
||||
|
||||
static int
|
||||
LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||
BOOL checkonly);
|
||||
LibinputSetProperty(DeviceIntPtr dev, Atom atom,
|
||||
XIPropertyValuePtr val,
|
||||
BOOL checkonly);
|
||||
|
||||
static void
|
||||
LibinputInitProperty(DeviceIntPtr dev);
|
||||
|
||||
@@ -730,7 +760,7 @@ LibinputApplyConfigLeftHanded(DeviceIntPtr dev,
|
||||
{
|
||||
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||
|
||||
if (!subdevice_has_capabilities(dev, CAP_POINTER|CAP_TABLET))
|
||||
if (!subdevice_has_capabilities(dev, CAP_POINTER|CAP_TABLET|CAP_TABLET_TOOL))
|
||||
return;
|
||||
|
||||
if (libinput_device_config_left_handed_is_available(device) &&
|
||||
@@ -801,6 +831,7 @@ LibinputApplyConfigClickMethod(DeviceIntPtr dev,
|
||||
struct libinput_device *device)
|
||||
{
|
||||
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||
uint32_t click_methods = libinput_device_config_click_get_methods(device);
|
||||
|
||||
if (!subdevice_has_capabilities(dev, CAP_POINTER))
|
||||
return;
|
||||
@@ -821,6 +852,24 @@ LibinputApplyConfigClickMethod(DeviceIntPtr dev,
|
||||
"Failed to set click method to %s\n",
|
||||
method);
|
||||
}
|
||||
|
||||
#if HAVE_LIBINPUT_CLICKFINGER_BUTTON_MAP
|
||||
if (click_methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER &&
|
||||
libinput_device_config_click_set_clickfinger_button_map(device,
|
||||
driver_data->options.clickfinger_button_map) != LIBINPUT_CONFIG_STATUS_SUCCESS) {
|
||||
const char *map;
|
||||
|
||||
switch (driver_data->options.clickfinger_button_map) {
|
||||
case LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM: map = "LRM"; break;
|
||||
case LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR: map = "LMR"; break;
|
||||
default:
|
||||
map = "unknown"; break;
|
||||
}
|
||||
xf86IDrvMsg(pInfo, X_ERROR,
|
||||
"Failed to set clickfinger button map to %s\n",
|
||||
map);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -876,6 +925,27 @@ LibinputApplyConfigRotation(DeviceIntPtr dev,
|
||||
driver_data->options.rotation_angle);
|
||||
}
|
||||
|
||||
static void
|
||||
LibinputApplyConfigPressureRange(DeviceIntPtr dev,
|
||||
struct xf86libinput *driver_data,
|
||||
struct libinput_device *device)
|
||||
{
|
||||
#if HAVE_LIBINPUT_PRESSURE_RANGE
|
||||
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||
struct libinput_tablet_tool *tool = driver_data->tablet_tool;
|
||||
struct range *range = &driver_data->options.pressure_range;
|
||||
|
||||
if (!subdevice_has_capabilities(dev, CAP_TABLET_TOOL))
|
||||
return;
|
||||
|
||||
if (tool && libinput_tablet_tool_config_pressure_range_is_available(tool) &&
|
||||
libinput_tablet_tool_config_pressure_range_set(tool, range->min, range->max) != LIBINPUT_CONFIG_STATUS_SUCCESS)
|
||||
xf86IDrvMsg(pInfo, X_ERROR,
|
||||
"Failed to set PressureRange to %.2f..%.2f\n",
|
||||
range->min, range->max);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline void
|
||||
LibinputApplyConfig(DeviceIntPtr dev)
|
||||
{
|
||||
@@ -894,6 +964,7 @@ LibinputApplyConfig(DeviceIntPtr dev)
|
||||
LibinputApplyConfigMiddleEmulation(dev, driver_data, device);
|
||||
LibinputApplyConfigDisableWhileTyping(dev, driver_data, device);
|
||||
LibinputApplyConfigRotation(dev, driver_data, device);
|
||||
LibinputApplyConfigPressureRange(dev, driver_data, device);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -1095,35 +1166,41 @@ xf86libinput_init_pointer_absolute(InputInfoPtr pInfo)
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
static void
|
||||
xf86libinput_kbd_ctrl(DeviceIntPtr device, KeybdCtrl *ctrl)
|
||||
{
|
||||
#define CAPSFLAG 1
|
||||
#define NUMFLAG 2
|
||||
#define SCROLLFLAG 4
|
||||
#define CAPSFLAG 1
|
||||
#define NUMFLAG 2
|
||||
#define SCROLLFLAG 4
|
||||
#define COMPOSEFLAG 8
|
||||
#define KANAFLAG 16
|
||||
static struct { int xbit, code; } bits[] = {
|
||||
{ CAPSFLAG, LIBINPUT_LED_CAPS_LOCK },
|
||||
{ NUMFLAG, LIBINPUT_LED_NUM_LOCK },
|
||||
{ SCROLLFLAG, LIBINPUT_LED_SCROLL_LOCK },
|
||||
#ifdef HAVE_LIBINPUT_COMPOSE_AND_KANA
|
||||
{ COMPOSEFLAG, LIBINPUT_LED_COMPOSE },
|
||||
{ KANAFLAG, LIBINPUT_LED_KANA },
|
||||
#endif
|
||||
{ 0, 0 },
|
||||
};
|
||||
int i = 0;
|
||||
enum libinput_led leds = 0;
|
||||
InputInfoPtr pInfo = device->public.devicePrivate;
|
||||
struct xf86libinput *driver_data = pInfo->private;
|
||||
struct libinput_device *ldevice = driver_data->shared_device->device;
|
||||
|
||||
static struct { int xbit, code; } bits[] = {
|
||||
{ CAPSFLAG, LIBINPUT_LED_CAPS_LOCK },
|
||||
{ NUMFLAG, LIBINPUT_LED_NUM_LOCK },
|
||||
{ SCROLLFLAG, LIBINPUT_LED_SCROLL_LOCK },
|
||||
{ 0, 0 },
|
||||
};
|
||||
int i = 0;
|
||||
enum libinput_led leds = 0;
|
||||
InputInfoPtr pInfo = device->public.devicePrivate;
|
||||
struct xf86libinput *driver_data = pInfo->private;
|
||||
struct libinput_device *ldevice = driver_data->shared_device->device;
|
||||
if (!device->enabled)
|
||||
return;
|
||||
|
||||
if (!device->enabled)
|
||||
return;
|
||||
while (bits[i].xbit) {
|
||||
if (ctrl->leds & bits[i].xbit)
|
||||
leds |= bits[i].code;
|
||||
i++;
|
||||
}
|
||||
|
||||
while (bits[i].xbit) {
|
||||
if (ctrl->leds & bits[i].xbit)
|
||||
leds |= bits[i].code;
|
||||
i++;
|
||||
}
|
||||
|
||||
libinput_device_led_update(ldevice, leds);
|
||||
libinput_device_led_update(ldevice, leds);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -1317,7 +1394,10 @@ xf86libinput_init_tablet(InputInfoPtr pInfo)
|
||||
int nbuttons = TABLET_NUM_BUTTONS;
|
||||
int naxes = 2;
|
||||
|
||||
BUG_RETURN(driver_data->tablet_tool == NULL);
|
||||
if (driver_data->tablet_tool == NULL) {
|
||||
xf86IDrvMsg(pInfo, X_WARNING, "BUG: tablet_tool is NULL\n");
|
||||
return;
|
||||
}
|
||||
|
||||
tool = driver_data->tablet_tool;
|
||||
|
||||
@@ -1435,7 +1515,10 @@ xf86libinput_init(DeviceIntPtr dev)
|
||||
struct xf86libinput_device *shared_device = driver_data->shared_device;
|
||||
struct libinput_device *device = shared_device->device;
|
||||
|
||||
BUG_RETURN_VAL(device == NULL, !Success);
|
||||
if (device == NULL) {
|
||||
xf86IDrvMsg(pInfo, X_WARNING, "BUG: xf86libinput_init() device is NULL\n");
|
||||
return !Success;
|
||||
}
|
||||
|
||||
dev->public.on = FALSE;
|
||||
|
||||
@@ -1497,12 +1580,13 @@ swap_registered_device(InputInfoPtr pInfo)
|
||||
return;
|
||||
|
||||
next = xf86FirstLocalDevice();
|
||||
while (next == pInfo || !is_libinput_device(next))
|
||||
while (next && (next == pInfo || !is_libinput_device(next)))
|
||||
next = next->next;
|
||||
|
||||
input_lock();
|
||||
xf86RemoveEnabledDevice(pInfo);
|
||||
xf86AddEnabledDevice(next);
|
||||
if (next)
|
||||
xf86AddEnabledDevice(next);
|
||||
driver_context.registered_InputInfoPtr = next;
|
||||
input_unlock();
|
||||
}
|
||||
@@ -1645,6 +1729,14 @@ xf86libinput_handle_key(InputInfoPtr pInfo, struct libinput_event_keyboard *even
|
||||
if ((driver_data->capabilities & CAP_KEYBOARD) == 0)
|
||||
return;
|
||||
|
||||
/* keycodes > 256 that have a historical mapping in xkeyboard-config */
|
||||
switch (key) {
|
||||
case KEY_TOUCHPAD_TOGGLE: key = KEY_F21; break;
|
||||
case KEY_TOUCHPAD_ON: key = KEY_F22; break;
|
||||
case KEY_TOUCHPAD_OFF: key = KEY_F23; break;
|
||||
case KEY_MICMUTE: key = KEY_F20; break;
|
||||
}
|
||||
|
||||
key += XORG_KEYCODE_OFFSET;
|
||||
|
||||
is_press = (libinput_event_keyboard_get_key_state(event) == LIBINPUT_KEY_STATE_PRESSED);
|
||||
@@ -2406,7 +2498,10 @@ xf86libinput_handle_tablet_proximity(InputInfoPtr pInfo,
|
||||
if (xf86libinput_tool_queue_event(event))
|
||||
return EVENT_QUEUED;
|
||||
|
||||
BUG_RETURN_VAL(pDev == NULL, EVENT_HANDLED);
|
||||
if (pDev == NULL) {
|
||||
xf86IDrvMsg(pInfo, X_WARNING, "BUG: xf86libinput_handle_tablet_proximity() pDev is NULL\n");
|
||||
return EVENT_HANDLED;
|
||||
}
|
||||
|
||||
x = libinput_event_tablet_tool_get_x_transformed(event, TABLET_AXIS_MAX);
|
||||
y = libinput_event_tablet_tool_get_y_transformed(event, TABLET_AXIS_MAX);
|
||||
@@ -2650,7 +2745,7 @@ xf86libinput_read_input(InputInfoPtr pInfo)
|
||||
int rc;
|
||||
struct libinput_event *event;
|
||||
|
||||
rc = libinput_dispatch(libinput);
|
||||
rc = libinput_dispatch(libinput);
|
||||
if (rc == -EAGAIN)
|
||||
return;
|
||||
|
||||
@@ -2878,6 +2973,46 @@ xf86libinput_parse_tap_buttonmap_option(InputInfoPtr pInfo,
|
||||
return map;
|
||||
}
|
||||
|
||||
#if HAVE_LIBINPUT_CLICKFINGER_BUTTON_MAP
|
||||
static inline enum libinput_config_clickfinger_button_map
|
||||
xf86libinput_parse_clickfinger_map_option(InputInfoPtr pInfo,
|
||||
struct libinput_device *device)
|
||||
{
|
||||
uint32_t click_methods = libinput_device_config_click_get_methods(device);
|
||||
enum libinput_config_clickfinger_button_map map;
|
||||
char *str;
|
||||
|
||||
map = libinput_device_config_click_get_clickfinger_button_map(device);
|
||||
if ((click_methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER) == 0)
|
||||
return map;
|
||||
|
||||
str = xf86SetStrOption(pInfo->options,
|
||||
"ClickfingerButtonMap",
|
||||
NULL);
|
||||
if (str) {
|
||||
if (streq(str, "lmr"))
|
||||
map = LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR;
|
||||
else if (streq(str, "lrm"))
|
||||
map = LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM;
|
||||
else
|
||||
xf86IDrvMsg(pInfo, X_ERROR,
|
||||
"Invalid ClickfingerButtonMap: %s\n",
|
||||
str);
|
||||
free(str);
|
||||
}
|
||||
|
||||
if (libinput_device_config_click_set_clickfinger_button_map(device, map) !=
|
||||
LIBINPUT_CONFIG_STATUS_SUCCESS) {
|
||||
xf86IDrvMsg(pInfo, X_ERROR,
|
||||
"Failed to set Clickfinger Button Map to %d\n",
|
||||
map);
|
||||
map = libinput_device_config_click_get_clickfinger_button_map(device);
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline double
|
||||
xf86libinput_parse_accel_option(InputInfoPtr pInfo,
|
||||
struct libinput_device *device)
|
||||
@@ -3526,6 +3661,46 @@ out:
|
||||
xf86libinput_set_pressurecurve(driver_data, controls);
|
||||
}
|
||||
|
||||
static void
|
||||
xf86libinput_parse_pressure_range_option(InputInfoPtr pInfo,
|
||||
struct xf86libinput *driver_data,
|
||||
struct range *range)
|
||||
{
|
||||
#if HAVE_LIBINPUT_PRESSURE_RANGE
|
||||
struct libinput_tablet_tool *tool = driver_data->tablet_tool;
|
||||
float min, max;
|
||||
char *str;
|
||||
int rc;
|
||||
|
||||
range->min = 0.0;
|
||||
range->max = 1.0;
|
||||
|
||||
if ((driver_data->capabilities & CAP_TABLET_TOOL) == 0)
|
||||
return;
|
||||
|
||||
if (!tool || !libinput_tablet_tool_config_pressure_range_is_available(tool))
|
||||
return;
|
||||
|
||||
str = xf86SetStrOption(pInfo->options,
|
||||
"TabletToolPressureRange",
|
||||
NULL);
|
||||
if (!str)
|
||||
return;
|
||||
|
||||
rc = sscanf(str, "%f %f", &min, &max);
|
||||
if (rc != 2)
|
||||
goto out;
|
||||
|
||||
if (min < 0.0 || max > 1.0 || min >= max)
|
||||
goto out;
|
||||
|
||||
range->min = min;
|
||||
range->max = max;
|
||||
out:
|
||||
free(str);
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline bool
|
||||
want_area_handling(struct xf86libinput *driver_data)
|
||||
{
|
||||
@@ -3598,6 +3773,9 @@ xf86libinput_parse_options(InputInfoPtr pInfo,
|
||||
options->scroll_buttonlock = xf86libinput_parse_scrollbuttonlock_option(pInfo, device);
|
||||
options->scroll_pixel_distance = xf86libinput_parse_scroll_pixel_distance_option(pInfo, device);
|
||||
options->click_method = xf86libinput_parse_clickmethod_option(pInfo, device);
|
||||
#if HAVE_LIBINPUT_CLICKFINGER_BUTTON_MAP
|
||||
options->clickfinger_button_map = xf86libinput_parse_clickfinger_map_option(pInfo, device);
|
||||
#endif
|
||||
options->middle_emulation = xf86libinput_parse_middleemulation_option(pInfo, device);
|
||||
options->disable_while_typing = xf86libinput_parse_disablewhiletyping_option(pInfo, device);
|
||||
options->rotation_angle = xf86libinput_parse_rotation_angle_option(pInfo, device);
|
||||
@@ -3616,6 +3794,7 @@ xf86libinput_parse_options(InputInfoPtr pInfo,
|
||||
xf86libinput_parse_pressurecurve_option(pInfo,
|
||||
driver_data,
|
||||
options->pressurecurve);
|
||||
xf86libinput_parse_pressure_range_option(pInfo, driver_data, &options->pressure_range);
|
||||
xf86libinput_parse_tablet_area_option(pInfo,
|
||||
driver_data,
|
||||
&options->area);
|
||||
@@ -4079,6 +4258,8 @@ static Atom prop_scroll_pixel_distance_default;
|
||||
static Atom prop_click_methods_available;
|
||||
static Atom prop_click_method_enabled;
|
||||
static Atom prop_click_method_default;
|
||||
static Atom prop_clickfinger_buttonmap;
|
||||
static Atom prop_clickfinger_buttonmap_default;
|
||||
static Atom prop_middle_emulation;
|
||||
static Atom prop_middle_emulation_default;
|
||||
static Atom prop_disable_while_typing;
|
||||
@@ -4090,12 +4271,16 @@ static Atom prop_mode_groups_rings;
|
||||
static Atom prop_mode_groups_strips;
|
||||
static Atom prop_rotation_angle;
|
||||
static Atom prop_rotation_angle_default;
|
||||
static Atom prop_pressure_range;
|
||||
static Atom prop_pressure_range_default;
|
||||
|
||||
/* driver properties */
|
||||
static Atom prop_draglock;
|
||||
static Atom prop_horiz_scroll;
|
||||
static Atom prop_pressurecurve;
|
||||
static Atom prop_area_ratio;
|
||||
static Atom prop_serial;
|
||||
static Atom prop_tool_id;
|
||||
static Atom prop_hires_scroll;
|
||||
|
||||
/* general properties */
|
||||
@@ -4206,7 +4391,8 @@ xf86libinput_check_device(DeviceIntPtr dev,
|
||||
struct libinput_device *device = driver_data->shared_device->device;
|
||||
|
||||
if (device == NULL) {
|
||||
BUG_WARN(dev->public.on);
|
||||
if (dev->public.on)
|
||||
xf86IDrvMsg(pInfo, X_WARNING, "BUG: xf86libinput_check_device() device is on\n");
|
||||
xf86IDrvMsg(pInfo, X_INFO,
|
||||
"SetProperty on %u called but device is disabled.\n"
|
||||
"This driver cannot change properties on a disabled device\n",
|
||||
@@ -4219,9 +4405,9 @@ xf86libinput_check_device(DeviceIntPtr dev,
|
||||
|
||||
static inline int
|
||||
LibinputSetPropertyTap(DeviceIntPtr dev,
|
||||
Atom atom,
|
||||
XIPropertyValuePtr val,
|
||||
BOOL checkonly)
|
||||
Atom atom,
|
||||
XIPropertyValuePtr val,
|
||||
BOOL checkonly)
|
||||
{
|
||||
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||
struct xf86libinput *driver_data = pInfo->private;
|
||||
@@ -4349,8 +4535,8 @@ LibinputSetPropertyTapButtonmap(DeviceIntPtr dev,
|
||||
|
||||
static inline int
|
||||
LibinputSetPropertyCalibration(DeviceIntPtr dev,
|
||||
Atom atom,
|
||||
XIPropertyValuePtr val,
|
||||
Atom atom,
|
||||
XIPropertyValuePtr val,
|
||||
BOOL checkonly)
|
||||
{
|
||||
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||
@@ -4500,6 +4686,8 @@ LibinputSetPropertyAccelPoints(DeviceIntPtr dev,
|
||||
accel_points = &driver_data->options.accel_points_motion;
|
||||
else if (atom == prop_accel_points_scroll)
|
||||
accel_points = &driver_data->options.accel_points_scroll;
|
||||
else
|
||||
return BadValue;
|
||||
|
||||
for (size_t idx = 0; idx < val->size; idx++)
|
||||
accel_points->points[idx] = data[idx];
|
||||
@@ -4552,9 +4740,9 @@ LibinputSetPropertyAccelStep(DeviceIntPtr dev,
|
||||
|
||||
static inline int
|
||||
LibinputSetPropertyNaturalScroll(DeviceIntPtr dev,
|
||||
Atom atom,
|
||||
XIPropertyValuePtr val,
|
||||
BOOL checkonly)
|
||||
Atom atom,
|
||||
XIPropertyValuePtr val,
|
||||
BOOL checkonly)
|
||||
{
|
||||
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||
struct xf86libinput *driver_data = pInfo->private;
|
||||
@@ -4820,6 +5008,46 @@ LibinputSetPropertyClickMethod(DeviceIntPtr dev,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static inline int
|
||||
LibinputSetPropertyClickfingerButtonmap(DeviceIntPtr dev,
|
||||
Atom atom,
|
||||
XIPropertyValuePtr val,
|
||||
BOOL checkonly)
|
||||
{
|
||||
#if HAVE_LIBINPUT_CLICKFINGER_BUTTON_MAP
|
||||
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||
struct xf86libinput *driver_data = pInfo->private;
|
||||
BOOL* data;
|
||||
enum libinput_config_clickfinger_button_map map;
|
||||
|
||||
if (val->format != 8 || val->size != 2 || val->type != XA_INTEGER)
|
||||
return BadMatch;
|
||||
|
||||
data = (BOOL*)val->data;
|
||||
|
||||
if (checkonly) {
|
||||
if ((data[0] && data[1]) || (!data[0] && !data[1]))
|
||||
return BadValue;
|
||||
|
||||
if (!xf86libinput_check_device(dev, atom))
|
||||
return BadMatch;
|
||||
}
|
||||
|
||||
if (data[0])
|
||||
map = LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM;
|
||||
else if (data[1])
|
||||
map = LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR;
|
||||
else
|
||||
return BadValue;
|
||||
|
||||
if (!checkonly)
|
||||
driver_data->options.clickfinger_button_map = map;
|
||||
|
||||
#endif
|
||||
return Success;
|
||||
}
|
||||
|
||||
|
||||
static inline int
|
||||
LibinputSetPropertyMiddleEmulation(DeviceIntPtr dev,
|
||||
Atom atom,
|
||||
@@ -4912,6 +5140,7 @@ prop_draglock_set_pairs(struct xf86libinput *driver_data,
|
||||
int data[MAX_BUTTONS + 1] = {0};
|
||||
int i;
|
||||
int highest = 0;
|
||||
const unsigned int max = MAX_BUTTONS;
|
||||
|
||||
if (len >= ARRAY_SIZE(data))
|
||||
return BadMatch;
|
||||
@@ -4922,7 +5151,7 @@ prop_draglock_set_pairs(struct xf86libinput *driver_data,
|
||||
dl = (checkonly) ? &dummy : &driver_data->draglock;
|
||||
|
||||
for (i = 0; i < len; i += 2) {
|
||||
if (pairs[i] > MAX_BUTTONS)
|
||||
if (pairs[i] > max)
|
||||
return BadValue;
|
||||
|
||||
data[pairs[i]] = pairs[i+1];
|
||||
@@ -5094,6 +5323,42 @@ LibinputSetPropertyPressureCurve(DeviceIntPtr dev,
|
||||
return Success;
|
||||
}
|
||||
|
||||
static inline int
|
||||
LibinputSetPropertyPressureRange(DeviceIntPtr dev,
|
||||
Atom atom,
|
||||
XIPropertyValuePtr val,
|
||||
BOOL checkonly)
|
||||
{
|
||||
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||
struct xf86libinput *driver_data = pInfo->private;
|
||||
float *vals;
|
||||
struct range range = { 0.0, 1.0 };
|
||||
|
||||
if (val->format != 32 || val->size != 2 || val->type != prop_float)
|
||||
return BadMatch;
|
||||
|
||||
vals = val->data;
|
||||
range.min = vals[0];
|
||||
range.max = vals[1];
|
||||
|
||||
if (checkonly) {
|
||||
if (range.min < 0.0 || range.max > 1.0 || range.min >= range.max)
|
||||
return BadValue;
|
||||
|
||||
/* Disallow reducing the range to less than 20% of the range, mostly
|
||||
* to avoid footguns */
|
||||
if (range.max - range.min < 0.2)
|
||||
return BadValue;
|
||||
|
||||
if (!xf86libinput_check_device(dev, atom))
|
||||
return BadMatch;
|
||||
} else {
|
||||
driver_data->options.pressure_range = range;
|
||||
}
|
||||
|
||||
return Success;
|
||||
}
|
||||
|
||||
static inline int
|
||||
LibinputSetPropertyAreaRatio(DeviceIntPtr dev,
|
||||
Atom atom,
|
||||
@@ -5178,8 +5443,9 @@ LibinputSetPropertyHighResolutionScroll(DeviceIntPtr dev,
|
||||
}
|
||||
|
||||
static int
|
||||
LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||
BOOL checkonly)
|
||||
LibinputSetProperty(DeviceIntPtr dev, Atom atom,
|
||||
XIPropertyValuePtr val,
|
||||
BOOL checkonly)
|
||||
{
|
||||
int rc;
|
||||
|
||||
@@ -5222,6 +5488,8 @@ LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||
rc = LibinputSetPropertyScrollButtonLock(dev, atom, val, checkonly);
|
||||
else if (atom == prop_click_method_enabled)
|
||||
rc = LibinputSetPropertyClickMethod(dev, atom, val, checkonly);
|
||||
else if (atom == prop_clickfinger_buttonmap)
|
||||
rc = LibinputSetPropertyClickfingerButtonmap(dev, atom, val, checkonly);
|
||||
else if (atom == prop_middle_emulation)
|
||||
rc = LibinputSetPropertyMiddleEmulation(dev, atom, val, checkonly);
|
||||
else if (atom == prop_disable_while_typing)
|
||||
@@ -5245,36 +5513,43 @@ LibinputSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||
rc = LibinputSetPropertyRotationAngle(dev, atom, val, checkonly);
|
||||
else if (atom == prop_pressurecurve)
|
||||
rc = LibinputSetPropertyPressureCurve(dev, atom, val, checkonly);
|
||||
else if (atom == prop_pressure_range)
|
||||
rc = LibinputSetPropertyPressureRange(dev, atom, val, checkonly);
|
||||
else if (atom == prop_area_ratio)
|
||||
rc = LibinputSetPropertyAreaRatio(dev, atom, val, checkonly);
|
||||
else if (atom == prop_hires_scroll)
|
||||
rc = LibinputSetPropertyHighResolutionScroll(dev, atom, val, checkonly);
|
||||
else if (atom == prop_device || atom == prop_product_id ||
|
||||
atom == prop_tap_default ||
|
||||
atom == prop_tap_drag_default ||
|
||||
atom == prop_tap_drag_lock_default ||
|
||||
atom == prop_tap_buttonmap_default ||
|
||||
atom == prop_calibration_default ||
|
||||
atom == prop_accel_default ||
|
||||
else if (atom == prop_accel_default ||
|
||||
atom == prop_accel_profile_default ||
|
||||
atom == prop_natural_scroll_default ||
|
||||
atom == prop_sendevents_default ||
|
||||
atom == prop_sendevents_available ||
|
||||
atom == prop_left_handed_default ||
|
||||
atom == prop_scroll_method_default ||
|
||||
atom == prop_scroll_methods_available ||
|
||||
atom == prop_scroll_button_default ||
|
||||
atom == prop_scroll_buttonlock_default ||
|
||||
atom == prop_scroll_pixel_distance_default ||
|
||||
atom == prop_calibration_default ||
|
||||
atom == prop_click_method_default ||
|
||||
atom == prop_click_methods_available ||
|
||||
atom == prop_middle_emulation_default ||
|
||||
atom == prop_clickfinger_buttonmap_default ||
|
||||
atom == prop_disable_while_typing_default ||
|
||||
atom == prop_left_handed_default ||
|
||||
atom == prop_middle_emulation_default ||
|
||||
atom == prop_mode_groups_available ||
|
||||
atom == prop_mode_groups_buttons ||
|
||||
atom == prop_mode_groups_rings ||
|
||||
atom == prop_mode_groups_strips ||
|
||||
atom == prop_rotation_angle_default)
|
||||
atom == prop_natural_scroll_default ||
|
||||
atom == prop_product_id ||
|
||||
atom == prop_pressure_range_default ||
|
||||
atom == prop_rotation_angle_default ||
|
||||
atom == prop_scroll_button_default ||
|
||||
atom == prop_scroll_buttonlock_default ||
|
||||
atom == prop_scroll_method_default ||
|
||||
atom == prop_scroll_methods_available ||
|
||||
atom == prop_scroll_pixel_distance_default ||
|
||||
atom == prop_sendevents_available ||
|
||||
atom == prop_sendevents_default ||
|
||||
atom == prop_serial ||
|
||||
atom == prop_tap_buttonmap_default ||
|
||||
atom == prop_tap_default ||
|
||||
atom == prop_tap_drag_default ||
|
||||
atom == prop_tap_drag_lock_default ||
|
||||
atom == prop_tool_id ||
|
||||
atom == prop_device)
|
||||
return BadAccess; /* read-only */
|
||||
else
|
||||
return Success;
|
||||
@@ -5726,7 +6001,7 @@ LibinputInitLeftHandedProperty(DeviceIntPtr dev,
|
||||
{
|
||||
BOOL left_handed = driver_data->options.left_handed;
|
||||
|
||||
if (!subdevice_has_capabilities(dev, CAP_POINTER|CAP_TABLET))
|
||||
if (!subdevice_has_capabilities(dev, CAP_POINTER|CAP_TABLET|CAP_TABLET_TOOL))
|
||||
return;
|
||||
|
||||
if (!libinput_device_config_left_handed_is_available(device) ||
|
||||
@@ -5951,6 +6226,63 @@ LibinputInitClickMethodsProperty(DeviceIntPtr dev,
|
||||
methods);
|
||||
}
|
||||
|
||||
static void
|
||||
LibinputInitClickfingerButtonmapProperty(DeviceIntPtr dev,
|
||||
struct xf86libinput *driver_data,
|
||||
struct libinput_device *device)
|
||||
{
|
||||
#if HAVE_LIBINPUT_CLICKFINGER_BUTTON_MAP
|
||||
enum libinput_config_clickfinger_button_map map;
|
||||
BOOL data[2] = {0};
|
||||
|
||||
if (!subdevice_has_capabilities(dev, CAP_POINTER))
|
||||
return;
|
||||
|
||||
uint32_t click_methods = libinput_device_config_click_get_methods(device);
|
||||
if ((click_methods & LIBINPUT_CONFIG_CLICK_METHOD_CLICKFINGER) == 0)
|
||||
return;
|
||||
|
||||
map = driver_data->options.clickfinger_button_map;
|
||||
|
||||
switch (map) {
|
||||
case LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM:
|
||||
data[0] = 1;
|
||||
break;
|
||||
case LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR:
|
||||
data[1] = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
prop_clickfinger_buttonmap = LibinputMakeProperty(dev,
|
||||
LIBINPUT_PROP_CLICKFINGER_BUTTONMAP,
|
||||
XA_INTEGER, 8,
|
||||
2, data);
|
||||
if (!prop_clickfinger_buttonmap)
|
||||
return;
|
||||
|
||||
map = libinput_device_config_click_get_default_clickfinger_button_map(device);
|
||||
memset(data, 0, sizeof(data));
|
||||
|
||||
switch (map) {
|
||||
case LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM:
|
||||
data[0] = 1;
|
||||
break;
|
||||
case LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR:
|
||||
data[1] = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
prop_clickfinger_buttonmap_default = LibinputMakeProperty(dev,
|
||||
LIBINPUT_PROP_CLICKFINGER_BUTTONMAP_DEFAULT,
|
||||
XA_INTEGER, 8,
|
||||
2, data);
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
LibinputInitMiddleEmulationProperty(DeviceIntPtr dev,
|
||||
struct xf86libinput *driver_data,
|
||||
@@ -6244,6 +6576,44 @@ LibinputInitPressureCurveProperty(DeviceIntPtr dev,
|
||||
8, data);
|
||||
}
|
||||
|
||||
static void
|
||||
LibinputInitPressureRangeProperty(DeviceIntPtr dev,
|
||||
struct xf86libinput *driver_data)
|
||||
{
|
||||
#if HAVE_LIBINPUT_PRESSURE_RANGE
|
||||
struct libinput_tablet_tool *tool = driver_data->tablet_tool;
|
||||
const struct range *range = &driver_data->options.pressure_range;
|
||||
float data[2] = {
|
||||
range->min,
|
||||
range->max,
|
||||
};
|
||||
|
||||
if ((driver_data->capabilities & CAP_TABLET_TOOL) == 0)
|
||||
return;
|
||||
|
||||
|
||||
if (!tool || !libinput_tablet_tool_config_pressure_range_is_available(tool))
|
||||
return;
|
||||
|
||||
prop_pressure_range = LibinputMakeProperty(dev,
|
||||
LIBINPUT_PROP_TABLET_TOOL_PRESSURE_RANGE,
|
||||
prop_float, 32,
|
||||
2, &data);
|
||||
if (!prop_pressure_range)
|
||||
return;
|
||||
|
||||
data[0] = libinput_tablet_tool_config_pressure_range_get_default_minimum(tool);
|
||||
data[1] = libinput_tablet_tool_config_pressure_range_get_default_maximum(tool);
|
||||
prop_pressure_range_default = LibinputMakeProperty(dev,
|
||||
LIBINPUT_PROP_TABLET_TOOL_PRESSURE_RANGE_DEFAULT,
|
||||
prop_float, 32,
|
||||
2, &data);
|
||||
|
||||
if (!prop_pressure_range_default)
|
||||
return;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
LibinputInitTabletAreaRatioProperty(DeviceIntPtr dev,
|
||||
struct xf86libinput *driver_data)
|
||||
@@ -6263,6 +6633,36 @@ LibinputInitTabletAreaRatioProperty(DeviceIntPtr dev,
|
||||
2, data);
|
||||
}
|
||||
|
||||
static void
|
||||
LibinputInitTabletSerialProperty(DeviceIntPtr dev,
|
||||
struct xf86libinput *driver_data)
|
||||
{
|
||||
struct libinput_tablet_tool *tool = driver_data->tablet_tool;
|
||||
uint32_t serial, tool_id;
|
||||
|
||||
if ((driver_data->capabilities & CAP_TABLET_TOOL) == 0)
|
||||
return;
|
||||
|
||||
if (!tool)
|
||||
return;
|
||||
|
||||
/* Serial prop is always created to indicate when we don't have a serial */
|
||||
serial = libinput_tablet_tool_get_serial(tool);
|
||||
prop_serial = LibinputMakeProperty(dev,
|
||||
LIBINPUT_PROP_TABLET_TOOL_SERIAL,
|
||||
XA_CARDINAL, 32,
|
||||
1, &serial);
|
||||
|
||||
/* The tool ID prop is only created if we have a known tool id */
|
||||
tool_id = libinput_tablet_tool_get_tool_id(tool);
|
||||
if (tool_id) {
|
||||
prop_tool_id = LibinputMakeProperty(dev,
|
||||
LIBINPUT_PROP_TABLET_TOOL_ID,
|
||||
XA_CARDINAL, 32,
|
||||
1, &tool_id);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
LibinputInitHighResolutionScrollProperty(DeviceIntPtr dev,
|
||||
struct xf86libinput *driver_data,
|
||||
@@ -6299,6 +6699,7 @@ LibinputInitProperty(DeviceIntPtr dev)
|
||||
LibinputInitDisableWhileTypingProperty(dev, driver_data, device);
|
||||
LibinputInitScrollMethodsProperty(dev, driver_data, device);
|
||||
LibinputInitClickMethodsProperty(dev, driver_data, device);
|
||||
LibinputInitClickfingerButtonmapProperty(dev, driver_data, device);
|
||||
LibinputInitMiddleEmulationProperty(dev, driver_data, device);
|
||||
LibinputInitRotationAngleProperty(dev, driver_data, device);
|
||||
LibinputInitAccelProperty(dev, driver_data, device);
|
||||
@@ -6337,6 +6738,8 @@ LibinputInitProperty(DeviceIntPtr dev)
|
||||
LibinputInitHorizScrollProperty(dev, driver_data);
|
||||
LibinputInitScrollPixelDistanceProperty(dev, driver_data, device);
|
||||
LibinputInitPressureCurveProperty(dev, driver_data);
|
||||
LibinputInitPressureRangeProperty(dev, driver_data);
|
||||
LibinputInitTabletAreaRatioProperty(dev, driver_data);
|
||||
LibinputInitTabletSerialProperty(dev, driver_data);
|
||||
LibinputInitHighResolutionScrollProperty(dev, driver_data, device);
|
||||
}
|
||||
|
||||
@@ -233,6 +233,7 @@ test_filter_meta_passthrough(void)
|
||||
int i;
|
||||
|
||||
rc = draglock_init_from_string(&dl, "10");
|
||||
assert(rc == 0);
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
button = i;
|
||||
@@ -259,6 +260,7 @@ test_filter_meta_click_meta_only(void)
|
||||
int button, press;
|
||||
|
||||
rc = draglock_init_from_string(&dl, "10");
|
||||
assert(rc == 0);
|
||||
|
||||
button = 10;
|
||||
press = 1;
|
||||
@@ -283,6 +285,7 @@ test_filter_meta(void)
|
||||
int i;
|
||||
|
||||
rc = draglock_init_from_string(&dl, "10");
|
||||
assert(rc == 0);
|
||||
|
||||
for (i = 1; i < 10; i++) {
|
||||
/* meta down */
|
||||
@@ -339,6 +342,7 @@ test_filter_meta_extra_click(void)
|
||||
int i;
|
||||
|
||||
rc = draglock_init_from_string(&dl, "10");
|
||||
assert(rc == 0);
|
||||
|
||||
for (i = 1; i < 10; i++) {
|
||||
/* meta down */
|
||||
@@ -409,6 +413,7 @@ test_filter_meta_interleaved(void)
|
||||
int i;
|
||||
|
||||
rc = draglock_init_from_string(&dl, "10");
|
||||
assert(rc == 0);
|
||||
|
||||
for (i = 1; i < 10; i++) {
|
||||
/* meta down */
|
||||
@@ -467,6 +472,7 @@ test_filter_pairs(void)
|
||||
int i;
|
||||
|
||||
rc = draglock_init_from_string(&dl, "1 11 2 0 3 13 4 0 5 15 6 0 7 17 8 0 9 19");
|
||||
assert(rc == 0);
|
||||
|
||||
for (i = 1; i < 10; i++) {
|
||||
button = i;
|
||||
|
||||
Reference in New Issue
Block a user