mirror of
https://github.com/X11Libre/xf86-input-libinput.git
synced 2026-03-24 17:44:05 +00:00
Compare commits
111 Commits
xf86-input
...
xf86-input
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
62f267a952 | ||
|
|
c1f07edafa | ||
|
|
a3d38b0f40 | ||
|
|
e3a75f34f8 | ||
|
|
830f7c3b1b | ||
|
|
4ab7873366 | ||
|
|
b3e65904db | ||
|
|
75cc87518b | ||
|
|
3951ce739d | ||
|
|
cbdd9efaab | ||
|
|
4c54f4d0d2 | ||
|
|
8331214771 | ||
|
|
8588a19f63 | ||
|
|
beb94333e1 | ||
|
|
ca9042c7f0 | ||
|
|
bf8dc2e2ed | ||
|
|
ecd845c307 | ||
|
|
0d9184cb76 | ||
|
|
9bb9e635df | ||
|
|
cc10918bdc | ||
|
|
69888cef81 | ||
|
|
6c1c53d296 | ||
|
|
34f14fdf12 | ||
|
|
92047e5d99 | ||
|
|
b8d3c29f59 | ||
|
|
2bbc4727a1 | ||
|
|
39be944991 | ||
|
|
bd2aaa246d | ||
|
|
99773d7bda | ||
|
|
3afb6244e3 | ||
|
|
f279108ffd | ||
|
|
583ed5acdc | ||
|
|
e8e5d1a6b5 | ||
|
|
639b21d78a | ||
|
|
e52daf203b | ||
|
|
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 | ||
|
|
a80773a488 | ||
|
|
8bc694595d | ||
|
|
153a7fc62f | ||
|
|
72fb6d304e | ||
|
|
aae2c8ad9a | ||
|
|
dafc296f2d | ||
|
|
7c90f06d56 | ||
|
|
2eb5a2f0c0 | ||
|
|
19ceef972e | ||
|
|
07f30ea049 | ||
|
|
6187ed0450 | ||
|
|
974ab6b62b | ||
|
|
5d04707381 | ||
|
|
f65a5c5022 | ||
|
|
0dad7408fa | ||
|
|
ea02578a4e | ||
|
|
2ceb2e1b18 | ||
|
|
f47f78eb0b | ||
|
|
1c3ce3ce3c | ||
|
|
4d481ea7c8 | ||
|
|
72bac84df9 | ||
|
|
0b073d90e6 | ||
|
|
669fbb0985 | ||
|
|
c4f0a9bcb8 | ||
|
|
a61e156326 | ||
|
|
552cbaf466 | ||
|
|
bc91d337d7 | ||
|
|
c8d2293873 | ||
|
|
a7014aa8c6 | ||
|
|
bf7fffde52 | ||
|
|
7282177756 | ||
|
|
1dd61abf7e | ||
|
|
c80954386d | ||
|
|
a790ff35f9 | ||
|
|
6318ac420b |
4
.gitignore
vendored
4
.gitignore
vendored
@@ -71,11 +71,11 @@ core
|
||||
*.tar.bz2
|
||||
*.tar.gz
|
||||
#
|
||||
# Add & Override patterns for xf86-input-libinput
|
||||
# Add & Override patterns for xf86-input-libinput
|
||||
#
|
||||
# Edit the following section as needed
|
||||
# For example, !report.pc overrides *.pc. See 'man gitignore'
|
||||
#
|
||||
#
|
||||
*.log
|
||||
*.trs
|
||||
*.swp
|
||||
|
||||
56
.gitlab-ci.yml
Normal file
56
.gitlab-ci.yml
Normal file
@@ -0,0 +1,56 @@
|
||||
# vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0:
|
||||
|
||||
include:
|
||||
- project: 'freedesktop/ci-templates'
|
||||
ref: 59de540b620c45739871d1a073d76d5521989d11 # see https://docs.gitlab.com/ee/ci/yaml/#includefile
|
||||
file: '/templates/fedora.yml'
|
||||
|
||||
|
||||
variables:
|
||||
FDO_UPSTREAM_REPO: xorg/drivers/xf86-input-libinput
|
||||
|
||||
|
||||
stages:
|
||||
- containers
|
||||
- build
|
||||
|
||||
|
||||
.fedora:
|
||||
variables:
|
||||
FDO_DISTRIBUTION_VERSION: 33
|
||||
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'
|
||||
|
||||
|
||||
fedora@container_build:
|
||||
extends:
|
||||
- .fedora
|
||||
- .fdo.container-build@fedora
|
||||
stage: containers
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
|
||||
|
||||
.default_build:
|
||||
stage: 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
|
||||
artifacts:
|
||||
name: "automake-logs-$CI_JOB_NAME"
|
||||
when: always
|
||||
expire_in: 1 week
|
||||
paths:
|
||||
- _builddir/config.log
|
||||
|
||||
|
||||
fedora:33@default-build:
|
||||
extends:
|
||||
- .fedora
|
||||
- .fdo.distribution-image@fedora
|
||||
- .default_build
|
||||
9
.gitlab-ci/fedora-install.sh
Executable file
9
.gitlab-ci/fedora-install.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# we require at least inputproto >= 2.3.99.1 which has been released in xorgproto 2021.5
|
||||
git clone https://gitlab.freedesktop.org/xorg/proto/xorgproto.git --depth 1 --branch=xorgproto-2021.5
|
||||
pushd xorgproto
|
||||
./autogen.sh
|
||||
make -j${FDO_CI_CONCURRENT:-4} install
|
||||
popd
|
||||
rm -rf xorgproto
|
||||
36
COPYING
36
COPYING
@@ -1,20 +1,20 @@
|
||||
Copyright © 2014 Red Hat, Inc.
|
||||
SPDX-License-Identifier: MIT
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this software
|
||||
and its documentation for any purpose is hereby granted without
|
||||
fee, provided that the above copyright notice appear in all copies
|
||||
and that both that copyright notice and this permission notice
|
||||
appear in supporting documentation, and that the name of the authors
|
||||
not be used in advertising or publicity pertaining to distribution of the
|
||||
software without specific, written prior permission. The authors make no
|
||||
representations about the suitability of this software for any
|
||||
purpose. It is provided "as is" without express or implied
|
||||
warranty.
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to
|
||||
deal in the Software without restriction, including without limitation the
|
||||
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
sell copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||
NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
The above copyright notice and this permission notice (including the next
|
||||
paragraph) shall be included in all copies or substantial portions of the
|
||||
Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
IN THE SOFTWARE.
|
||||
|
||||
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
|
||||
|
||||
11
autogen.sh
11
autogen.sh
@@ -1,14 +1,17 @@
|
||||
#! /bin/sh
|
||||
|
||||
srcdir=`dirname $0`
|
||||
srcdir=`dirname "$0"`
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
ORIGDIR=`pwd`
|
||||
cd $srcdir
|
||||
cd "$srcdir"
|
||||
|
||||
autoreconf -v --install || exit 1
|
||||
cd $ORIGDIR || exit $?
|
||||
cd "$ORIGDIR" || exit $?
|
||||
|
||||
git config --local --get format.subjectPrefix >/dev/null 2>&1 ||
|
||||
git config --local format.subjectPrefix "PATCH xf86-input-libinput"
|
||||
|
||||
if test -z "$NOCONFIGURE"; then
|
||||
exec $srcdir/configure "$@"
|
||||
exec "$srcdir"/configure "$@"
|
||||
fi
|
||||
|
||||
@@ -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"
|
||||
@@ -26,3 +43,10 @@ Section "InputClass"
|
||||
MatchDevicePath "/dev/input/event*"
|
||||
Driver "libinput"
|
||||
EndSection
|
||||
|
||||
Section "InputClass"
|
||||
Identifier "libinput tablet catchall"
|
||||
MatchIsTablet "on"
|
||||
MatchDevicePath "/dev/input/event*"
|
||||
Driver "libinput"
|
||||
EndSection
|
||||
|
||||
45
configure.ac
45
configure.ac
@@ -23,29 +23,62 @@
|
||||
# Initialize Autoconf
|
||||
AC_PREREQ([2.60])
|
||||
AC_INIT([xf86-input-libinput],
|
||||
[0.20.0],
|
||||
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
|
||||
[1.2.1],
|
||||
[https://gitlab.freedesktop.org/xorg/driver/xf86-input-libinput/issues],
|
||||
[xf86-input-libinput])
|
||||
AC_CONFIG_SRCDIR([Makefile.am])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_AUX_DIR(.)
|
||||
|
||||
# Initialize Automake
|
||||
AM_INIT_AUTOMAKE([foreign dist-bzip2])
|
||||
AM_INIT_AUTOMAKE([foreign dist-xz])
|
||||
|
||||
# Initialize libtool
|
||||
AC_DISABLE_STATIC
|
||||
LT_INIT
|
||||
|
||||
# Initialize X.Org macros 1.8 or later for MAN_SUBSTS set by XORG_MANPAGE_SECTIONS
|
||||
m4_ifndef([XORG_MACROS_VERSION],
|
||||
m4_ifndef([XORG_MACROS_VERSION],
|
||||
[m4_fatal([must install xorg-macros 1.8 or later before running autoconf/autogen])])
|
||||
XORG_MACROS_VERSION(1.8)
|
||||
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(XORG, [xorg-server >= 1.19] xproto [inputproto >= 2.2])
|
||||
PKG_CHECK_MODULES(LIBINPUT, [libinput >= 1.11.0])
|
||||
|
||||
PKG_CHECK_MODULES(INPUTPROTO24, [inputproto >= 2.3.99.1],
|
||||
[AC_DEFINE(HAVE_INPUTPROTO24, [1], [inputproto 2.4 is available])])
|
||||
|
||||
OLD_LIBS=$LIBS
|
||||
OLD_CFLAGS=$CFLAGS
|
||||
LIBS="$LIBS $LIBINPUT_LIBS"
|
||||
CFLAGS="$CFLAGS $LIBINPUT_CFLAGS"
|
||||
|
||||
AC_MSG_CHECKING([if libinput_device_config_scroll_get_button_lock is available])
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#include <libinput.h>]],
|
||||
[[libinput_device_config_scroll_get_button_lock(NULL)]])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_LIBINPUT_SCROLL_BUTTON_LOCK, [1],
|
||||
[libinput_device_config_scroll_get_button_lock() is available])
|
||||
[libinput_have_scroll_button_lock=yes]],
|
||||
[AC_MSG_RESULT([no])
|
||||
[libinput_have_scroll_button_lock=no]])
|
||||
|
||||
AC_MSG_CHECKING([if libinput_event_pointer_get_scroll_value_v120 is available])
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#include <libinput.h>]],
|
||||
[[libinput_event_pointer_get_scroll_value_v120(NULL, 0)]])],
|
||||
[AC_MSG_RESULT([yes])
|
||||
AC_DEFINE(HAVE_LIBINPUT_AXIS_VALUE_V120, [1],
|
||||
[libinput_event_pointer_get_scroll_value_v120() is available])
|
||||
[libinput_have_axis_value_v120=yes]],
|
||||
[AC_MSG_RESULT([no])
|
||||
[libinput_have_axis_value_v120=no]])
|
||||
|
||||
LIBS=$OLD_LIBS
|
||||
CFLAGS=$OLD_CFLAGS
|
||||
|
||||
# Define a configure option for an alternate input module directory
|
||||
AC_ARG_WITH(xorg-module-dir,
|
||||
|
||||
@@ -1,24 +1,26 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Copyright © 2015 Red Hat, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software
|
||||
* and its documentation for any purpose is hereby granted without
|
||||
* fee, provided that the above copyright notice appear in all copies
|
||||
* and that both that copyright notice and this permission notice
|
||||
* appear in supporting documentation, and that the name of Red Hat
|
||||
* not be used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific, written prior permission. Red
|
||||
* Hat makes no representations about the suitability of this software
|
||||
* for any purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||
* NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef _LIBINPUT_PROPERTIES_H_
|
||||
@@ -61,7 +63,7 @@
|
||||
/* Pointer accel speed: FLOAT, 1 value, 32 bit, read-only*/
|
||||
#define LIBINPUT_PROP_ACCEL_DEFAULT "libinput Accel Speed Default"
|
||||
|
||||
/* Pointer accel profile: BOOL, 2 values in oder adaptive, flat,
|
||||
/* Pointer accel profile: BOOL, 2 values in order adaptive, flat,
|
||||
* only one is enabled at a time at max, read-only */
|
||||
#define LIBINPUT_PROP_ACCEL_PROFILES_AVAILABLE "libinput Accel Profiles Available"
|
||||
|
||||
@@ -115,6 +117,18 @@
|
||||
/* Scroll button for button scrolling: 32-bit int, 1 value, read-only */
|
||||
#define LIBINPUT_PROP_SCROLL_BUTTON_DEFAULT "libinput Button Scrolling Button Default"
|
||||
|
||||
/* Scroll button lock: BOOL, 1 value, TRUE for enabled, FALSE otherwise */
|
||||
#define LIBINPUT_PROP_SCROLL_BUTTON_LOCK "libinput Button Scrolling Button Lock Enabled"
|
||||
|
||||
/* Scroll button lock: BOOL, 1 value, TRUE for enabled, FALSE otherwise, read-only*/
|
||||
#define LIBINPUT_PROP_SCROLL_BUTTON_LOCK_DEFAULT "libinput Button Scrolling Button Lock Enabled Default"
|
||||
|
||||
/* Scroll pixel distance: CARD32, 1 value (with implementation-defined limits) */
|
||||
#define LIBINPUT_PROP_SCROLL_PIXEL_DISTANCE "libinput Scrolling Pixel Distance"
|
||||
|
||||
/* Scroll pixel distance: CARD32, 1 value, read-only */
|
||||
#define LIBINPUT_PROP_SCROLL_PIXEL_DISTANCE_DEFAULT "libinput Scrolling Pixel Distance Default"
|
||||
|
||||
/* Click method: BOOL read-only, 2 values in order buttonareas, clickfinger
|
||||
shows available click methods */
|
||||
#define LIBINPUT_PROP_CLICK_METHODS_AVAILABLE "libinput Click Methods Available"
|
||||
@@ -183,4 +197,18 @@
|
||||
/* Device rotation: FLOAT, 1 value, 32 bit, read-only */
|
||||
#define LIBINPUT_PROP_ROTATION_ANGLE_DEFAULT "libinput Rotation Angle Default"
|
||||
|
||||
/* Tablet tool pressure curve: float, 8 values, 32 bit
|
||||
* Value range is [0.0, 1.0], the values specify the x/y of the four
|
||||
* control points for a cubic bezier curve.
|
||||
* Default value: 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0
|
||||
*/
|
||||
#define LIBINPUT_PROP_TABLET_TOOL_PRESSURECURVE "libinput Tablet Tool Pressurecurve"
|
||||
|
||||
/* Tablet tool area ratio: CARD32, 2 values, w and h */
|
||||
#define LIBINPUT_PROP_TABLET_TOOL_AREA_RATIO "libinput Tablet Tool Area Ratio"
|
||||
|
||||
/* High-resolution wheel scroll events enabled: BOOL, 1 value (0 or 1).
|
||||
* If disabled, high-resolution wheel scroll events are discarded */
|
||||
#define LIBINPUT_PROP_HIRES_WHEEL_SCROLL_ENABLED "libinput High Resolution Wheel Scroll Enabled"
|
||||
|
||||
#endif /* _LIBINPUT_PROPERTIES_H_ */
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
#
|
||||
|
||||
drivermandir = $(DRIVER_MAN_DIR)
|
||||
|
||||
|
||||
367
man/libinput.man
367
man/libinput.man
@@ -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,19 +37,10 @@ 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
|
||||
.BI "Option \*qDevice\*q \*q" string \*q
|
||||
Specifies the device through which the device can be accessed. This will
|
||||
generally be of the form \*q/dev/input/eventX\*q, where X is some integer.
|
||||
When using
|
||||
.B InputClass
|
||||
directives, this option is set by the server.
|
||||
The mapping from device node to hardware is system-dependent. Property:
|
||||
"Device Node" (read-only).
|
||||
.TP 7
|
||||
.BI "Option \*qAccelProfile\*q \*q" string \*q
|
||||
Sets the pointer acceleration profile to the given profile. Permitted values
|
||||
are
|
||||
@@ -89,72 +80,19 @@ Enables a click method. Permitted values are
|
||||
Not all devices support all methods, if an option is unsupported, the
|
||||
default click method for this device is used.
|
||||
.TP 7
|
||||
.BI "Option \*qLeftHanded\*q \*q" bool \*q
|
||||
Enables left-handed button orientation, i.e. swapping left and right buttons.
|
||||
.TP 7
|
||||
.BI "Option \*qMiddleEmulation\*q \*q" bool \*q
|
||||
Enables middle button emulation. When enabled, pressing the left and right
|
||||
buttons simultaneously produces a middle mouse button click.
|
||||
.TP 7
|
||||
.BI "Option \*qNaturalScrolling\*q \*q" bool \*q
|
||||
Enables or disables natural scrolling behavior.
|
||||
.TP 7
|
||||
.BI "Option \*qScrollButton\*q \*q" int \*q
|
||||
Designates a button as scroll button. If the
|
||||
.BI ScrollMethod
|
||||
is
|
||||
.BI button
|
||||
and the button is logically held down, x/y axis movement is converted into
|
||||
scroll events.
|
||||
.TP 7
|
||||
.BI "Option \*qScrollMethod\*q \*q" string \*q
|
||||
Enables a scroll method. Permitted values are
|
||||
.BI none,
|
||||
.BI twofinger,
|
||||
.BI edge,
|
||||
.BI button.
|
||||
Not all devices support all options, if an option is unsupported, the
|
||||
default scroll option for this device is used.
|
||||
.TP 7
|
||||
.BI "Option \*qHorizontalScrolling\*q \*q" bool \*q
|
||||
Disables horizontal scrolling. When disabled, this driver will discard any
|
||||
horizontal scroll events from libinput. Note that this does not disable
|
||||
horizontal scrolling, it merely discards the horizontal axis from any scroll
|
||||
events.
|
||||
.TP 7
|
||||
.BI "Option \*qSendEventsMode\*q \*q" (disabled|enabled|disabled-on-external-mouse) \*q
|
||||
Sets the send events mode to disabled, enabled, or "disable when an external
|
||||
mouse is connected".
|
||||
.TP 7
|
||||
.BI "Option \*qRotationAngle\*q \*q" float \*q
|
||||
Sets the rotation angle of the device to the given angle, in degrees
|
||||
clockwise. The angle must be between 0.0 (inclusive) and 360.0 (exclusive).
|
||||
.TP 7
|
||||
.BI "Option \*qTapping\*q \*q" bool \*q
|
||||
Enables or disables tap-to-click behavior.
|
||||
.TP 7
|
||||
.BI "Option \*qTappingButtonMap\*q \*q" (lrm|lmr) \*q
|
||||
Set the button mapping for 1/2/3-finger taps to left/right/middle or
|
||||
left/middle/right, respectively.
|
||||
.TP 7
|
||||
.BI "Option \*qTappingDrag\*q \*q" bool \*q
|
||||
Enables or disables drag during tapping behavior ("tap-and-drag"). When
|
||||
enabled, a tap followed by a finger held down causes a single button down
|
||||
only, all motions of that finger thus translate into dragging motion.
|
||||
Tap-and-drag requires option
|
||||
.B Tapping
|
||||
to be enabled.
|
||||
.TP 7
|
||||
.BI "Option \*qTappingDragLock\*q \*q" bool \*q
|
||||
Enables or disables drag lock during tapping behavior. When enabled, a
|
||||
finger up during tap-and-drag will not immediately release the button. If
|
||||
the finger is set down again within the timeout, the dragging process
|
||||
continues.
|
||||
.TP 7
|
||||
.BI "Option \*qDisableWhileTyping\*q \*q" bool \*q
|
||||
Indicates if the touchpad should be disabled while typing on the keyboard
|
||||
(this does not apply to modifier keys such as Ctrl or Alt).
|
||||
.TP 7
|
||||
.BI "Option \*qDevice\*q \*q" string \*q
|
||||
Specifies the device through which the device can be accessed. This will
|
||||
generally be of the form \*q/dev/input/eventX\*q, where X is some integer.
|
||||
When using
|
||||
.B InputClass
|
||||
directives, this option is set by the server.
|
||||
The mapping from device node to hardware is system-dependent. Property:
|
||||
"Device Node" (read-only).
|
||||
.TP 7
|
||||
.BI "Option \*qDragLockButtons\*q \*q" "L1 B1 L2 B2 ..." \*q
|
||||
Sets "drag lock buttons" that simulate a button logically down even when it has
|
||||
been physically released. To logically release a locked button, a second click
|
||||
@@ -175,6 +113,106 @@ For both meta and button pair configuration, the button numbers are
|
||||
device button numbers, i.e. the
|
||||
.B ButtonMapping
|
||||
applies after drag lock.
|
||||
.TP 7
|
||||
.BI "Option \*qHighResolutionWheelScrolling\*q \*q" bool \*q
|
||||
Disables high-resolution wheel scroll events, enabled by default. When enabled,
|
||||
the driver forwards only high-resolution wheel scroll events from libinput.
|
||||
When disabled, the driver forwards legacy wheel scroll events instead.
|
||||
.TP 7
|
||||
.BI "Option \*qHorizontalScrolling\*q \*q" bool \*q
|
||||
Disables horizontal scrolling. When disabled, this driver will discard any
|
||||
horizontal scroll events from libinput. Note that this does not disable
|
||||
horizontal scrolling, it merely discards the horizontal axis from any scroll
|
||||
events.
|
||||
.TP 7
|
||||
.BI "Option \*qLeftHanded\*q \*q" bool \*q
|
||||
Enables left-handed button orientation, i.e. swapping left and right buttons.
|
||||
.TP 7
|
||||
.BI "Option \*qMiddleEmulation\*q \*q" bool \*q
|
||||
Enables middle button emulation. When enabled, pressing the left and right
|
||||
buttons simultaneously produces a middle mouse button click.
|
||||
.TP 7
|
||||
.BI "Option \*qNaturalScrolling\*q \*q" bool \*q
|
||||
Enables or disables natural scrolling behavior.
|
||||
.TP 7
|
||||
.BI "Option \*qRotationAngle\*q \*q" float \*q
|
||||
Sets the rotation angle of the device to the given angle, in degrees
|
||||
clockwise. The angle must be between 0.0 (inclusive) and 360.0 (exclusive).
|
||||
.TP 7
|
||||
.BI "Option \*qScrollButton\*q \*q" int \*q
|
||||
Designates a button as scroll button. If the
|
||||
.BI ScrollMethod
|
||||
is
|
||||
.BI button
|
||||
and the button is logically down, x/y axis movement is converted into
|
||||
scroll events.
|
||||
.TP 7
|
||||
.BI "Option \*qScrollButtonLock\*q \*q" bool \*q
|
||||
Enables or disables the scroll button lock. If enabled, the
|
||||
.BI ScrollButton
|
||||
is considered logically down after the first click and remains down until
|
||||
the second click of that button. If disabled (the default), the
|
||||
.BI ScrollButton
|
||||
button is considered logically down while held down and up once physically
|
||||
released.
|
||||
.TP 7
|
||||
.BI "Option \*qScrollMethod\*q \*q" string \*q
|
||||
Enables a scroll method. Permitted values are
|
||||
.BI none,
|
||||
.BI twofinger,
|
||||
.BI edge,
|
||||
.BI button.
|
||||
Not all devices support all options, if an option is unsupported, the
|
||||
default scroll option for this device is used.
|
||||
.TP 7
|
||||
.BI "Option \*qScrollPixelDistance\*q \*q" int \*q
|
||||
Sets the movement distance, in "pixels", required to trigger one logical
|
||||
wheel click. This option only applies to the scroll methods
|
||||
.BI twofinger,
|
||||
.BI edge,
|
||||
.BI button.
|
||||
See section
|
||||
.B SCROLL PIXEL DISTANCE
|
||||
for more details.
|
||||
.TP 7
|
||||
.BI "Option \*qSendEventsMode\*q \*q" (disabled|enabled|disabled-on-external-mouse) \*q
|
||||
Sets the send events mode to disabled, enabled, or "disable when an external
|
||||
mouse is connected".
|
||||
.TP 7
|
||||
.BI "Option \*qTabletToolPressureCurve\*q \*q" "x0/y0 x1/y1 x2/y2 x3/y3" \*q
|
||||
Set the pressure curve for a tablet stylus to the bezier formed by the four
|
||||
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 \*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
|
||||
aspect ratio. Events outside this area are cropped to the area. The special
|
||||
value "default" is used for the default mapping (i.e. the device-native
|
||||
mapping). For more information see section
|
||||
.B TABLET TOOL AREA RATIO.
|
||||
.TP 7
|
||||
.BI "Option \*qTapping\*q \*q" bool \*q
|
||||
Enables or disables tap-to-click behavior.
|
||||
.TP 7
|
||||
.BI "Option \*qTappingButtonMap\*q \*q" (lrm|lmr) \*q
|
||||
Set the button mapping for 1/2/3-finger taps to left/right/middle or
|
||||
left/middle/right, respectively.
|
||||
.TP 7
|
||||
.BI "Option \*qTappingDrag\*q \*q" bool \*q
|
||||
Enables or disables drag during tapping behavior ("tap-and-drag"). When
|
||||
enabled, a tap followed by a finger held down causes a single button down
|
||||
only, all motions of that finger thus translate into dragging motion.
|
||||
Tap-and-drag requires option
|
||||
.B Tapping
|
||||
to be enabled.
|
||||
.TP 7
|
||||
.BI "Option \*qTappingDragLock\*q \*q" bool \*q
|
||||
Enables or disables drag lock during tapping behavior. When enabled, a
|
||||
finger up during tap-and-drag will not immediately release the button. If
|
||||
the finger is set down again within the timeout, the dragging process
|
||||
continues.
|
||||
.PP
|
||||
For all options, the options are only parsed if the device supports that
|
||||
configuration option. For all options, the default value is the one used by
|
||||
@@ -189,26 +227,81 @@ on the device. The following properties are provided by the
|
||||
.B libinput
|
||||
driver.
|
||||
.TP 7
|
||||
.BI "libinput Tapping Enabled"
|
||||
1 boolean value (8 bit, 0 or 1). 1 enables tapping
|
||||
.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 Tapping Button Mapping Enabled"
|
||||
2 boolean value (8 bit, 0 or 1), in order "lrm" and "lmr". Indicates which
|
||||
button mapping is currently enabled on this device.
|
||||
.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 Tapping Drag Lock Enabled"
|
||||
1 boolean value (8 bit, 0 or 1). 1 enables drag lock during tapping
|
||||
.BI "libinput Accel Speed"
|
||||
1 32-bit float value, defines the pointer speed. Value range -1, 1
|
||||
.TP 7
|
||||
.BI "libinput Button Scrolling Button"
|
||||
1 32-bit value. Sets the button number to use for button scrolling. This
|
||||
setting is independent of the scroll method, to enable button scrolling the
|
||||
method must be set to button-scrolling and a valid button must be set.
|
||||
.TP 7
|
||||
.BI "libinput Button Scrolling Button Lock Enabled"
|
||||
1 boolean value. If true, the scroll button lock is enabled. This
|
||||
setting is independent of the scroll method or the scroll button, to enable
|
||||
button scrolling the method must be set to button-scrolling and a valid
|
||||
button must be set.
|
||||
.TP 7
|
||||
.BI "libinput Calibration Matrix"
|
||||
9 32-bit float values, representing a 3x3 calibration matrix, order is row
|
||||
1, row 2, row 3
|
||||
.TP 7
|
||||
.BI "libinput Accel Speed"
|
||||
1 32-bit float value, defines the pointer speed. Value range -1, 1
|
||||
.BI "libinput Click Methods Available"
|
||||
2 boolean values (8 bit, 0 or 1), in order "buttonareas", "clickfinger".
|
||||
Indicates which click methods are available on this device.
|
||||
.TP 7
|
||||
.BI "libinput Click Methods Enabled"
|
||||
2 boolean values (8 bit, 0 or 1), in order "buttonareas", "clickfinger".
|
||||
Indicates which click methods are enabled on this device.
|
||||
.TP 7
|
||||
.BI "libinput Drag Lock Buttons"
|
||||
Either one 8-bit value specifying the meta drag lock button, or a list of
|
||||
button pairs. See section
|
||||
.B BUTTON DRAG LOCK
|
||||
for details.
|
||||
.TP 7
|
||||
.BI "libinput High Resolution Wheel Scroll Enabled"
|
||||
1 boolean value (8 bit, 0 or 1). Indicates whether high-resolution
|
||||
wheel scroll events are enabled or not.
|
||||
.TP 7
|
||||
.BI "libinput Horizontal Scroll Enabled"
|
||||
1 boolean value (8 bit, 0 or 1). Indicates whether horizontal scrolling
|
||||
events are enabled or not.
|
||||
.TP 7
|
||||
.BI "libinput Left Handed Enabled"
|
||||
1 boolean value (8 bit, 0 or 1). Indicates if left-handed mode is enabled or
|
||||
disabled.
|
||||
.TP 7
|
||||
.BI "libinput Middle Emulation Enabled"
|
||||
1 boolean value (8 bit, 0 or 1). Indicates if middle emulation is enabled or
|
||||
disabled.
|
||||
.TP 7
|
||||
.BI "libinput Natural Scrolling Enabled"
|
||||
1 boolean value (8 bit, 0 or 1). 1 enables natural scrolling
|
||||
.TP 7
|
||||
.BI "libinput Rotation Angle"
|
||||
1 32-bit float value [0.0 to 360.0). Sets the rotation angle of the device,
|
||||
clockwise of its natural neutral position.
|
||||
.TP 7
|
||||
.BI "libinput Scroll Methods Available"
|
||||
3 boolean values (8 bit, 0 or 1), in order "two-finger", "edge", "button".
|
||||
Indicates which scroll methods are available on this device.
|
||||
.TP 7
|
||||
.BI "libinput Scroll Method Enabled"
|
||||
3 boolean values (8 bit, 0 or 1), in order "two-finger", "edge", "button".
|
||||
Indicates which scroll method is currently enabled on this device.
|
||||
.TP 7
|
||||
.BI "libinput Scroll Pixel Distance"
|
||||
1 32-bit value (nonzero, with additional implementation-defined range checks).
|
||||
Changes the movement distance required to trigger one logical wheel click.
|
||||
.TP 7
|
||||
.BI "libinput Send Events Modes Available"
|
||||
2 boolean values (8 bit, 0 or 1), in order "disabled" and
|
||||
"disabled-on-external-mouse". Indicates which send-event modes are available
|
||||
@@ -219,56 +312,33 @@ on this device.
|
||||
"disabled-on-external-mouse". Indicates which send-event modes is currently
|
||||
enabled on this device.
|
||||
.TP 7
|
||||
.BI "libinput Left Handed Enabled"
|
||||
1 boolean value (8 bit, 0 or 1). Indicates if left-handed mode is enabled or
|
||||
disabled.
|
||||
.BI "libinput Tablet Tool Pressurecurve"
|
||||
4 32-bit float values [0.0 to 1.0]. See section
|
||||
.B TABLET TOOL PRESSURE CURVE
|
||||
.TP 7
|
||||
.BI "libinput Scroll Methods Available"
|
||||
3 boolean values (8 bit, 0 or 1), in order "two-finger", "edge", "button".
|
||||
Indicates which scroll methods are available on this device.
|
||||
.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
|
||||
.B TABLET TOOL AREA RATIO
|
||||
for more information.
|
||||
.TP 7
|
||||
.BI "libinput Scroll Method Enabled"
|
||||
3 boolean values (8 bit, 0 or 1), in order "two-finger", "edge", "button".
|
||||
Indicates which scroll method is currently enabled on this device.
|
||||
.BI "libinput Tapping Enabled"
|
||||
1 boolean value (8 bit, 0 or 1). 1 enables tapping
|
||||
.TP 7
|
||||
.BI "libinput Button Scrolling Button"
|
||||
1 32-bit value. Sets the button number to use for button scrolling. This
|
||||
setting is independent of the scroll method, to enable button scrolling the
|
||||
method must be set to button-scrolling and a valid button must be set.
|
||||
.BI "libinput Tapping Button Mapping Enabled"
|
||||
2 boolean value (8 bit, 0 or 1), in order "lrm" and "lmr". Indicates which
|
||||
button mapping is currently enabled on this device.
|
||||
.TP 7
|
||||
.BI "libinput Click Methods Available"
|
||||
2 boolean values (8 bit, 0 or 1), in order "buttonareas", "clickfinger".
|
||||
Indicates which click methods are available on this device.
|
||||
.TP 7
|
||||
.BI "libinput Click Methods Enabled"
|
||||
2 boolean values (8 bit, 0 or 1), in order "buttonareas", "clickfinger".
|
||||
Indicates which click methods are enabled on this device.
|
||||
.TP 7
|
||||
.BI "libinput Middle Emulation Enabled"
|
||||
1 boolean value (8 bit, 0 or 1). Indicates if middle emulation is enabled or
|
||||
disabled.
|
||||
.BI "libinput Tapping Drag Lock Enabled"
|
||||
1 boolean value (8 bit, 0 or 1). 1 enables drag lock during tapping
|
||||
.TP 7
|
||||
.BI "libinput Disable While Typing Enabled"
|
||||
1 boolean value (8 bit, 0 or 1). Indicates if disable while typing is
|
||||
enabled or disabled.
|
||||
.TP 7
|
||||
.BI "libinput Rotation Angle"
|
||||
1 32-bit float value [0.0 to 360.0). Sets the rotation angle of the device,
|
||||
clockwise of its natural neutral position.
|
||||
.PP
|
||||
The above properties have a
|
||||
Most properties have a
|
||||
.BI "libinput <property name> Default"
|
||||
equivalent that indicates the default value for this setting on this device.
|
||||
.TP 7
|
||||
.BI "libinput Drag Lock Buttons"
|
||||
Either one 8-bit value specifying the meta drag lock button, or a list of
|
||||
button pairs. See section
|
||||
.B BUTTON DRAG LOCK
|
||||
for details.
|
||||
.TP 7
|
||||
.BI "libinput Horizontal Scrolling Enabled"
|
||||
1 boolean value (8 bit, 0 or 1). Indicates whether horizontal scrolling
|
||||
events are enabled or not.
|
||||
|
||||
.SH BUTTON MAPPING
|
||||
X clients receive events with logical button numbers, where 1, 2, 3
|
||||
@@ -313,6 +383,59 @@ and only the target button events are sent.
|
||||
.TP
|
||||
This feature is provided by this driver, not by libinput.
|
||||
|
||||
.SH TABLET TOOL PRESSURECURVE
|
||||
The pressure curve affects how stylus pressure is reported. By default, the
|
||||
hardware pressure is reported as-is. By setting a pressure curve, the feel
|
||||
of the stylus can be adjusted to be more like e.g. a pencil or a brush.
|
||||
.PP
|
||||
The pressure curve is a cubic Bezier curve, drawn within a normalized range
|
||||
of 0.0 to 1.0 between the four points provided. This normalized range is
|
||||
applied to the tablet's pressure input so that the highest pressure maps to
|
||||
1.0. The points must have increasing x coordinates, if x0 is larger than 0.0
|
||||
all pressure values lower than x0 are equivalent to y0. If x3 is less than
|
||||
1.0, all pressure values higher than x3 are equivalent to y3.
|
||||
|
||||
The input for a linear curve (default) is "0.0/0.0 0.0/0.0 1.0/1.0 1.0/1.0";
|
||||
a slightly
|
||||
depressed curve (firmer) might be "0.0/0.0 0.05/0.0 1.0/0.95 1.0/1.0"; a slightly raised
|
||||
curve (softer) might be "0.0/0.0 0.0/0.05 0.95/1.0 1.0/1.0".
|
||||
.TP
|
||||
This feature is provided by this driver, not by libinput.
|
||||
|
||||
.SH TABLET TOOL AREA RATIO
|
||||
By default, a tablet tool can access the whole sensor area and the tablet
|
||||
area is mapped to the available screen area. For external tablets like
|
||||
the Wacom Intuos series, the height:width ratio of the tablet may be
|
||||
different to that of the monitor, causing the skew of input data.
|
||||
.PP
|
||||
To avoid this skew of input data, an area ratio may be set to match the
|
||||
ratio of the screen device. For example, a ratio of 4:3 will reduce the
|
||||
available area of the tablet to the largest available area with a ratio of
|
||||
4:3. Events within this area will scale to the tablet's announced axis
|
||||
range, the area ratio is thus transparent to the X server. Any events
|
||||
outside this area will send events equal to the maximum value of that axis.
|
||||
The area always starts at the device's origin in it's current rotation, i.e.
|
||||
it takes left-handed-ness into account.
|
||||
.TP
|
||||
This feature is provided by this driver, not by libinput.
|
||||
|
||||
.SH SCROLL PIXEL DISTANCE
|
||||
The X server does not support per-pixel scrolling but it does support
|
||||
smooth scrolling. All scroll events however are based around a logical
|
||||
unit of scrolling (traditionally corresponding to a wheel click).
|
||||
It is thus not possible to scroll by 10 pixels, but it is possible for a
|
||||
driver to scroll by 1/10th of a logical wheel click.
|
||||
.PP
|
||||
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 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"
|
||||
|
||||
@@ -30,10 +30,11 @@ AM_CPPFLAGS =-I$(top_srcdir)/include $(LIBINPUT_CFLAGS)
|
||||
|
||||
@DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la
|
||||
@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version
|
||||
@DRIVER_NAME@_drv_la_LIBADD = $(LIBINPUT_LIBS) libdraglock.la
|
||||
@DRIVER_NAME@_drv_la_LIBADD = $(LIBINPUT_LIBS) libdraglock.la libbezier.la -lm
|
||||
@DRIVER_NAME@_drv_ladir = @inputdir@
|
||||
|
||||
@DRIVER_NAME@_drv_la_SOURCES = xf86libinput.c
|
||||
|
||||
noinst_LTLIBRARIES = libdraglock.la
|
||||
noinst_LTLIBRARIES = libdraglock.la libbezier.la
|
||||
libdraglock_la_SOURCES = draglock.c draglock.h
|
||||
libbezier_la_SOURCES = bezier.c bezier.h
|
||||
|
||||
179
src/bezier.c
Normal file
179
src/bezier.c
Normal file
@@ -0,0 +1,179 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Copyright © 2016 Red Hat, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include "bezier.h"
|
||||
|
||||
const struct bezier_control_point bezier_defaults[4] = {
|
||||
{ 0.0, 0.0 },
|
||||
{ 0.0, 0.0 },
|
||||
{ 1.0, 1.0 },
|
||||
{ 1.0, 1.0 },
|
||||
};
|
||||
|
||||
struct point {
|
||||
int x, y;
|
||||
};
|
||||
|
||||
/**
|
||||
* de Casteljau's algorithm. See this page here
|
||||
* https://pomax.github.io/bezierinfo/#extended
|
||||
*
|
||||
* To play with bezier curve shapes, I used
|
||||
* http://cubic-bezier.com/
|
||||
*/
|
||||
static struct point
|
||||
decasteljau(const struct point *controls,
|
||||
size_t ncontrols,
|
||||
double t)
|
||||
{
|
||||
struct point new_controls[ncontrols];
|
||||
|
||||
if (ncontrols == 1)
|
||||
return controls[0];
|
||||
|
||||
for (int i = 0; i < ncontrols - 1; i++) {
|
||||
new_controls[i].x = (1.0 - t) * controls[i].x + t * controls[i + 1].x;
|
||||
new_controls[i].y = (1.0 - t) * controls[i].y + t * controls[i + 1].y;
|
||||
}
|
||||
|
||||
return decasteljau(new_controls, ncontrols - 1, t);
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a Bézier curve defined by the control points, reduce the curve to
|
||||
* one with ncurve_points.
|
||||
*/
|
||||
static void
|
||||
flatten_curve(const struct point *controls,
|
||||
size_t ncontrols,
|
||||
struct point *curve,
|
||||
size_t ncurve_points)
|
||||
{
|
||||
ncurve_points--; /* make sure we end up with 100/100 as last point */
|
||||
|
||||
for (int i = 0; i <= ncurve_points; i++) {
|
||||
double t = 1.0 * i/ncurve_points;
|
||||
struct point p;
|
||||
|
||||
p = decasteljau(controls, ncontrols, t);
|
||||
curve[i] = p;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Calculate line through a and b, set curve[x] for each x between
|
||||
* [a.x, b.x].
|
||||
*
|
||||
* Note: pcurve must be at least b.x size.
|
||||
*/
|
||||
static void
|
||||
line_between(struct point a, struct point b,
|
||||
struct point *curve, size_t curve_sz)
|
||||
{
|
||||
double slope;
|
||||
double offset;
|
||||
|
||||
assert(b.x < curve_sz);
|
||||
|
||||
if (a.x == b.x) {
|
||||
curve[a.x].x = a.x;
|
||||
curve[a.x].y = a.y;
|
||||
return;
|
||||
}
|
||||
|
||||
slope = (double)(b.y - a.y)/(b.x - a.x);
|
||||
offset = a.y - slope * a.x;
|
||||
|
||||
for (int x = a.x; x <= b.x; x++) {
|
||||
struct point p;
|
||||
p.x = x;
|
||||
p.y = slope * x + offset;
|
||||
curve[x] = p;
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
cubic_bezier(const struct bezier_control_point controls[4],
|
||||
int *bezier_out,
|
||||
size_t bezier_sz)
|
||||
{
|
||||
const int nsegments = 50;
|
||||
const int range = bezier_sz - 1;
|
||||
struct point curve[nsegments];
|
||||
struct point bezier[bezier_sz];
|
||||
struct point zero = { 0, 0 },
|
||||
max = { range, range};
|
||||
|
||||
/* Scale control points into the [0, bezier_sz) range */
|
||||
struct point ctrls[4];
|
||||
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (controls[i].x < 0.0 || controls[i].x > 1.0 ||
|
||||
controls[i].y < 0.0 || controls[i].y > 1.0)
|
||||
return false;
|
||||
|
||||
ctrls[i].x = controls[i].x * range;
|
||||
ctrls[i].y = controls[i].y * range;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
if (ctrls[i].x > ctrls[i+1].x)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Reduce curve to nsegments, because this isn't a drawing program */
|
||||
flatten_curve(ctrls, 4, curve, nsegments);
|
||||
|
||||
/* we now have nsegments points in curve that represent the bezier
|
||||
curve (already in the [0, bezier_sz) range). Run through the
|
||||
points and draw a straight line between each point and voila, we
|
||||
have our curve.
|
||||
|
||||
If the first control points (x0/y0) is not at x == 0 or the last
|
||||
control point (x3/y3) is not at the max value, draw a line
|
||||
between from 0/0 to x0/y0 and from x3/y3 to xmax/y3.
|
||||
*/
|
||||
|
||||
line_between(zero, curve[0], bezier, bezier_sz);
|
||||
|
||||
for (int i = 0; i < nsegments - 1; i++)
|
||||
line_between(curve[i], curve[i+1], bezier, bezier_sz);
|
||||
|
||||
if (curve[nsegments - 1].x < max.x)
|
||||
line_between(curve[nsegments - 1], max, bezier, bezier_sz);
|
||||
|
||||
for (int i = 0; i < bezier_sz; i++)
|
||||
bezier_out[i] = bezier[i].y;
|
||||
|
||||
return true;
|
||||
}
|
||||
71
src/bezier.h
Normal file
71
src/bezier.h
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Copyright © 2016 Red Hat, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#ifndef BEZIER_H
|
||||
#define BEZIER_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
struct bezier_control_point {
|
||||
double x, y;
|
||||
};
|
||||
|
||||
extern const struct bezier_control_point bezier_defaults[4];
|
||||
|
||||
/**
|
||||
* Given four control points in the range [(0.0/0.0), (1.0/1.0)]
|
||||
* construct a Bézier curve.
|
||||
*
|
||||
* ^
|
||||
*1.0 | c2 ______ c3
|
||||
* | _/
|
||||
* | /
|
||||
* |c1 /
|
||||
* | /
|
||||
* | /
|
||||
* |/_________________>
|
||||
* c0 1.0
|
||||
*
|
||||
* This function requires that c[i].x <= c[i+1].x
|
||||
*
|
||||
* The curve is mapped into a canvas size [0, bezier_sz)². For each x
|
||||
* coordinate in [0, bezier_sz), the matching y coordinate is thus
|
||||
* bezier[x].
|
||||
*
|
||||
* In other words, if you have a range [0,2048) input possible values,
|
||||
* the output is a list of 2048 points in a [0, 2048) range.
|
||||
*
|
||||
* @return true on success, false otherwise
|
||||
*/
|
||||
bool
|
||||
cubic_bezier(const struct bezier_control_point controls[4],
|
||||
int *bezier,
|
||||
size_t bezier_sz);
|
||||
#endif
|
||||
@@ -1,24 +1,26 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Copyright © 2015 Red Hat, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software
|
||||
* and its documentation for any purpose is hereby granted without
|
||||
* fee, provided that the above copyright notice appear in all copies
|
||||
* and that both that copyright notice and this permission notice
|
||||
* appear in supporting documentation, and that the name of Red Hat
|
||||
* not be used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific, written prior permission. Red
|
||||
* Hat makes no representations about the suitability of this software
|
||||
* for any purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||
* NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -116,7 +118,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 +133,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 +155,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;
|
||||
|
||||
@@ -1,24 +1,26 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Copyright © 2015 Red Hat, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software
|
||||
* and its documentation for any purpose is hereby granted without
|
||||
* fee, provided that the above copyright notice appear in all copies
|
||||
* and that both that copyright notice and this permission notice
|
||||
* appear in supporting documentation, and that the name of Red Hat
|
||||
* not be used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific, written prior permission. Red
|
||||
* Hat makes no representations about the suitability of this software
|
||||
* for any purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||
* NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
@@ -107,13 +109,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 +142,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.
|
||||
|
||||
1746
src/xf86libinput.c
1746
src/xf86libinput.c
File diff suppressed because it is too large
Load Diff
@@ -3,11 +3,14 @@ AM_CPPFLAGS = $(XORG_CFLAGS) \
|
||||
-I$(top_srcdir)/include \
|
||||
-I$(top_srcdir)/src
|
||||
|
||||
tests = test-draglock
|
||||
tests = test-draglock test-bezier
|
||||
|
||||
noinst_PROGRAMS = $(tests)
|
||||
|
||||
test_draglock_SOURCES = test-draglock.c
|
||||
test_draglock_LDADD = ../src/libdraglock.la
|
||||
|
||||
test_bezier_SOURCES = test-bezier.c
|
||||
test_bezier_LDADD = ../src/libbezier.la -lm
|
||||
|
||||
TESTS = $(tests)
|
||||
|
||||
208
test/test-bezier.c
Normal file
208
test/test-bezier.c
Normal file
@@ -0,0 +1,208 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Copyright © 2016 Red Hat, Inc.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "bezier.h"
|
||||
|
||||
#include <assert.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
static inline void
|
||||
print_curve(int *bezier, size_t size)
|
||||
{
|
||||
/* look at it with gnuplot, "plot 'output-file.txt'" */
|
||||
for (int i = 0; i < size; i++)
|
||||
printf("%d %d\n", i, bezier[i]);
|
||||
}
|
||||
|
||||
static void
|
||||
test_linear(void)
|
||||
{
|
||||
const int size = 2048;
|
||||
int bezier[size];
|
||||
|
||||
struct bezier_control_point controls[] = {
|
||||
{ 0.0, 0.0 },
|
||||
{ 0.0, 0.0 },
|
||||
{ 1.0, 1.0 },
|
||||
{ 1.0, 1.0 }
|
||||
};
|
||||
|
||||
cubic_bezier(controls, bezier, size);
|
||||
|
||||
assert(bezier[0] == 0);
|
||||
assert(bezier[size - 1] == size - 1);
|
||||
|
||||
for (int x = 1; x < size; x++)
|
||||
assert(bezier[x] == x);
|
||||
}
|
||||
|
||||
/* Center point pulled down towards X axis */
|
||||
static void
|
||||
test_flattened(void)
|
||||
{
|
||||
const int size = 2048;
|
||||
int bezier[size];
|
||||
|
||||
struct bezier_control_point controls[] = {
|
||||
{ 0.0, 0.0 },
|
||||
{ 0.1, 0.0 },
|
||||
{ 1.0, 0.9 },
|
||||
{ 1.0, 1.0 }
|
||||
};
|
||||
|
||||
cubic_bezier(controls, bezier, size);
|
||||
|
||||
assert(bezier[0] == 0);
|
||||
assert(bezier[size - 1] == size - 1);
|
||||
|
||||
for (int x = 1; x < size - 1; x++) {
|
||||
assert(bezier[x] < x);
|
||||
}
|
||||
}
|
||||
|
||||
/* Center point pulled up from X axis */
|
||||
static void
|
||||
test_raised(void)
|
||||
{
|
||||
const int size = 2048;
|
||||
int bezier[size];
|
||||
|
||||
struct bezier_control_point controls[] = {
|
||||
{ 0.0, 0.0 },
|
||||
{ 0.1, 0.4 },
|
||||
{ 0.4, 1.0 },
|
||||
{ 1.0, 1.0 }
|
||||
};
|
||||
|
||||
cubic_bezier(controls, bezier, size);
|
||||
|
||||
assert(bezier[0] == 0);
|
||||
assert(bezier[size - 1] == size - 1);
|
||||
|
||||
for (int x = 1; x < size; x++)
|
||||
assert(bezier[x] >= x);
|
||||
|
||||
for (int x = 10; x < size - 10; x++)
|
||||
assert(bezier[x] > x);
|
||||
}
|
||||
|
||||
static void
|
||||
test_windy(void)
|
||||
{
|
||||
const int size = 2048;
|
||||
int bezier[size];
|
||||
|
||||
struct bezier_control_point controls[] = {
|
||||
{ 0.0, 0.0 },
|
||||
{ 0.0, 0.3 },
|
||||
{ 1.0, 0.7 },
|
||||
{ 1.0, 1.0 }
|
||||
};
|
||||
|
||||
cubic_bezier(controls, bezier, size);
|
||||
|
||||
assert(bezier[0] == 0);
|
||||
assert(bezier[size - 1] == size - 1);
|
||||
|
||||
for (int x = 1; x < size/2 - 20; x++)
|
||||
assert(bezier[x] > x);
|
||||
|
||||
for (int x = size/2 + 20; x < size - 1; x++)
|
||||
assert(bezier[x] < x);
|
||||
}
|
||||
|
||||
static void
|
||||
test_nonzero_x_linear(void)
|
||||
{
|
||||
const int size = 2048;
|
||||
int bezier[size];
|
||||
int x;
|
||||
|
||||
struct bezier_control_point controls[] = {
|
||||
{ 0.2, 0.0 },
|
||||
{ 0.2, 0.0 },
|
||||
{ 0.8, 1.0 },
|
||||
{ 0.8, 1.0 }
|
||||
};
|
||||
|
||||
cubic_bezier(controls, bezier, size);
|
||||
|
||||
x = 0;
|
||||
do {
|
||||
assert(bezier[x] == 0);
|
||||
} while (++x < size * 0.2 - 1);
|
||||
|
||||
/* ppc64le, ppc64, aarch64 have different math results at -O2,
|
||||
resulting in one extra zero at the beginning of the array.
|
||||
some other numbers are different too but within the error
|
||||
margin (#99992) */
|
||||
if (bezier[x] == 0)
|
||||
x++;
|
||||
|
||||
do {
|
||||
assert(bezier[x] > bezier[x-1]);
|
||||
} while (++x < size * 0.8 - 1);
|
||||
|
||||
do {
|
||||
assert(bezier[x] == size - 1);
|
||||
} while (++x < size);
|
||||
}
|
||||
|
||||
static void
|
||||
test_nonzero_y_linear(void)
|
||||
{
|
||||
const int size = 2048;
|
||||
int bezier[size];
|
||||
|
||||
struct bezier_control_point controls[] = {
|
||||
{ 0.0, 0.2 },
|
||||
{ 0.0, 0.2 },
|
||||
{ 1.0, 0.8 },
|
||||
{ 1.0, 0.8 }
|
||||
};
|
||||
|
||||
cubic_bezier(controls, bezier, size);
|
||||
|
||||
assert(bezier[0] == (int)(size * 0.2));
|
||||
|
||||
for (int x = 1; x < size; x++) {
|
||||
assert(bezier[x - 1] <= bezier[x]);
|
||||
assert(bezier[x] >= (int)(size * 0.2));
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
test_linear();
|
||||
test_flattened();
|
||||
test_raised();
|
||||
test_windy();
|
||||
test_nonzero_x_linear();
|
||||
test_nonzero_y_linear();
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1,24 +1,26 @@
|
||||
/*
|
||||
* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Copyright © 2013-2015 Red Hat, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software
|
||||
* and its documentation for any purpose is hereby granted without
|
||||
* fee, provided that the above copyright notice appear in all copies
|
||||
* and that both that copyright notice and this permission notice
|
||||
* appear in supporting documentation, and that the name of Red Hat
|
||||
* not be used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific, written prior permission. Red
|
||||
* Hat makes no representations about the suitability of this software
|
||||
* for any purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to
|
||||
* deal in the Software without restriction, including without limitation the
|
||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
||||
* sell copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||
* NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
* The above copyright notice and this permission notice (including the next
|
||||
* paragraph) shall be included in all copies or substantial portions of the
|
||||
* Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
||||
* IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "draglock.h"
|
||||
|
||||
Reference in New Issue
Block a user