mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Compare commits
211 Commits
xf86-input
...
tracking/x
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0b5b97bc6b | ||
|
|
96a4dc7565 | ||
|
|
abcafeede7 | ||
|
|
d893fc74d2 | ||
|
|
b9327e6b28 | ||
|
|
917c2ea204 | ||
|
|
b48c2b7028 | ||
|
|
aac329fd2a | ||
|
|
fbfb16edfe | ||
|
|
409e8205e8 | ||
|
|
7fc0d51f70 | ||
|
|
7c48b6225b | ||
|
|
8edcb2b9e8 | ||
|
|
84b2740814 | ||
|
|
469a30f158 | ||
|
|
23909c35a4 | ||
|
|
abf0fa611e | ||
|
|
6609d352f3 | ||
|
|
71036116be | ||
|
|
b6b36166bd | ||
|
|
67a97afbc0 | ||
|
|
2fb95783e0 | ||
|
|
456f23cbbd | ||
|
|
ab1d9adfd3 | ||
|
|
192fdb0690 | ||
|
|
8c1058f2eb | ||
|
|
4921912374 | ||
|
|
67681097b8 | ||
|
|
1dd61111ad | ||
|
|
231061d004 | ||
|
|
425ed6017a | ||
|
|
7251e42dfb | ||
|
|
551db5b86e | ||
|
|
bb8bde7456 | ||
|
|
7b1267f7f1 | ||
|
|
e08b033276 | ||
|
|
7c1971d9e7 | ||
|
|
9a6952dafe | ||
|
|
f12eca9f83 | ||
|
|
33dc3d7128 | ||
|
|
7b0a65d989 | ||
|
|
d24431a186 | ||
|
|
ce7d8fdebc | ||
|
|
6a3beab613 | ||
|
|
d7e61a7074 | ||
|
|
01e7ac4854 | ||
|
|
034be31159 | ||
|
|
66c9978864 | ||
|
|
0d3494eadf | ||
|
|
56a5e67162 | ||
|
|
74433f788a | ||
|
|
fdc33809de | ||
|
|
38e107a39f | ||
|
|
b6176cff5a | ||
|
|
37afebfb67 | ||
|
|
5b5ae1786c | ||
|
|
2c9f4f0380 | ||
|
|
39ef4444a2 | ||
|
|
abc4a8b603 | ||
|
|
b370ccdff8 | ||
|
|
511498478b | ||
|
|
3dcf6f123c | ||
|
|
f59585b367 | ||
|
|
593bbc6390 | ||
|
|
e0e2587a95 | ||
|
|
cb3b023783 | ||
|
|
124eff9ba2 | ||
|
|
605047613c | ||
|
|
3ee98d0b7f | ||
|
|
977588d24a | ||
|
|
291b60172d | ||
|
|
8ce06c96e4 | ||
|
|
5d239ceb26 | ||
|
|
13dea90bc8 | ||
|
|
b25d716165 | ||
|
|
41cf9212d0 | ||
|
|
75368052b5 | ||
|
|
16c85cbeac | ||
|
|
ae67f64f02 | ||
|
|
f6fcad8b10 | ||
|
|
d171b3d919 | ||
|
|
c3251deb4b | ||
|
|
cabed4bbb6 | ||
|
|
a75c43830e | ||
|
|
d9aadfd5f0 | ||
|
|
54a3120e33 | ||
|
|
164c62a975 | ||
|
|
43e270fb7a | ||
|
|
4ca57716ca | ||
|
|
0f16065b00 | ||
|
|
cae1478781 | ||
|
|
27926b3763 | ||
|
|
8a9b1ec6b5 | ||
|
|
356565111a | ||
|
|
fff3a60fbf | ||
|
|
8f209ac60d | ||
|
|
a0d41af896 | ||
|
|
dea1d1a390 | ||
|
|
b59a1a25da | ||
|
|
5138cd2ff4 | ||
|
|
c085c8b6c1 | ||
|
|
2b675f85ae | ||
|
|
2b8b0df62e | ||
|
|
bb9b4146cb | ||
|
|
f5fe533f1b | ||
|
|
2f67509b53 | ||
|
|
ffc0a34642 | ||
|
|
93de7b0b73 | ||
|
|
9ec9d214d0 | ||
|
|
94e6df8f5f | ||
|
|
67e5376aaa | ||
|
|
2432626b70 | ||
|
|
069c035ab0 | ||
|
|
3b7ba39fca | ||
|
|
454194f4b5 | ||
|
|
00341e632c | ||
|
|
f2d2b65343 | ||
|
|
0d6c6b59c1 | ||
|
|
c263d6e46d | ||
|
|
5af11b6752 | ||
|
|
33e7831b5f | ||
|
|
bc8997e812 | ||
|
|
1cb8f074df | ||
|
|
4eacb581fb | ||
|
|
98af2003d4 | ||
|
|
f5ede98085 | ||
|
|
ff926d15b8 | ||
|
|
b0e3c8f978 | ||
|
|
9624f4e2ba | ||
|
|
047955f51e | ||
|
|
8251d7a8ec | ||
|
|
ac5173163d | ||
|
|
61faf2e6e7 | ||
|
|
7f3f98be7f | ||
|
|
4145fe1c08 | ||
|
|
9ce068e760 | ||
|
|
2c8da280b3 | ||
|
|
f28507e8ce | ||
|
|
99340147b9 | ||
|
|
76b1d58a97 | ||
|
|
224a28de25 | ||
|
|
bc2f01ab83 | ||
|
|
9d9c9870c8 | ||
|
|
5c5b2c8db8 | ||
|
|
854df75f49 | ||
|
|
8c55e94a6a | ||
|
|
965338e9d0 | ||
|
|
0075da20d6 | ||
|
|
009ac94a8e | ||
|
|
4b76d80e93 | ||
|
|
6dd6f2d3c6 | ||
|
|
0c7c087f77 | ||
|
|
ba9377c6d9 | ||
|
|
7f7606fc46 | ||
|
|
0ba58f483e | ||
|
|
5fb4875747 | ||
|
|
e99ab2314f | ||
|
|
191660189a | ||
|
|
a1c3f8efbb | ||
|
|
f3c628acc4 | ||
|
|
7909975b0b | ||
|
|
8d6dfd13b0 | ||
|
|
fed454192d | ||
|
|
cf93a21df1 | ||
|
|
fac1a41c75 | ||
|
|
3175a2a96d | ||
|
|
5e9b027807 | ||
|
|
2ce305129c | ||
|
|
9411749f76 | ||
|
|
239e972be1 | ||
|
|
6127923fe0 | ||
|
|
fc4f98153c | ||
|
|
fabee66bcc | ||
|
|
91d90a7959 | ||
|
|
c1b89bda12 | ||
|
|
907b7cad3f | ||
|
|
c9a2b4e9ce | ||
|
|
e18abd0049 | ||
|
|
683a55e504 | ||
|
|
a9cdb6590c | ||
|
|
dd000dd4fa | ||
|
|
745fca03a2 | ||
|
|
b450efdf95 | ||
|
|
eede8ccffc | ||
|
|
2aba790ed3 | ||
|
|
49693892ce | ||
|
|
070f30e089 | ||
|
|
ffe35b6c25 | ||
|
|
5069e05335 | ||
|
|
0b9fad23a3 | ||
|
|
b79776cf8c | ||
|
|
a52cd1cab2 | ||
|
|
eaf202531f | ||
|
|
74151b3c52 | ||
|
|
e9d96e87ac | ||
|
|
bb15bac149 | ||
|
|
7611d2fc73 | ||
|
|
ebe41bfba7 | ||
|
|
68a6a18fc2 | ||
|
|
eeacd3e5a8 | ||
|
|
5708e38494 | ||
|
|
41111ce1ef | ||
|
|
b4c47d5f94 | ||
|
|
50193a0dd3 | ||
|
|
0049cce4d0 | ||
|
|
d9001a6be9 | ||
|
|
22db196815 | ||
|
|
54ac2306b8 | ||
|
|
768c25a99b | ||
|
|
b5c9f41b2b | ||
|
|
8bc4be3048 |
106
.gitlab-ci.yml
Normal file
106
.gitlab-ci.yml
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
# vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0 filetype=yaml:
|
||||||
|
#
|
||||||
|
# This CI uses the freedesktop.org ci-templates.
|
||||||
|
# Please see the ci-templates documentation for details:
|
||||||
|
# https://freedesktop.pages.freedesktop.org/ci-templates/
|
||||||
|
|
||||||
|
.templates_sha: &template_sha 25e8e9f020880aa35fffe3d6b259b933f0f9449f # see https://docs.gitlab.com/ee/ci/yaml/#includefile
|
||||||
|
|
||||||
|
|
||||||
|
include:
|
||||||
|
# Arch container builder template
|
||||||
|
- project: 'freedesktop/ci-templates'
|
||||||
|
ref: *template_sha
|
||||||
|
file: '/templates/arch.yml'
|
||||||
|
- project: 'freedesktop/ci-templates'
|
||||||
|
ref: *template_sha
|
||||||
|
file: '/templates/ci-fairy.yml'
|
||||||
|
- template: Security/SAST.gitlab-ci.yml
|
||||||
|
|
||||||
|
|
||||||
|
workflow:
|
||||||
|
rules:
|
||||||
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||||
|
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
|
||||||
|
when: never
|
||||||
|
- if: $CI_COMMIT_BRANCH
|
||||||
|
|
||||||
|
|
||||||
|
stages:
|
||||||
|
- prep # prep work like rebuilding the container images if there is a change
|
||||||
|
- build # for actually building and testing things in a container
|
||||||
|
- test
|
||||||
|
- deploy
|
||||||
|
|
||||||
|
|
||||||
|
variables:
|
||||||
|
FDO_UPSTREAM_REPO: 'xorg/driver/xf86-input-evdev'
|
||||||
|
# The tag should be updated each time the list of packages is updated.
|
||||||
|
# Changing a tag forces the associated image to be rebuilt.
|
||||||
|
# Note: the tag has no meaning, we use a date format purely for readability
|
||||||
|
FDO_DISTRIBUTION_TAG: '2023-10-01.0'
|
||||||
|
FDO_DISTRIBUTION_PACKAGES: 'git gcc pkgconf autoconf automake libtool make xorg-util-macros xorgproto xorg-server-devel pixman systemd-libs libevdev mtdev'
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Verify that commit messages are as expected
|
||||||
|
#
|
||||||
|
check-commits:
|
||||||
|
extends:
|
||||||
|
- .fdo.ci-fairy
|
||||||
|
stage: prep
|
||||||
|
script:
|
||||||
|
- ci-fairy check-commits --junit-xml=results.xml
|
||||||
|
except:
|
||||||
|
- master@xorg/driver/xf86-input-evdev
|
||||||
|
variables:
|
||||||
|
GIT_DEPTH: 100
|
||||||
|
artifacts:
|
||||||
|
reports:
|
||||||
|
junit: results.xml
|
||||||
|
|
||||||
|
#
|
||||||
|
# Verify that the merge request has the allow-collaboration checkbox ticked
|
||||||
|
#
|
||||||
|
check-merge-request:
|
||||||
|
extends:
|
||||||
|
- .fdo.ci-fairy
|
||||||
|
stage: deploy
|
||||||
|
script:
|
||||||
|
- ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml
|
||||||
|
artifacts:
|
||||||
|
when: on_failure
|
||||||
|
reports:
|
||||||
|
junit: results.xml
|
||||||
|
allow_failure: true
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Build a container with the given tag and the packages pre-installed.
|
||||||
|
# This only happens if the tag changes, otherwise the existing image is
|
||||||
|
# re-used.
|
||||||
|
#
|
||||||
|
container-prep:
|
||||||
|
extends:
|
||||||
|
- .fdo.container-build@arch
|
||||||
|
stage: prep
|
||||||
|
variables:
|
||||||
|
GIT_STRATEGY: none
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# The default build, runs on the image built above.
|
||||||
|
#
|
||||||
|
build:
|
||||||
|
stage: build
|
||||||
|
extends:
|
||||||
|
- .fdo.distribution-image@arch
|
||||||
|
script:
|
||||||
|
- autoreconf -ivf
|
||||||
|
- mkdir _builddir
|
||||||
|
- pushd _builddir > /dev/null
|
||||||
|
- ../configure --disable-silent-rules
|
||||||
|
- make
|
||||||
|
- make check
|
||||||
|
- make distcheck
|
||||||
|
- popd > /dev/null
|
||||||
40
10-evdev.conf
Normal file
40
10-evdev.conf
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
#
|
||||||
|
# Catch-all evdev loader for udev-based systems
|
||||||
|
# We don't simply match on any device since that also adds accelerometers
|
||||||
|
# and other devices that we don't really want to use. The list below
|
||||||
|
# matches everything but joysticks.
|
||||||
|
|
||||||
|
Section "InputClass"
|
||||||
|
Identifier "evdev pointer catchall"
|
||||||
|
MatchIsPointer "on"
|
||||||
|
MatchDevicePath "/dev/input/event*"
|
||||||
|
Driver "evdev"
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
Section "InputClass"
|
||||||
|
Identifier "evdev keyboard catchall"
|
||||||
|
MatchIsKeyboard "on"
|
||||||
|
MatchDevicePath "/dev/input/event*"
|
||||||
|
Driver "evdev"
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
Section "InputClass"
|
||||||
|
Identifier "evdev touchpad catchall"
|
||||||
|
MatchIsTouchpad "on"
|
||||||
|
MatchDevicePath "/dev/input/event*"
|
||||||
|
Driver "evdev"
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
Section "InputClass"
|
||||||
|
Identifier "evdev tablet catchall"
|
||||||
|
MatchIsTablet "on"
|
||||||
|
MatchDevicePath "/dev/input/event*"
|
||||||
|
Driver "evdev"
|
||||||
|
EndSection
|
||||||
|
|
||||||
|
Section "InputClass"
|
||||||
|
Identifier "evdev touchscreen catchall"
|
||||||
|
MatchIsTouchscreen "on"
|
||||||
|
MatchDevicePath "/dev/input/event*"
|
||||||
|
Driver "evdev"
|
||||||
|
EndSection
|
||||||
@@ -28,6 +28,7 @@ MAINTAINERCLEANFILES = ChangeLog INSTALL
|
|||||||
pkgconfigdir = $(libdir)/pkgconfig
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
pkgconfig_DATA = xorg-evdev.pc
|
pkgconfig_DATA = xorg-evdev.pc
|
||||||
|
|
||||||
|
dist_xorgconf_DATA = 10-evdev.conf
|
||||||
|
|
||||||
.PHONY: ChangeLog INSTALL
|
.PHONY: ChangeLog INSTALL
|
||||||
|
|
||||||
@@ -38,3 +39,5 @@ ChangeLog:
|
|||||||
$(CHANGELOG_CMD)
|
$(CHANGELOG_CMD)
|
||||||
|
|
||||||
dist-hook: ChangeLog INSTALL
|
dist-hook: ChangeLog INSTALL
|
||||||
|
|
||||||
|
EXTRA_DIST = README.md
|
||||||
|
|||||||
20
README
20
README
@@ -1,20 +0,0 @@
|
|||||||
xf86-input-evdev - Generic Linux input driver for the Xorg X server
|
|
||||||
|
|
||||||
Please submit bugs & patches to the Xorg bugzilla:
|
|
||||||
|
|
||||||
https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
|
|
||||||
|
|
||||||
All questions regarding this software should be directed at the
|
|
||||||
Xorg mailing list:
|
|
||||||
|
|
||||||
http://lists.freedesktop.org/mailman/listinfo/xorg
|
|
||||||
|
|
||||||
The master development code repository can be found at:
|
|
||||||
|
|
||||||
git://anongit.freedesktop.org/git/xorg/driver/xf86-input-evdev
|
|
||||||
|
|
||||||
http://cgit.freedesktop.org/xorg/driver/xf86-input-evdev
|
|
||||||
|
|
||||||
For more information on the git code manager, see:
|
|
||||||
|
|
||||||
http://wiki.x.org/wiki/GitPage
|
|
||||||
18
README.md
Normal file
18
README.md
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
xf86-input-evdev - Generic Linux input driver for the Xorg X server
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
|
||||||
|
All questions regarding this software should be directed at the
|
||||||
|
Xorg mailing list:
|
||||||
|
|
||||||
|
https://lists.x.org/mailman/listinfo/xorg
|
||||||
|
|
||||||
|
The primary development code repository can be found at:
|
||||||
|
|
||||||
|
https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev
|
||||||
|
|
||||||
|
Please submit bug reports and requests to merge patches there.
|
||||||
|
|
||||||
|
For patch submission instructions, see:
|
||||||
|
|
||||||
|
https://www.x.org/wiki/Development/Documentation/SubmittingPatches
|
||||||
|
|
||||||
13
autogen.sh
13
autogen.sh
@@ -1,12 +1,17 @@
|
|||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
srcdir=`dirname $0`
|
srcdir=`dirname "$0"`
|
||||||
test -z "$srcdir" && srcdir=.
|
test -z "$srcdir" && srcdir=.
|
||||||
|
|
||||||
ORIGDIR=`pwd`
|
ORIGDIR=`pwd`
|
||||||
cd $srcdir
|
cd "$srcdir"
|
||||||
|
|
||||||
autoreconf -v --install || exit 1
|
autoreconf -v --install || exit 1
|
||||||
cd $ORIGDIR || exit $?
|
cd "$ORIGDIR" || exit $?
|
||||||
|
|
||||||
$srcdir/configure --enable-maintainer-mode "$@"
|
git config --local --get format.subjectPrefix >/dev/null 2>&1 ||
|
||||||
|
git config --local format.subjectPrefix "PATCH xf86-input-evdev"
|
||||||
|
|
||||||
|
if test -z "$NOCONFIGURE"; then
|
||||||
|
exec "$srcdir"/configure "$@"
|
||||||
|
fi
|
||||||
|
|||||||
20
configure.ac
20
configure.ac
@@ -23,16 +23,15 @@
|
|||||||
# Initialize Autoconf
|
# Initialize Autoconf
|
||||||
AC_PREREQ([2.60])
|
AC_PREREQ([2.60])
|
||||||
AC_INIT([xf86-input-evdev],
|
AC_INIT([xf86-input-evdev],
|
||||||
[2.6.0],
|
[2.11.0],
|
||||||
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
|
[https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/issues],
|
||||||
[xf86-input-evdev])
|
[xf86-input-evdev])
|
||||||
AC_CONFIG_SRCDIR([Makefile.am])
|
AC_CONFIG_SRCDIR([Makefile.am])
|
||||||
AC_CONFIG_HEADERS([config.h])
|
AC_CONFIG_HEADERS([config.h])
|
||||||
AC_CONFIG_AUX_DIR(.)
|
AC_CONFIG_AUX_DIR(.)
|
||||||
|
|
||||||
# Initialize Automake
|
# Initialize Automake
|
||||||
AM_INIT_AUTOMAKE([foreign dist-bzip2])
|
AM_INIT_AUTOMAKE([foreign dist-xz])
|
||||||
AM_MAINTAINER_MODE
|
|
||||||
|
|
||||||
# Initialize libtool
|
# Initialize libtool
|
||||||
AC_DISABLE_STATIC
|
AC_DISABLE_STATIC
|
||||||
@@ -45,7 +44,11 @@ XORG_MACROS_VERSION(1.8)
|
|||||||
XORG_DEFAULT_OPTIONS
|
XORG_DEFAULT_OPTIONS
|
||||||
|
|
||||||
# Obtain compiler/linker options from server and required extensions
|
# Obtain compiler/linker options from server and required extensions
|
||||||
PKG_CHECK_MODULES(XORG, xorg-server xproto inputproto)
|
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.18] xproto [inputproto >= 2.1.99.3])
|
||||||
|
PKG_CHECK_MODULES(UDEV, libudev, [AC_DEFINE(HAVE_LIBUDEV, 1,[libudev support])])
|
||||||
|
|
||||||
|
PKG_CHECK_MODULES(LIBEVDEV, [libevdev >= 0.4])
|
||||||
|
PKG_CHECK_MODULES(MTDEV, mtdev)
|
||||||
|
|
||||||
# Define a configure option for an alternate input module directory
|
# Define a configure option for an alternate input module directory
|
||||||
AC_ARG_WITH(xorg-module-dir,
|
AC_ARG_WITH(xorg-module-dir,
|
||||||
@@ -56,6 +59,13 @@ AC_ARG_WITH(xorg-module-dir,
|
|||||||
inputdir=${moduledir}/input
|
inputdir=${moduledir}/input
|
||||||
AC_SUBST(inputdir)
|
AC_SUBST(inputdir)
|
||||||
|
|
||||||
|
AC_ARG_WITH(xorg-conf-dir,
|
||||||
|
AC_HELP_STRING([--with-xorg-conf-dir=DIR],
|
||||||
|
[Default xorg.conf.d directory [[default=$prefix/share/X11/xorg.conf.d/]]]),
|
||||||
|
[xorgconfdir="$withval"],
|
||||||
|
[xorgconfdir="$prefix/share/X11/xorg.conf.d"])
|
||||||
|
AC_SUBST(xorgconfdir)
|
||||||
|
|
||||||
# X Server SDK location is required to install evdev header files
|
# X Server SDK location is required to install evdev header files
|
||||||
# This location is also relayed in the xorg-evdev.pc file
|
# This location is also relayed in the xorg-evdev.pc file
|
||||||
sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
|
sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
|
||||||
|
|||||||
@@ -33,6 +33,8 @@
|
|||||||
#define EVDEV_PROP_MIDBUTTON "Evdev Middle Button Emulation"
|
#define EVDEV_PROP_MIDBUTTON "Evdev Middle Button Emulation"
|
||||||
/* CARD32 */
|
/* CARD32 */
|
||||||
#define EVDEV_PROP_MIDBUTTON_TIMEOUT "Evdev Middle Button Timeout"
|
#define EVDEV_PROP_MIDBUTTON_TIMEOUT "Evdev Middle Button Timeout"
|
||||||
|
/* CARD8 */
|
||||||
|
#define EVDEV_PROP_MIDBUTTON_BUTTON "Evdev Middle Button Button"
|
||||||
|
|
||||||
/* Wheel emulation */
|
/* Wheel emulation */
|
||||||
/* BOOL */
|
/* BOOL */
|
||||||
@@ -66,4 +68,29 @@
|
|||||||
/* BOOL */
|
/* BOOL */
|
||||||
#define EVDEV_PROP_SWAP_AXES "Evdev Axes Swap"
|
#define EVDEV_PROP_SWAP_AXES "Evdev Axes Swap"
|
||||||
|
|
||||||
|
/* BOOL */
|
||||||
|
#define EVDEV_PROP_THIRDBUTTON "Evdev Third Button Emulation"
|
||||||
|
/* CARD32 */
|
||||||
|
#define EVDEV_PROP_THIRDBUTTON_TIMEOUT "Evdev Third Button Emulation Timeout"
|
||||||
|
/* CARD8 */
|
||||||
|
#define EVDEV_PROP_THIRDBUTTON_BUTTON "Evdev Third Button Emulation Button"
|
||||||
|
/* CARD32 */
|
||||||
|
#define EVDEV_PROP_THIRDBUTTON_THRESHOLD "Evdev Third Button Emulation Threshold"
|
||||||
|
|
||||||
|
/* CARD8, 1 value,
|
||||||
|
This property is initialized on devices that have multimedia keys on the
|
||||||
|
function keys. The value of the property selects the default behaviour
|
||||||
|
for the function keys. The behaviour of the fn key (if any exists) is
|
||||||
|
hardware specific. On some hardware, fn may toggle the other set of
|
||||||
|
functions available on the keys.
|
||||||
|
|
||||||
|
0 send functions keys by default, fn may toggle to multimedia keys
|
||||||
|
1 send multimedia keys by default, fn may toggle to function keys
|
||||||
|
*/
|
||||||
|
#define EVDEV_PROP_FUNCTION_KEYS "Evdev Function Keys"
|
||||||
|
|
||||||
|
/* Smooth scroll */
|
||||||
|
/* INT32, 3 values (vertical, horizontal, dial) */
|
||||||
|
#define EVDEV_PROP_SCROLL_DISTANCE "Evdev Scrolling Distance"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
342
man/evdev.man
342
man/evdev.man
@@ -1,8 +1,8 @@
|
|||||||
.\" shorthand for double quote that works everywhere.
|
.\" shorthand for double quote that works everywhere.
|
||||||
.ds q \N'34'
|
.ds q \N'34'
|
||||||
.TH EVDEV __drivermansuffix__ __vendorversion__
|
.TH EVDEV __drivermansuffix__ 2016-11-17 __vendorversion__
|
||||||
.SH NAME
|
.SH NAME
|
||||||
evdev \- Generic Linux input driver
|
evdev \- Generic Linux input driver for Xorg
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.nf
|
.nf
|
||||||
.B "Section \*qInputDevice\*q"
|
.B "Section \*qInputDevice\*q"
|
||||||
@@ -16,97 +16,118 @@ evdev \- Generic Linux input driver
|
|||||||
.B EndSection
|
.B EndSection
|
||||||
.fi
|
.fi
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.B evdev
|
.B evdev
|
||||||
is an __xservername__ input driver for Linux\'s generic event devices. It
|
is an Xorg input driver for Linux\'s generic event devices.
|
||||||
therefore supports all input devices that the kernel knows about, including
|
It therefore supports all input devices that the kernel knows about,
|
||||||
most mice, keyboards, tablets and touchscreens.
|
including most mice, keyboards, tablets, and touchscreens.
|
||||||
.B evdev
|
.B evdev
|
||||||
is the default driver on the major Linux distributions.
|
is the default driver on the major Linux distributions.
|
||||||
.PP
|
.PP
|
||||||
The
|
The
|
||||||
.B evdev
|
.B evdev
|
||||||
driver can serve as both a pointer and a keyboard input device. Multiple
|
driver can serve as both a pointer and a keyboard input device.
|
||||||
input devices are supported by multiple instances of this driver, with one
|
Multiple input devices are supported by multiple instances of this driver,
|
||||||
InputDevice section of your __xconfigfile__ for each input device that will
|
with one InputDevice section of your xorg.conf for each input device
|
||||||
use this driver.
|
that will use this driver.
|
||||||
.PP
|
.PP
|
||||||
It is recommended that
|
It is recommended that
|
||||||
.B evdev
|
.B evdev
|
||||||
devices are configured through the
|
devices are configured through the
|
||||||
.B InputClass
|
.B InputClass
|
||||||
directive (refer to __xconfigfile__(__filemansuffix__)) instead of manual
|
directive (refer to
|
||||||
per-device configuration. Devices configured in the
|
.BR xorg.conf (__filemansuffix__))
|
||||||
__xconfigfile__(__filemansuffix__) are not hot-plug capable.
|
instead of manual per-device configuration.
|
||||||
.PP
|
Devices configured in the
|
||||||
|
.BR xorg.conf (__filemansuffix__)
|
||||||
|
are not hot-plug capable.
|
||||||
.SH SUPPORTED HARDWARE
|
.SH SUPPORTED HARDWARE
|
||||||
In general, any input device that the kernel has a driver for can be accessed
|
In general, any input device that the kernel has a driver for can be accessed
|
||||||
through the
|
through the
|
||||||
.B evdev
|
.B evdev
|
||||||
driver. See the Linux kernel documentation for a complete list.
|
driver.
|
||||||
.PP
|
See the Linux kernel documentation for a complete list.
|
||||||
.SH CONFIGURATION DETAILS
|
.SH CONFIGURATION DETAILS
|
||||||
Please refer to __xconfigfile__(__filemansuffix__) for general configuration
|
Please refer to
|
||||||
details and for options that can be used with all input drivers. This
|
.BR xorg.conf (__filemansuffix__)
|
||||||
section only covers configuration details specific to this driver.
|
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
|
.PP
|
||||||
The following driver
|
The following driver
|
||||||
.B Options
|
.B Options
|
||||||
are supported:
|
are supported:
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qButtonMapping\*q \*q" string \*q
|
.BI "Option \*qButtonMapping\*q \*q" string \*q
|
||||||
Sets the button mapping for this device. The mapping is a space-separated list
|
Sets the button mapping for this device.
|
||||||
of button mappings that correspond in order to the physical buttons on the
|
The mapping is a space-separated list of button mappings
|
||||||
device (i.e. the first number is the mapping for button 1, etc.). The default
|
that correspond in order to the physical buttons on the device
|
||||||
mapping is "1 2 3 ... 32". A mapping of 0 deactivates the button. Multiple
|
(i.e. the first number is the mapping for button 1, etc.).
|
||||||
buttons can have the same mapping.
|
The default mapping is "1 2 3 ... 32".
|
||||||
|
A mapping of 0 deactivates the button.
|
||||||
|
Multiple buttons can have the same mapping.
|
||||||
For example, a left-handed mouse with deactivated scroll-wheel would use a
|
For example, a left-handed mouse with deactivated scroll-wheel would use a
|
||||||
mapping of "3 2 1 0 0". Invalid mappings are ignored and the default mapping
|
mapping of "3 2 1 0 0".
|
||||||
is used. Buttons not specified in the user's mapping use the default mapping.
|
Invalid mappings are ignored and the default mapping is used.
|
||||||
|
Buttons not specified in the user's mapping use the default mapping.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qDevice\*q \*q" string \*q
|
.BI "Option \*qDevice\*q \*q" string \*q
|
||||||
Specifies the device through which the device can be accessed. This will
|
Specifies the device through which the device can be accessed.
|
||||||
generally be of the form \*q/dev/input/eventX\*q, where X is some integer.
|
This will generally be of the form \*q/dev/input/eventX\*q,
|
||||||
|
where X is some integer.
|
||||||
The mapping from device node to hardware is system-dependent.
|
The mapping from device node to hardware is system-dependent.
|
||||||
|
Property: "Device Node" (read-only).
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qDragLockButtons\*q \*q" "L1 B2 L3 B4" \*q
|
.BI "Option \*qDragLockButtons\*q \*q" "L1 B2 L3 B4" \*q
|
||||||
Sets \*qdrag lock buttons\*q that simulate holding a button down, so
|
Sets \*qdrag lock buttons\*q that simulate holding a button down, so
|
||||||
that low dexterity people do not have to hold a button down at the
|
that low dexterity people do not have to hold a button down at the
|
||||||
same time they move a mouse cursor. Button numbers occur in pairs,
|
same time they move a mouse cursor.
|
||||||
with the lock button number occurring first, followed by the button
|
Button numbers occur in pairs,
|
||||||
number that is the target of the lock button. Property: "Evdev
|
with the lock button number occurring first,
|
||||||
|
followed by the button number that is the target of the lock button.
|
||||||
|
Property: "Evdev
|
||||||
Drag Lock Buttons".
|
Drag Lock Buttons".
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qDragLockButtons\*q \*q" "M1" \*q
|
.BI "Option \*qDragLockButtons\*q \*q" "M1" \*q
|
||||||
Sets a \*qmaster drag lock button\*q that acts as a \*qMeta Key\*q
|
Sets a \*qmaster drag lock button\*q that acts as a \*qMeta Key\*q
|
||||||
indicating that the next button pressed is to be
|
indicating that the next button pressed is to be \*qdrag locked\*q.
|
||||||
\*qdrag locked\*q. Property: "Evdev Drag Lock Buttons".
|
Property: "Evdev Drag Lock Buttons".
|
||||||
.TP 7
|
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qEmulate3Buttons\*q \*q" boolean \*q
|
.BI "Option \*qEmulate3Buttons\*q \*q" boolean \*q
|
||||||
Enable/disable the emulation of the third (middle) mouse button for mice
|
Enable/disable the emulation of the third (middle) mouse button for mice
|
||||||
which only have two physical buttons. The third button is emulated by
|
which only have two physical buttons.
|
||||||
pressing both buttons simultaneously. Default: off. Property: "Evdev Middle
|
The third button is emulated by pressing both buttons simultaneously.
|
||||||
Button Emulation".
|
Default: off.
|
||||||
|
Property: "Evdev Middle Button Emulation".
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qEmulate3Timeout\*q \*q" integer \*q
|
.BI "Option \*qEmulate3Timeout\*q \*q" integer \*q
|
||||||
Sets the timeout (in milliseconds) that the driver waits before deciding
|
Sets the timeout (in milliseconds) that the driver waits before deciding
|
||||||
if two buttons where pressed "simultaneously" when 3 button emulation is
|
if two buttons were pressed "simultaneously" when 3 button emulation is enabled.
|
||||||
enabled. Default: 50. Property: "Evdev Middle Button Timeout".
|
Default: 50.
|
||||||
|
Property: "Evdev Middle Button Timeout".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulate3Button\*q \*q" integer \*q
|
||||||
|
Specifies the physical button number to be emitted if middle button emulation
|
||||||
|
is triggered.
|
||||||
|
Default: 2.
|
||||||
|
Property: "Evdev Middle Button Button".
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qEmulateWheel\*q \*q" boolean \*q
|
.BI "Option \*qEmulateWheel\*q \*q" boolean \*q
|
||||||
Enable/disable "wheel" emulation. Wheel emulation means emulating button
|
Enable/disable "wheel" emulation.
|
||||||
press/release events when the mouse is moved while a specific real button
|
Wheel emulation means emulating button press/release events
|
||||||
is pressed. Wheel button events (typically buttons 4 and 5) are
|
when the mouse is moved while a specific real button is pressed.
|
||||||
usually used for scrolling. Wheel emulation is useful for getting wheel-like
|
Wheel button events (typically buttons 4 and 5) are usually used for scrolling.
|
||||||
behaviour with trackballs. It can also be useful for mice with 4 or
|
Wheel emulation is useful for getting wheel-like behaviour with trackballs.
|
||||||
more buttons but no wheel. See the description of the
|
It can also be useful for mice with 4 or more buttons but no wheel.
|
||||||
|
See the description of the
|
||||||
.BR EmulateWheelButton ,
|
.BR EmulateWheelButton ,
|
||||||
.BR EmulateWheelInertia ,
|
.BR EmulateWheelInertia ,
|
||||||
.BR EmulateWheelTimeout ,
|
.BR EmulateWheelTimeout ,
|
||||||
.BR XAxisMapping ,
|
.BR XAxisMapping ,
|
||||||
and
|
and
|
||||||
.B YAxisMapping
|
.B YAxisMapping
|
||||||
options. Default: off. Property "Evdev Wheel Emulation".
|
options.
|
||||||
|
Default: off.
|
||||||
|
Property: "Evdev Wheel Emulation".
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qEmulateWheelButton\*q \*q" integer \*q
|
.BI "Option \*qEmulateWheelButton\*q \*q" integer \*q
|
||||||
Specifies which button must be held down to enable wheel emulation mode.
|
Specifies which button must be held down to enable wheel emulation mode.
|
||||||
@@ -115,59 +136,119 @@ press/release events as specified for the
|
|||||||
.B XAxisMapping
|
.B XAxisMapping
|
||||||
and
|
and
|
||||||
.B YAxisMapping
|
.B YAxisMapping
|
||||||
settings. If the button is 0 and
|
settings.
|
||||||
.BR EmulateWheel
|
If the button is 0 and
|
||||||
is on, any motion of the device is converted into wheel events. Default: 4.
|
.B EmulateWheel
|
||||||
|
is on, any motion of the device is converted into wheel events.
|
||||||
|
Default: 4.
|
||||||
Property: "Evdev Wheel Emulation Button".
|
Property: "Evdev Wheel Emulation Button".
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qEmulateWheelInertia\*q \*q" integer \*q
|
.BI "Option \*qEmulateWheelInertia\*q \*q" integer \*q
|
||||||
Specifies how far (in pixels) the pointer must move to generate button
|
Specifies how far (in pixels) the pointer must move to generate button
|
||||||
press/release events in wheel emulation mode. Default: 10. Property: "Evdev
|
press/release events in wheel emulation mode.
|
||||||
Wheel Emulation Inertia".
|
Default: 10.
|
||||||
|
Property: "Evdev Wheel Emulation Inertia".
|
||||||
|
.IP
|
||||||
|
This value must be set for any device does not resemble a standard mouse.
|
||||||
|
Specifically, on absolute devices such as tablets the value should be set to
|
||||||
|
a reasonable fraction of the expected movement to avoid excess scroll events.
|
||||||
|
.IP
|
||||||
|
.B WARNING:
|
||||||
|
the name \*qinertia\*q is a misnomer.
|
||||||
|
This option defines the distance required to generate one scroll event
|
||||||
|
similar to the
|
||||||
|
.B VertScrollDelta
|
||||||
|
and
|
||||||
|
.B HorizScrollDelta
|
||||||
|
options.
|
||||||
|
It does not enable inertia in the physical sense,
|
||||||
|
scrolling stops immediately once the movement has stopped.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qEmulateWheelTimeout\*q \*q" integer \*q
|
.BI "Option \*qEmulateWheelTimeout\*q \*q" integer \*q
|
||||||
Specifies the time in milliseconds the
|
Specifies the time in milliseconds the
|
||||||
.BR EmulateWheelButton
|
.B EmulateWheelButton
|
||||||
must be pressed before wheel emulation is started. If the
|
must be pressed before wheel emulation is started.
|
||||||
.BR EmulateWheelButton
|
If the
|
||||||
is released before this timeout, the original button press/release event
|
.B EmulateWheelButton
|
||||||
is sent. Default: 200. Property: "Evdev Wheel Emulation Timeout".
|
is released before this timeout,
|
||||||
|
the original button press/release event is sent.
|
||||||
|
Default: 200.
|
||||||
|
Property: "Evdev Wheel Emulation Timeout".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulateThirdButton\*q \*q" boolean \*q
|
||||||
|
Enable third button emulation.
|
||||||
|
Third button emulation emits a right button event (by default)
|
||||||
|
by pressing and holding the first button.
|
||||||
|
The first button must be held down for the configured timeout and
|
||||||
|
must not move more than the configured threshold for the emulation to activate.
|
||||||
|
Otherwise, the first button event is posted as normal.
|
||||||
|
Default: off.
|
||||||
|
Property: "Evdev Third Button Emulation".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulateThirdButtonTimeout\*q \*q" integer \*q
|
||||||
|
Specifies the timeout in milliseconds between the initial button press and
|
||||||
|
the generation of the emulated button event.
|
||||||
|
Default: 1000.
|
||||||
|
Property: "Evdev Third Button Emulation Timeout".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulateThirdButtonButton\*q \*q" integer \*q
|
||||||
|
Specifies the physical button number to be emitted if third button emulation
|
||||||
|
is triggered.
|
||||||
|
Default: 3.
|
||||||
|
Property: "Evdev Third Button Button".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulateThirdButtonMoveThreshold\*q \*q" integer \*q
|
||||||
|
Specifies the maximum move fuzz in device coordinates for third button
|
||||||
|
emulation.
|
||||||
|
If the device moves by more than this threshold before the third
|
||||||
|
button emulation is triggered, the emulation is cancelled and a first button
|
||||||
|
event is generated as normal.
|
||||||
|
Default: 20.
|
||||||
|
Property: "Evdev Third Button Emulation Threshold".
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qGrabDevice\*q \*q" boolean \*q
|
.BI "Option \*qGrabDevice\*q \*q" boolean \*q
|
||||||
Force a grab on the event device. Doing so will ensure that no other driver
|
Force a grab on the event device.
|
||||||
|
Doing so will ensure that no other driver
|
||||||
can initialise the same device and it will also stop the device from sending
|
can initialise the same device and it will also stop the device from sending
|
||||||
events to /dev/kbd or /dev/input/mice. Events from this device will not be
|
events to /dev/kbd or /dev/input/mice.
|
||||||
sent to virtual devices (e.g. rfkill or the Macintosh mouse button emulation).
|
Events from this device will not be sent to virtual devices
|
||||||
|
(e.g. rfkill or the Macintosh mouse button emulation).
|
||||||
Default: disabled.
|
Default: disabled.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qInvertX\*q \*q" Bool \*q
|
.BI "Option \*qInvertX\*q \*q" Bool \*q
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qInvertY\*q \*q" Bool \*q
|
.BI "Option \*qInvertY\*q \*q" Bool \*q
|
||||||
Invert the given axis. Default: off. Property: "Evdev Axis Inversion".
|
Invert the given axis.
|
||||||
|
Default: off.
|
||||||
|
Property: "Evdev Axis Inversion".
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qIgnoreRelativeAxes\*q \*q" Bool \*q
|
.BI "Option \*qIgnoreRelativeAxes\*q \*q" Bool \*q
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qIgnoreAbsoluteAxes\*q \*q" Bool \*q
|
.BI "Option \*qIgnoreAbsoluteAxes\*q \*q" Bool \*q
|
||||||
Ignore the specified type of axis. Default: unset. The X server cannot deal
|
Ignore the specified type of axis.
|
||||||
with devices that have both relative and absolute axes. Evdev tries to guess
|
Default: unset.
|
||||||
wich axes to ignore given the device type and disables absolute axes for
|
The X server cannot deal with devices that have both relative and absolute axes.
|
||||||
mice and relative axes for tablets, touchscreens and touchpad. These options
|
Evdev tries to guess which axes to ignore given the device type and
|
||||||
allow to forcibly disable an axis type. Mouse wheel axes are exempt and will
|
disables absolute axes for mice and relative axes for tablets, touchscreens,
|
||||||
work even if relative axes are ignored. No property, this configuration must
|
and touchpad.
|
||||||
be set in the configuration.
|
These options allow to forcibly disable an axis type.
|
||||||
|
Mouse wheel axes are exempt and will work even if relative axes are ignored.
|
||||||
|
No property, this configuration must be set in the configuration.
|
||||||
.br
|
.br
|
||||||
If either option is set to False, the driver will not ignore the specified
|
If either option is set to False, the driver will not ignore the specified
|
||||||
axes regardless of the presence of other axes. This may trigger buggy
|
axes regardless of the presence of other axes.
|
||||||
behavior and events from this axis are always forwarded. Users are
|
This may trigger buggy behavior and events from this axis are always forwarded.
|
||||||
discouraged from setting this option.
|
Users are discouraged from setting this option.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qCalibration\*q \*q" "min-x max-x min-y max-y" \*q
|
.BI "Option \*qCalibration\*q \*q" "min-x max-x min-y max-y" \*q
|
||||||
Calibrates the X and Y axes for devices that need to scale to a different
|
Calibrates the X and Y axes for devices that need to scale to a different
|
||||||
coordinate system than reported to the X server. This feature is required
|
coordinate system than reported to the X server.
|
||||||
for devices that need to scale to a different coordinate system than
|
This feature is required for devices that need to scale to
|
||||||
originally reported by the kernel (e.g. touchscreens). The scaling to the
|
a different coordinate system than originally reported by the kernel
|
||||||
custom coordinate system is done in-driver and the X server is unaware of
|
(e.g. touchscreens).
|
||||||
the transformation. Property: "Evdev Axis Calibration".
|
The scaling to the custom coordinate system is done in-driver and
|
||||||
|
the X server is unaware of the transformation.
|
||||||
|
Property: "Evdev Axis Calibration".
|
||||||
.TP 7
|
.TP 7
|
||||||
.B Option \*qMode\*q \*qRelative\*q\fP|\fP\*qAbsolute\*q
|
.B Option \*qMode\*q \*qRelative\*q\fP|\fP\*qAbsolute\*q
|
||||||
Sets the mode of the device if device has absolute axes.
|
Sets the mode of the device if device has absolute axes.
|
||||||
@@ -175,67 +256,114 @@ The default value for touchpads is relative, for other absolute.
|
|||||||
This option has no effect on devices without absolute axes.
|
This option has no effect on devices without absolute axes.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qSwapAxes\*q \*q" Bool \*q
|
.BI "Option \*qSwapAxes\*q \*q" Bool \*q
|
||||||
Swap x/y axes. Default: off. Property: "Evdev Axes Swap".
|
Swap x/y axes.
|
||||||
|
Default: off.
|
||||||
|
Property: "Evdev Axes Swap".
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qXAxisMapping\*q \*q" "N1 N2" \*q
|
.BI "Option \*qXAxisMapping\*q \*q" "N1 N2" \*q
|
||||||
Specifies which buttons are mapped to motion in the X direction in wheel
|
Specifies which buttons are mapped to motion in the X direction in wheel
|
||||||
emulation mode. Button number
|
emulation mode.
|
||||||
|
Button number
|
||||||
.I N1
|
.I N1
|
||||||
is mapped to the negative X axis motion and button number
|
is mapped to the negative X axis motion and button number
|
||||||
.I N2
|
.I N2
|
||||||
is mapped to the positive X axis motion. Default: no mapping. Property:
|
is mapped to the positive X axis motion.
|
||||||
"Evdev Wheel Emulation Axes".
|
Default: no mapping.
|
||||||
|
Property: "Evdev Wheel Emulation Axes".
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qYAxisMapping\*q \*q" "N1 N2" \*q
|
.BI "Option \*qYAxisMapping\*q \*q" "N1 N2" \*q
|
||||||
Specifies which buttons are mapped to motion in the Y direction in wheel
|
Specifies which buttons are mapped to motion in the Y direction in wheel
|
||||||
emulation mode. Button number
|
emulation mode.
|
||||||
|
Button number
|
||||||
.I N1
|
.I N1
|
||||||
is mapped to the negative Y axis motion and button number
|
is mapped to the negative Y axis motion and button number
|
||||||
.I N2
|
.I N2
|
||||||
is mapped to the positive Y axis motion. Default: "4 5". Property:
|
is mapped to the positive Y axis motion.
|
||||||
"Evdev Wheel Emulation Axes".
|
Default: "4 5".
|
||||||
|
Property: "Evdev Wheel Emulation Axes".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qTypeName\*q" \*q"type"\*q
|
||||||
|
Specify the X Input 1.x type (see
|
||||||
|
.BR XListInputDevices (__libmansuffix__)).
|
||||||
|
There is rarely a need to use this option, evdev will guess the device type
|
||||||
|
based on the device's capabilities.
|
||||||
|
This option is provided for devices that need quirks.
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qVertScrollDelta\*q \*q" integer \*q
|
||||||
|
The amount of motion considered one unit of scrolling vertically.
|
||||||
|
Default: "1".
|
||||||
|
Property: "Evdev Scrolling Distance".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qHorizScrollDelta\*q \*q" integer \*q
|
||||||
|
The amount of motion considered one unit of scrolling horizontally.
|
||||||
|
Default: "1".
|
||||||
|
Property: "Evdev Scrolling Distance".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qDialDelta\*q \*q" integer \*q
|
||||||
|
The amount of motion considered one unit of turning the dial.
|
||||||
|
Default: "1".
|
||||||
|
Property: "Evdev Scrolling Distance".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qResolution\*q \*q" integer \*q
|
||||||
|
Sets the resolution of the device in dots per inch.
|
||||||
|
The resolution is used to scale relative motion events from mouse devices to
|
||||||
|
1000 DPI resolution.
|
||||||
|
This can be used to make high resolution mice less sensitive without turning off
|
||||||
|
acceleration.
|
||||||
|
If set to 0 no scaling will be performed.
|
||||||
|
Default: "0".
|
||||||
.SH SUPPORTED PROPERTIES
|
.SH SUPPORTED PROPERTIES
|
||||||
The following properties are provided by the
|
The following properties are provided by the
|
||||||
.B evdev
|
.B evdev
|
||||||
driver.
|
driver.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Evdev Axis Calibration"
|
.B "Evdev Axis Calibration"
|
||||||
4 32-bit values, order min-x, max-x, min-y, max-y or 0 values to disable
|
4 32-bit values, order min-x, max-x, min-y, max-y or 0 values to disable
|
||||||
in-driver axis calibration.
|
in-driver axis calibration.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Evdev Axis Inversion"
|
.B "Evdev Axis Inversion"
|
||||||
2 boolean values (8 bit, 0 or 1), order X, Y. 1 inverts the axis.
|
2 boolean values (8 bit, 0 or 1), order X, Y.
|
||||||
|
1 inverts the axis.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Evdev Axes Swap"
|
.B "Evdev Axes Swap"
|
||||||
1 boolean value (8 bit, 0 or 1). 1 swaps x/y axes.
|
1 boolean value (8 bit, 0 or 1).
|
||||||
|
1 swaps x/y axes.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Evdev Drag Lock Buttons"
|
.B "Evdev Drag Lock Buttons"
|
||||||
8-bit. Either 1 value or pairs of values. Value range 0-32, 0 disables a
|
8-bit. Either 1 value or pairs of values.
|
||||||
value.
|
Value range 0-32, 0 disables a value.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Evdev Middle Button Emulation"
|
.B "Evdev Middle Button Emulation"
|
||||||
1 boolean value (8 bit, 0 or 1).
|
1 boolean value (8 bit, 0 or 1).
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Evdev Middle Button Timeout"
|
.B "Evdev Middle Button Timeout"
|
||||||
1 16-bit positive value.
|
1 16-bit positive value.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Evdev Wheel Emulation"
|
.B "Evdev Middle Button Button"
|
||||||
1 boolean value (8 bit, 0 or 1).
|
|
||||||
.TP 7
|
|
||||||
.BI "Evdev Wheel Emulation Axes"
|
|
||||||
4 8-bit values, order X up, X down, Y up, Y down. 0 disables a value.
|
|
||||||
.TP 7
|
|
||||||
.BI "Evdev Wheel Emulation Button"
|
|
||||||
1 8-bit value, allowed range 0-32, 0 disables the button.
|
1 8-bit value, allowed range 0-32, 0 disables the button.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Evdev Wheel Emulation Inertia"
|
.B "Evdev Wheel Emulation"
|
||||||
|
1 boolean value (8 bit, 0 or 1).
|
||||||
|
.TP 7
|
||||||
|
.B "Evdev Wheel Emulation Axes"
|
||||||
|
4 8-bit values, order X up, X down, Y up, Y down.
|
||||||
|
0 disables a value.
|
||||||
|
.TP 7
|
||||||
|
.B "Evdev Wheel Emulation Button"
|
||||||
|
1 8-bit value, allowed range 0-32, 0 disables the button.
|
||||||
|
.TP 7
|
||||||
|
.B "Evdev Wheel Emulation Inertia"
|
||||||
1 16-bit positive value.
|
1 16-bit positive value.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Evdev Wheel Emulation Timeout"
|
.B "Evdev Wheel Emulation Timeout"
|
||||||
1 16-bit positive value.
|
1 16-bit positive value.
|
||||||
|
.TP 7
|
||||||
|
.B "Evdev Scrolling Distance"
|
||||||
|
3 32-bit values: vertical, horizontal and dial.
|
||||||
.SH AUTHORS
|
.SH AUTHORS
|
||||||
Kristian Høgsberg, Peter Hutterer
|
Kristian Høgsberg, Peter Hutterer
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__)
|
.BR Xorg (__appmansuffix__),
|
||||||
|
.BR xorg.conf (__filemansuffix__),
|
||||||
|
.BR Xserver (__appmansuffix__),
|
||||||
|
.BR X (__miscmansuffix__)
|
||||||
|
|||||||
@@ -26,15 +26,19 @@
|
|||||||
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
|
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
|
||||||
|
|
||||||
AM_CFLAGS = $(XORG_CFLAGS) $(CWARNFLAGS)
|
AM_CFLAGS = $(XORG_CFLAGS) $(CWARNFLAGS)
|
||||||
AM_CPPFLAGS =-I$(top_srcdir)/include
|
AM_CPPFLAGS =-I$(top_srcdir)/include $(LIBEVDEV_CFLAGS)
|
||||||
|
|
||||||
@DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la
|
@DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la
|
||||||
@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version
|
@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version
|
||||||
|
@DRIVER_NAME@_drv_la_LIBADD = $(MTDEV_LIBS) $(UDEV_LIBS) $(LIBEVDEV_LIBS)
|
||||||
@DRIVER_NAME@_drv_ladir = @inputdir@
|
@DRIVER_NAME@_drv_ladir = @inputdir@
|
||||||
|
|
||||||
@DRIVER_NAME@_drv_la_SOURCES = @DRIVER_NAME@.c \
|
@DRIVER_NAME@_drv_la_SOURCES = @DRIVER_NAME@.c \
|
||||||
@DRIVER_NAME@.h \
|
@DRIVER_NAME@.h \
|
||||||
emuMB.c \
|
emuMB.c \
|
||||||
|
emuThird.c \
|
||||||
emuWheel.c \
|
emuWheel.c \
|
||||||
draglock.c
|
draglock.c \
|
||||||
|
apple.c \
|
||||||
|
axis_labels.h
|
||||||
|
|
||||||
|
|||||||
313
src/apple.c
Normal file
313
src/apple.c
Normal file
@@ -0,0 +1,313 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2011 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Peter Hutterer (peter.hutterer@redhat.com)
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <evdev.h>
|
||||||
|
#include <evdev-properties.h>
|
||||||
|
#include <errno.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
#include <exevents.h>
|
||||||
|
#include <xf86.h>
|
||||||
|
#include <xf86Xinput.h>
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
|
||||||
|
/* Apple-specific controls.
|
||||||
|
*
|
||||||
|
* On Apple keyboards, the multimedia function keys are overlaid with the F
|
||||||
|
* keys. F1 is also BrightnessDown, F10 is Mute, etc. The kernel provides a
|
||||||
|
* tweak to enable/disable this.
|
||||||
|
*
|
||||||
|
* /sys/module/hid_apple/parameters/fnmode
|
||||||
|
* 0 .. keyboard sends Fx keys, fn is disabled
|
||||||
|
* 1 .. keyboard sends multimedia keys, fn sends Fx keys
|
||||||
|
* 2 .. keyboard sends Fx keys, fn sends multimedia keys
|
||||||
|
*
|
||||||
|
* We only handle 1 and 2, don't care about 0. If fnmode is found to be on
|
||||||
|
* 0, we force it to 2 instead.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* In this file: fkeymode refers to the evdev-specific enums and parameters,
|
||||||
|
* fnmode refers to the fnmode parameter exposed by the kernel. fnmode is
|
||||||
|
* apple-specific */
|
||||||
|
#define FNMODE_PATH "/sys/module/hid_apple/parameters/fnmode"
|
||||||
|
|
||||||
|
/* Taken from the kernel */
|
||||||
|
#define USB_VENDOR_ID_APPLE 0x05ac
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_MINI_ANSI 0x021d
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_MINI_ISO 0x021e
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_MINI_JIS 0x021f
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_ANSI 0x0220
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_ISO 0x0221
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_JIS 0x0222
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI 0x022c
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO 0x022d
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS 0x022e
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI 0x0239
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO 0x023a
|
||||||
|
#define USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS 0x023b
|
||||||
|
|
||||||
|
static int EvdevAppleGetProperty (DeviceIntPtr dev, Atom property);
|
||||||
|
static int EvdevAppleSetProperty(DeviceIntPtr dev, Atom atom,
|
||||||
|
XIPropertyValuePtr val, BOOL checkonly);
|
||||||
|
|
||||||
|
static Atom prop_fkeymode;
|
||||||
|
static Bool fnmode_readonly; /* set if we can only read fnmode */
|
||||||
|
|
||||||
|
struct product_table
|
||||||
|
{
|
||||||
|
unsigned int vendor;
|
||||||
|
unsigned int product;
|
||||||
|
} apple_keyboard_table[] = {
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ANSI},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_ISO},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_MINI_JIS},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ANSI},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_ISO},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_JIS},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ANSI},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_ISO},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_JIS},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO},
|
||||||
|
{ USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS},
|
||||||
|
{ 0, 0}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return TRUE if the device matches a product in the given product table,
|
||||||
|
* FALSE otherwise
|
||||||
|
*/
|
||||||
|
static Bool product_check(const struct product_table *t, int vendor, int product)
|
||||||
|
{
|
||||||
|
while (t->vendor)
|
||||||
|
{
|
||||||
|
if (vendor == t->vendor && product == t->product)
|
||||||
|
return TRUE;
|
||||||
|
t++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return 0 on success, -1 otherwise (check errno)
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
set_fnmode(enum fkeymode fkeymode)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
char mode;
|
||||||
|
int bytes_written;
|
||||||
|
|
||||||
|
if (fkeymode == FKEYMODE_UNKNOWN)
|
||||||
|
{
|
||||||
|
errno = EINVAL; /* silly you */
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
fd = open(FNMODE_PATH, O_WRONLY);
|
||||||
|
if (fd < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
mode = (fkeymode == FKEYMODE_FKEYS) ? '2' : '1';
|
||||||
|
|
||||||
|
bytes_written = write(fd, &mode, 1);
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
return (bytes_written == 1) ? 0 : -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the current value of fnmode. If fnmode is found to be on 0, we set it
|
||||||
|
* to 2 in the process. Yes, quite daring, I know. I live on the edge.
|
||||||
|
*
|
||||||
|
* @return The current setting of fnmode or FKEYMODE_UNKNOWN on error (check
|
||||||
|
* errno)
|
||||||
|
*/
|
||||||
|
static enum fkeymode
|
||||||
|
get_fnmode(void)
|
||||||
|
{
|
||||||
|
int fd;
|
||||||
|
char retvalue;
|
||||||
|
|
||||||
|
fd = open(FNMODE_PATH, O_RDWR);
|
||||||
|
if (fd < 0 && errno == EACCES)
|
||||||
|
{
|
||||||
|
fnmode_readonly = TRUE;
|
||||||
|
fd = open(FNMODE_PATH, O_RDONLY);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (fd < 0)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
if (read(fd, &retvalue, 1) != 1)
|
||||||
|
goto err;
|
||||||
|
|
||||||
|
if (retvalue != '0' && retvalue != '1' && retvalue != '2')
|
||||||
|
{
|
||||||
|
xf86Msg(X_ERROR, "Invalid fnmode value: %c\n", retvalue);
|
||||||
|
errno = EINVAL;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
|
||||||
|
close(fd);
|
||||||
|
|
||||||
|
/* we don't want 0, switch to 2 */
|
||||||
|
if (retvalue == '0')
|
||||||
|
{
|
||||||
|
if (fnmode_readonly)
|
||||||
|
xf86Msg(X_WARNING, "fnmode is disabled and read-only. Fn key will"
|
||||||
|
"not toggle to multimedia keys.\n");
|
||||||
|
else
|
||||||
|
set_fnmode(FKEYMODE_FKEYS);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return retvalue == '1' ? FKEYMODE_MMKEYS : FKEYMODE_FKEYS;
|
||||||
|
|
||||||
|
err:
|
||||||
|
if (fd >= 0)
|
||||||
|
close(fd);
|
||||||
|
return FKEYMODE_UNKNOWN;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the property value to fkeymode. If the property doesn't exist,
|
||||||
|
* initialize it.
|
||||||
|
*/
|
||||||
|
static void set_fkeymode_property(InputInfoPtr pInfo, enum fkeymode fkeymode)
|
||||||
|
{
|
||||||
|
DeviceIntPtr dev = pInfo->dev;
|
||||||
|
BOOL init = FALSE;
|
||||||
|
char data;
|
||||||
|
|
||||||
|
switch(fkeymode)
|
||||||
|
{
|
||||||
|
case FKEYMODE_FKEYS: data = 0; break;
|
||||||
|
case FKEYMODE_MMKEYS: data = 1; break;
|
||||||
|
case FKEYMODE_UNKNOWN:
|
||||||
|
xf86IDrvMsg(pInfo, X_ERROR, "Failed to get fnmode (%s)\n", strerror(errno));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!prop_fkeymode) {
|
||||||
|
init = TRUE;
|
||||||
|
prop_fkeymode = MakeAtom(EVDEV_PROP_FUNCTION_KEYS, strlen(EVDEV_PROP_FUNCTION_KEYS), TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Don't send an event if we're initializing the property */
|
||||||
|
XIChangeDeviceProperty(dev, prop_fkeymode, XA_INTEGER, 8,
|
||||||
|
PropModeReplace, 1, &data, !init);
|
||||||
|
|
||||||
|
if (init)
|
||||||
|
{
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_fkeymode, FALSE);
|
||||||
|
XIRegisterPropertyHandler(dev, EvdevAppleSetProperty, EvdevAppleGetProperty, NULL);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Called when a client reads the property state.
|
||||||
|
* Update with current kernel state, it may have changed behind our back.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
EvdevAppleGetProperty (DeviceIntPtr dev, Atom property)
|
||||||
|
{
|
||||||
|
if (property == prop_fkeymode)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
enum fkeymode fkeymode;
|
||||||
|
|
||||||
|
fkeymode = get_fnmode();
|
||||||
|
if (fkeymode != pEvdev->fkeymode) {
|
||||||
|
/* set internal copy first, so we don't write to the file in
|
||||||
|
* SetProperty handler */
|
||||||
|
pEvdev->fkeymode = fkeymode;
|
||||||
|
set_fkeymode_property(pInfo, fkeymode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
EvdevAppleSetProperty(DeviceIntPtr dev, Atom atom,
|
||||||
|
XIPropertyValuePtr val, BOOL checkonly)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
|
||||||
|
if (atom == prop_fkeymode)
|
||||||
|
{
|
||||||
|
CARD8 v = *(CARD8*)val->data;
|
||||||
|
|
||||||
|
if (val->format != 8 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
if (fnmode_readonly)
|
||||||
|
return BadAccess;
|
||||||
|
|
||||||
|
if (v > 1)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
{
|
||||||
|
if ((!v && pEvdev->fkeymode != FKEYMODE_FKEYS) ||
|
||||||
|
(v && pEvdev->fkeymode != FKEYMODE_MMKEYS))
|
||||||
|
{
|
||||||
|
pEvdev->fkeymode = v ? FKEYMODE_MMKEYS : FKEYMODE_FKEYS;
|
||||||
|
set_fnmode(pEvdev->fkeymode);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
EvdevAppleInitProperty(DeviceIntPtr dev)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
enum fkeymode fkeymode;
|
||||||
|
|
||||||
|
if (!product_check(apple_keyboard_table,
|
||||||
|
libevdev_get_id_vendor(pEvdev->dev),
|
||||||
|
libevdev_get_id_product(pEvdev->dev)))
|
||||||
|
return;
|
||||||
|
|
||||||
|
fkeymode = get_fnmode();
|
||||||
|
pEvdev->fkeymode = fkeymode;
|
||||||
|
set_fkeymode_property(pInfo, fkeymode);
|
||||||
|
}
|
||||||
198
src/axis_labels.h
Normal file
198
src/axis_labels.h
Normal file
@@ -0,0 +1,198 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2004-2008 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <xserver-properties.h>
|
||||||
|
|
||||||
|
#ifndef AXIS_LABELS
|
||||||
|
#define AXIS_LABELS
|
||||||
|
|
||||||
|
/* Aligned with linux/input.h.
|
||||||
|
Note that there are holes in the ABS_ range, these are simply replaced with
|
||||||
|
MISC here */
|
||||||
|
static const char* abs_labels[] = {
|
||||||
|
AXIS_LABEL_PROP_ABS_X, /* 0x00 */
|
||||||
|
AXIS_LABEL_PROP_ABS_Y, /* 0x01 */
|
||||||
|
AXIS_LABEL_PROP_ABS_Z, /* 0x02 */
|
||||||
|
AXIS_LABEL_PROP_ABS_RX, /* 0x03 */
|
||||||
|
AXIS_LABEL_PROP_ABS_RY, /* 0x04 */
|
||||||
|
AXIS_LABEL_PROP_ABS_RZ, /* 0x05 */
|
||||||
|
AXIS_LABEL_PROP_ABS_THROTTLE, /* 0x06 */
|
||||||
|
AXIS_LABEL_PROP_ABS_RUDDER, /* 0x07 */
|
||||||
|
AXIS_LABEL_PROP_ABS_WHEEL, /* 0x08 */
|
||||||
|
AXIS_LABEL_PROP_ABS_GAS, /* 0x09 */
|
||||||
|
AXIS_LABEL_PROP_ABS_BRAKE, /* 0x0a */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_HAT0X, /* 0x10 */
|
||||||
|
AXIS_LABEL_PROP_ABS_HAT0Y, /* 0x11 */
|
||||||
|
AXIS_LABEL_PROP_ABS_HAT1X, /* 0x12 */
|
||||||
|
AXIS_LABEL_PROP_ABS_HAT1Y, /* 0x13 */
|
||||||
|
AXIS_LABEL_PROP_ABS_HAT2X, /* 0x14 */
|
||||||
|
AXIS_LABEL_PROP_ABS_HAT2Y, /* 0x15 */
|
||||||
|
AXIS_LABEL_PROP_ABS_HAT3X, /* 0x16 */
|
||||||
|
AXIS_LABEL_PROP_ABS_HAT3Y, /* 0x17 */
|
||||||
|
AXIS_LABEL_PROP_ABS_PRESSURE, /* 0x18 */
|
||||||
|
AXIS_LABEL_PROP_ABS_DISTANCE, /* 0x19 */
|
||||||
|
AXIS_LABEL_PROP_ABS_TILT_X, /* 0x1a */
|
||||||
|
AXIS_LABEL_PROP_ABS_TILT_Y, /* 0x1b */
|
||||||
|
AXIS_LABEL_PROP_ABS_TOOL_WIDTH, /* 0x1c */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_VOLUME /* 0x20 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR, /* 0x30 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR, /* 0x31 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR, /* 0x32 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR, /* 0x33 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_ORIENTATION, /* 0x34 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_POSITION_X, /* 0x35 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_POSITION_Y, /* 0x36 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE, /* 0x37 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_BLOB_ID, /* 0x38 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_TRACKING_ID, /* 0x39 */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_PRESSURE, /* 0x3a */
|
||||||
|
#ifdef AXIS_LABEL_PROP_ABS_MT_DISTANCE
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_DISTANCE, /* 0x3b */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_TOOL_X, /* 0x3c */
|
||||||
|
AXIS_LABEL_PROP_ABS_MT_TOOL_Y, /* 0x3d */
|
||||||
|
#endif /* AXIS_LABEL_PROP_ABS_MT_DISTANCE */
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char* rel_labels[] = {
|
||||||
|
AXIS_LABEL_PROP_REL_X,
|
||||||
|
AXIS_LABEL_PROP_REL_Y,
|
||||||
|
AXIS_LABEL_PROP_REL_Z,
|
||||||
|
AXIS_LABEL_PROP_REL_RX,
|
||||||
|
AXIS_LABEL_PROP_REL_RY,
|
||||||
|
AXIS_LABEL_PROP_REL_RZ,
|
||||||
|
AXIS_LABEL_PROP_REL_HWHEEL,
|
||||||
|
AXIS_LABEL_PROP_REL_DIAL,
|
||||||
|
AXIS_LABEL_PROP_REL_WHEEL,
|
||||||
|
AXIS_LABEL_PROP_REL_MISC
|
||||||
|
};
|
||||||
|
|
||||||
|
static const char* btn_labels[][16] = {
|
||||||
|
{ /* BTN_MISC group offset 0x100*/
|
||||||
|
BTN_LABEL_PROP_BTN_0, /* 0x00 */
|
||||||
|
BTN_LABEL_PROP_BTN_1, /* 0x01 */
|
||||||
|
BTN_LABEL_PROP_BTN_2, /* 0x02 */
|
||||||
|
BTN_LABEL_PROP_BTN_3, /* 0x03 */
|
||||||
|
BTN_LABEL_PROP_BTN_4, /* 0x04 */
|
||||||
|
BTN_LABEL_PROP_BTN_5, /* 0x05 */
|
||||||
|
BTN_LABEL_PROP_BTN_6, /* 0x06 */
|
||||||
|
BTN_LABEL_PROP_BTN_7, /* 0x07 */
|
||||||
|
BTN_LABEL_PROP_BTN_8, /* 0x08 */
|
||||||
|
BTN_LABEL_PROP_BTN_9 /* 0x09 */
|
||||||
|
},
|
||||||
|
{ /* BTN_MOUSE group offset 0x110 */
|
||||||
|
BTN_LABEL_PROP_BTN_LEFT, /* 0x00 */
|
||||||
|
BTN_LABEL_PROP_BTN_RIGHT, /* 0x01 */
|
||||||
|
BTN_LABEL_PROP_BTN_MIDDLE, /* 0x02 */
|
||||||
|
BTN_LABEL_PROP_BTN_SIDE, /* 0x03 */
|
||||||
|
BTN_LABEL_PROP_BTN_EXTRA, /* 0x04 */
|
||||||
|
BTN_LABEL_PROP_BTN_FORWARD, /* 0x05 */
|
||||||
|
BTN_LABEL_PROP_BTN_BACK, /* 0x06 */
|
||||||
|
BTN_LABEL_PROP_BTN_TASK /* 0x07 */
|
||||||
|
},
|
||||||
|
{ /* BTN_JOYSTICK group offset 0x120 */
|
||||||
|
BTN_LABEL_PROP_BTN_TRIGGER, /* 0x00 */
|
||||||
|
BTN_LABEL_PROP_BTN_THUMB, /* 0x01 */
|
||||||
|
BTN_LABEL_PROP_BTN_THUMB2, /* 0x02 */
|
||||||
|
BTN_LABEL_PROP_BTN_TOP, /* 0x03 */
|
||||||
|
BTN_LABEL_PROP_BTN_TOP2, /* 0x04 */
|
||||||
|
BTN_LABEL_PROP_BTN_PINKIE, /* 0x05 */
|
||||||
|
BTN_LABEL_PROP_BTN_BASE, /* 0x06 */
|
||||||
|
BTN_LABEL_PROP_BTN_BASE2, /* 0x07 */
|
||||||
|
BTN_LABEL_PROP_BTN_BASE3, /* 0x08 */
|
||||||
|
BTN_LABEL_PROP_BTN_BASE4, /* 0x09 */
|
||||||
|
BTN_LABEL_PROP_BTN_BASE5, /* 0x0a */
|
||||||
|
BTN_LABEL_PROP_BTN_BASE6, /* 0x0b */
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
BTN_LABEL_PROP_BTN_DEAD /* 0x0f */
|
||||||
|
},
|
||||||
|
{ /* BTN_GAMEPAD group offset 0x130 */
|
||||||
|
BTN_LABEL_PROP_BTN_A, /* 0x00 */
|
||||||
|
BTN_LABEL_PROP_BTN_B, /* 0x01 */
|
||||||
|
BTN_LABEL_PROP_BTN_C, /* 0x02 */
|
||||||
|
BTN_LABEL_PROP_BTN_X, /* 0x03 */
|
||||||
|
BTN_LABEL_PROP_BTN_Y, /* 0x04 */
|
||||||
|
BTN_LABEL_PROP_BTN_Z, /* 0x05 */
|
||||||
|
BTN_LABEL_PROP_BTN_TL, /* 0x06 */
|
||||||
|
BTN_LABEL_PROP_BTN_TR, /* 0x07 */
|
||||||
|
BTN_LABEL_PROP_BTN_TL2, /* 0x08 */
|
||||||
|
BTN_LABEL_PROP_BTN_TR2, /* 0x09 */
|
||||||
|
BTN_LABEL_PROP_BTN_SELECT, /* 0x0a */
|
||||||
|
BTN_LABEL_PROP_BTN_START, /* 0x0b */
|
||||||
|
BTN_LABEL_PROP_BTN_MODE, /* 0x0c */
|
||||||
|
BTN_LABEL_PROP_BTN_THUMBL, /* 0x0d */
|
||||||
|
BTN_LABEL_PROP_BTN_THUMBR /* 0x0e */
|
||||||
|
},
|
||||||
|
{ /* BTN_DIGI group offset 0x140 */
|
||||||
|
BTN_LABEL_PROP_BTN_TOOL_PEN, /* 0x00 */
|
||||||
|
BTN_LABEL_PROP_BTN_TOOL_RUBBER, /* 0x01 */
|
||||||
|
BTN_LABEL_PROP_BTN_TOOL_BRUSH, /* 0x02 */
|
||||||
|
BTN_LABEL_PROP_BTN_TOOL_PENCIL, /* 0x03 */
|
||||||
|
BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH, /* 0x04 */
|
||||||
|
BTN_LABEL_PROP_BTN_TOOL_FINGER, /* 0x05 */
|
||||||
|
BTN_LABEL_PROP_BTN_TOOL_MOUSE, /* 0x06 */
|
||||||
|
BTN_LABEL_PROP_BTN_TOOL_LENS, /* 0x07 */
|
||||||
|
NULL,
|
||||||
|
NULL,
|
||||||
|
BTN_LABEL_PROP_BTN_TOUCH, /* 0x0a */
|
||||||
|
BTN_LABEL_PROP_BTN_STYLUS, /* 0x0b */
|
||||||
|
BTN_LABEL_PROP_BTN_STYLUS2, /* 0x0c */
|
||||||
|
BTN_LABEL_PROP_BTN_TOOL_DOUBLETAP, /* 0x0d */
|
||||||
|
BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP /* 0x0e */
|
||||||
|
},
|
||||||
|
{ /* BTN_WHEEL group offset 0x150 */
|
||||||
|
BTN_LABEL_PROP_BTN_GEAR_DOWN, /* 0x00 */
|
||||||
|
BTN_LABEL_PROP_BTN_GEAR_UP /* 0x01 */
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
* Copyright 1994-2002 by The XFree86 Project, Inc.
|
* Copyright 1994-2002 by The XFree86 Project, Inc.
|
||||||
* Copyright 2002 by Paul Elliott
|
* Copyright 2002 by Paul Elliott
|
||||||
* (Ported from xf86-input-mouse, above copyrights taken from there)
|
* (Ported from xf86-input-mouse, above copyrights taken from there)
|
||||||
* Copyright © 2008 University of South Australia
|
* Copyright © 2008 University of South Australia
|
||||||
* Copyright 2008 by Chris Salch
|
* Copyright 2008 by Chris Salch
|
||||||
* Copyright 2008 Red Hat, Inc.
|
* Copyright 2008 Red Hat, Inc.
|
||||||
*
|
*
|
||||||
@@ -44,9 +44,7 @@
|
|||||||
|
|
||||||
#include <evdev-properties.h>
|
#include <evdev-properties.h>
|
||||||
|
|
||||||
#ifdef HAVE_PROPERTIES
|
|
||||||
static Atom prop_dlock = 0; /* Drag lock buttons. */
|
static Atom prop_dlock = 0; /* Drag lock buttons. */
|
||||||
#endif
|
|
||||||
|
|
||||||
void EvdevDragLockLockButton(InputInfoPtr pInfo, unsigned int button);
|
void EvdevDragLockLockButton(InputInfoPtr pInfo, unsigned int button);
|
||||||
|
|
||||||
@@ -105,13 +103,12 @@ EvdevDragLockPreInit(InputInfoPtr pInfo)
|
|||||||
/* We only have a meta button */
|
/* We only have a meta button */
|
||||||
pEvdev->dragLock.meta = meta_button;
|
pEvdev->dragLock.meta = meta_button;
|
||||||
|
|
||||||
xf86Msg(X_CONFIG, "%s: DragLockButtons : "
|
xf86IDrvMsg(pInfo, X_CONFIG, "DragLockButtons : "
|
||||||
"%i as meta\n",
|
"%i as meta\n", meta_button);
|
||||||
pInfo->name, meta_button);
|
|
||||||
} else {
|
} else {
|
||||||
xf86Msg(X_ERROR, "%s: DragLockButtons : "
|
xf86IDrvMsg(pInfo, X_ERROR, "DragLockButtons : "
|
||||||
"Incomplete pair specifying button pairs %s\n",
|
"Incomplete pair specifying button pairs %s\n",
|
||||||
pInfo->name, option_string);
|
option_string);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@@ -119,23 +116,24 @@ EvdevDragLockPreInit(InputInfoPtr pInfo)
|
|||||||
if ((meta_button <= EVDEV_MAXBUTTONS) && (meta_button >= 0 ) &&
|
if ((meta_button <= EVDEV_MAXBUTTONS) && (meta_button >= 0 ) &&
|
||||||
(lock_button <= EVDEV_MAXBUTTONS) && (lock_button >= 0)) {
|
(lock_button <= EVDEV_MAXBUTTONS) && (lock_button >= 0)) {
|
||||||
|
|
||||||
xf86Msg(X_CONFIG, "%s: DragLockButtons : %i -> %i\n",
|
xf86IDrvMsg(pInfo, X_CONFIG,
|
||||||
pInfo->name, meta_button, lock_button);
|
"DragLockButtons : %i -> %i\n",
|
||||||
|
meta_button, lock_button);
|
||||||
|
|
||||||
pEvdev->dragLock.lock_pair[meta_button - 1] = lock_button;
|
pEvdev->dragLock.lock_pair[meta_button - 1] = lock_button;
|
||||||
pairs=TRUE;
|
pairs=TRUE;
|
||||||
} else {
|
} else {
|
||||||
/* Let the user know something was wrong
|
/* Let the user know something was wrong
|
||||||
with this pair of buttons */
|
with this pair of buttons */
|
||||||
xf86Msg(X_CONFIG, "%s: DragLockButtons : "
|
xf86IDrvMsg(pInfo, X_CONFIG,"DragLockButtons : "
|
||||||
"Invalid button pair %i -> %i\n",
|
"Invalid button pair %i -> %i\n",
|
||||||
pInfo->name, meta_button, lock_button);
|
meta_button, lock_button);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
xf86Msg(X_ERROR, "%s: Found DragLockButtons "
|
xf86IDrvMsg(pInfo, X_ERROR, "Found DragLockButtons "
|
||||||
"with invalid lock button string : '%s'\n",
|
"with invalid lock button string : '%s'\n",
|
||||||
pInfo->name, option_string);
|
option_string);
|
||||||
|
|
||||||
/* This should be the case anyhow, just make sure */
|
/* This should be the case anyhow, just make sure */
|
||||||
next_num = NULL;
|
next_num = NULL;
|
||||||
@@ -211,7 +209,6 @@ EvdevDragLockFilterEvent(InputInfoPtr pInfo, unsigned int button, int value)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_PROPERTIES
|
|
||||||
/**
|
/**
|
||||||
* Set the drag lock property.
|
* Set the drag lock property.
|
||||||
* If only one value is supplied, then this is used as the meta button.
|
* If only one value is supplied, then this is used as the meta button.
|
||||||
@@ -319,5 +316,3 @@ EvdevDragLockInitProperty(DeviceIntPtr dev)
|
|||||||
|
|
||||||
XIRegisterPropertyHandler(dev, EvdevDragLockSetProperty, NULL, NULL);
|
XIRegisterPropertyHandler(dev, EvdevDragLockSetProperty, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|||||||
77
src/emuMB.c
77
src/emuMB.c
@@ -43,10 +43,9 @@
|
|||||||
|
|
||||||
#include <evdev-properties.h>
|
#include <evdev-properties.h>
|
||||||
|
|
||||||
#ifdef HAVE_PROPERTIES
|
|
||||||
static Atom prop_mbemu = 0; /* Middle button emulation on/off property */
|
static Atom prop_mbemu = 0; /* Middle button emulation on/off property */
|
||||||
static Atom prop_mbtimeout = 0; /* Middle button timeout property */
|
static Atom prop_mbtimeout = 0; /* Middle button timeout property */
|
||||||
#endif
|
static Atom prop_mbbuton = 0; /* Middle button target button property */
|
||||||
/*
|
/*
|
||||||
* Lets create a simple finite-state machine for 3 button emulation:
|
* Lets create a simple finite-state machine for 3 button emulation:
|
||||||
*
|
*
|
||||||
@@ -186,22 +185,34 @@ int
|
|||||||
EvdevMBEmuTimer(InputInfoPtr pInfo)
|
EvdevMBEmuTimer(InputInfoPtr pInfo)
|
||||||
{
|
{
|
||||||
EvdevPtr pEvdev = pInfo->private;
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
int sigstate;
|
|
||||||
int id;
|
int id;
|
||||||
|
int mapped_id;
|
||||||
|
|
||||||
sigstate = xf86BlockSIGIO ();
|
#if HAVE_THREADED_INPUT
|
||||||
|
input_lock();
|
||||||
|
#else
|
||||||
|
int sigstate = xf86BlockSIGIO();
|
||||||
|
#endif
|
||||||
|
|
||||||
pEvdev->emulateMB.pending = FALSE;
|
pEvdev->emulateMB.pending = FALSE;
|
||||||
if ((id = stateTab[pEvdev->emulateMB.state][4][0]) != 0) {
|
if ((id = stateTab[pEvdev->emulateMB.state][4][0]) != 0) {
|
||||||
EvdevPostButtonEvent(pInfo, abs(id), (id >= 0));
|
mapped_id = abs(id);
|
||||||
|
if (mapped_id == 2)
|
||||||
|
mapped_id = pEvdev->emulateMB.button;
|
||||||
|
EvdevPostButtonEvent(pInfo, mapped_id,
|
||||||
|
(id >= 0) ? BUTTON_PRESS : BUTTON_RELEASE);
|
||||||
pEvdev->emulateMB.state =
|
pEvdev->emulateMB.state =
|
||||||
stateTab[pEvdev->emulateMB.state][4][2];
|
stateTab[pEvdev->emulateMB.state][4][2];
|
||||||
} else {
|
} else {
|
||||||
ErrorF("Got unexpected buttonTimer in state %d\n",
|
xf86IDrvMsg(pInfo, X_ERROR, "Got unexpected buttonTimer in state %d\n",
|
||||||
pEvdev->emulateMB.state);
|
pEvdev->emulateMB.state);
|
||||||
}
|
}
|
||||||
|
|
||||||
xf86UnblockSIGIO (sigstate);
|
#if HAVE_THREADED_INPUT
|
||||||
|
input_unlock();
|
||||||
|
#else
|
||||||
|
xf86UnblockSIGIO(sigstate);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,6 +231,7 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
|
|||||||
{
|
{
|
||||||
EvdevPtr pEvdev = pInfo->private;
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
int id;
|
int id;
|
||||||
|
int mapped_id;
|
||||||
int *btstate;
|
int *btstate;
|
||||||
int ret = FALSE;
|
int ret = FALSE;
|
||||||
|
|
||||||
@@ -238,7 +250,10 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
|
|||||||
|
|
||||||
if ((id = stateTab[pEvdev->emulateMB.state][*btstate][0]) != 0)
|
if ((id = stateTab[pEvdev->emulateMB.state][*btstate][0]) != 0)
|
||||||
{
|
{
|
||||||
EvdevQueueButtonEvent(pInfo, abs(id), (id >= 0));
|
mapped_id = abs(id);
|
||||||
|
if (mapped_id == 2)
|
||||||
|
mapped_id = pEvdev->emulateMB.button;
|
||||||
|
EvdevQueueButtonEvent(pInfo, mapped_id, (id >= 0));
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
if ((id = stateTab[pEvdev->emulateMB.state][*btstate][1]) != 0)
|
if ((id = stateTab[pEvdev->emulateMB.state][*btstate][1]) != 0)
|
||||||
@@ -262,9 +277,7 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EvdevMBEmuWakeupHandler(pointer data,
|
void EvdevMBEmuWakeupHandler(WAKEUP_HANDLER_ARGS)
|
||||||
int i,
|
|
||||||
pointer LastSelectMask)
|
|
||||||
{
|
{
|
||||||
InputInfoPtr pInfo = (InputInfoPtr)data;
|
InputInfoPtr pInfo = (InputInfoPtr)data;
|
||||||
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
@@ -278,9 +291,7 @@ void EvdevMBEmuWakeupHandler(pointer data,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvdevMBEmuBlockHandler(pointer data,
|
void EvdevMBEmuBlockHandler(BLOCK_HANDLER_ARGS)
|
||||||
struct timeval **waitTime,
|
|
||||||
pointer LastSelectMask)
|
|
||||||
{
|
{
|
||||||
InputInfoPtr pInfo = (InputInfoPtr) data;
|
InputInfoPtr pInfo = (InputInfoPtr) data;
|
||||||
EvdevPtr pEvdev= (EvdevPtr) pInfo->private;
|
EvdevPtr pEvdev= (EvdevPtr) pInfo->private;
|
||||||
@@ -299,12 +310,23 @@ void
|
|||||||
EvdevMBEmuPreInit(InputInfoPtr pInfo)
|
EvdevMBEmuPreInit(InputInfoPtr pInfo)
|
||||||
{
|
{
|
||||||
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
|
int bt;
|
||||||
|
|
||||||
pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options,
|
pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options,
|
||||||
"Emulate3Buttons",
|
"Emulate3Buttons",
|
||||||
FALSE);
|
FALSE);
|
||||||
pEvdev->emulateMB.timeout = xf86SetIntOption(pInfo->options,
|
pEvdev->emulateMB.timeout = xf86SetIntOption(pInfo->options,
|
||||||
"Emulate3Timeout", 50);
|
"Emulate3Timeout", 50);
|
||||||
|
bt = xf86SetIntOption(pInfo->options, "Emulate3Button", 2);
|
||||||
|
if (bt < 0 || bt > EVDEV_MAXBUTTONS) {
|
||||||
|
xf86IDrvMsg(pInfo, X_WARNING, "Invalid Emulate3Button value: %d\n",
|
||||||
|
bt);
|
||||||
|
xf86IDrvMsg(pInfo, X_WARNING, "Middle button emulation disabled.\n");
|
||||||
|
|
||||||
|
pEvdev->emulateMB.enabled = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
pEvdev->emulateMB.button = bt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -330,13 +352,13 @@ EvdevMBEmuFinalize(InputInfoPtr pInfo)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_PROPERTIES
|
|
||||||
static int
|
static int
|
||||||
EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||||
BOOL checkonly)
|
BOOL checkonly)
|
||||||
{
|
{
|
||||||
InputInfoPtr pInfo = dev->public.devicePrivate;
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
EvdevPtr pEvdev = pInfo->private;
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
int bt;
|
||||||
|
|
||||||
if (atom == prop_mbemu)
|
if (atom == prop_mbemu)
|
||||||
{
|
{
|
||||||
@@ -352,6 +374,18 @@ EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
|||||||
|
|
||||||
if (!checkonly)
|
if (!checkonly)
|
||||||
pEvdev->emulateMB.timeout = *((CARD32*)val->data);
|
pEvdev->emulateMB.timeout = *((CARD32*)val->data);
|
||||||
|
} else if (atom == prop_mbbuton)
|
||||||
|
{
|
||||||
|
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
bt = *((CARD8*)val->data);
|
||||||
|
|
||||||
|
if (bt < 0 || bt > EVDEV_MAXBUTTONS)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
pEvdev->emulateMB.button = bt;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Success;
|
return Success;
|
||||||
@@ -389,6 +423,15 @@ EvdevMBEmuInitProperty(DeviceIntPtr dev)
|
|||||||
return;
|
return;
|
||||||
XISetDevicePropertyDeletable(dev, prop_mbtimeout, FALSE);
|
XISetDevicePropertyDeletable(dev, prop_mbtimeout, FALSE);
|
||||||
|
|
||||||
|
prop_mbbuton = MakeAtom(EVDEV_PROP_MIDBUTTON_BUTTON,
|
||||||
|
strlen(EVDEV_PROP_MIDBUTTON_BUTTON),
|
||||||
|
TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_mbbuton, XA_INTEGER, 8, PropModeReplace, 1,
|
||||||
|
&pEvdev->emulateMB.button, FALSE);
|
||||||
|
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_mbbuton, FALSE);
|
||||||
|
|
||||||
XIRegisterPropertyHandler(dev, EvdevMBEmuSetProperty, NULL, NULL);
|
XIRegisterPropertyHandler(dev, EvdevMBEmuSetProperty, NULL, NULL);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|||||||
423
src/emuThird.c
Normal file
423
src/emuThird.c
Normal file
@@ -0,0 +1,423 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 2011 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 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.
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Right mouse button emulation code.
|
||||||
|
* Emulates a right button event if the first button is held down for a
|
||||||
|
* timeout. If the device moves more than a certain amount before the
|
||||||
|
* timeout is over, the emulation is cancelled and a normal button event is
|
||||||
|
* generated.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "evdev.h"
|
||||||
|
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
#include <xf86.h>
|
||||||
|
#include <xf86Xinput.h>
|
||||||
|
#include <exevents.h>
|
||||||
|
|
||||||
|
#include <evdev-properties.h>
|
||||||
|
|
||||||
|
/* Threshold (in device coordinates) for devices to cancel emulation */
|
||||||
|
#define DEFAULT_MOVE_THRESHOLD 20
|
||||||
|
|
||||||
|
static Atom prop_3bemu; /* Right button emulation on/off property */
|
||||||
|
static Atom prop_3btimeout; /* Right button timeout property */
|
||||||
|
static Atom prop_3bbutton; /* Right button target physical button */
|
||||||
|
static Atom prop_3bthreshold; /* Right button move cancellation threshold */
|
||||||
|
|
||||||
|
/* State machine for 3rd button emulation */
|
||||||
|
enum EmulationState {
|
||||||
|
EM3B_OFF, /* no event */
|
||||||
|
EM3B_PENDING, /* timer pending */
|
||||||
|
EM3B_EMULATING /* in emulation */
|
||||||
|
};
|
||||||
|
|
||||||
|
static void
|
||||||
|
Evdev3BEmuPostButtonEvent(InputInfoPtr pInfo, int button, enum ButtonAction act)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||||
|
int absolute = Relative;
|
||||||
|
|
||||||
|
/* if we cancel, emit the button down event at our start position,
|
||||||
|
* not at the current position. Only for absolute devices though. For
|
||||||
|
* relative events, this may be a bit iffy since pointer accel may shoot
|
||||||
|
* us back more than we moved and confuse the user.
|
||||||
|
*/
|
||||||
|
if (emu3B->flags & EVDEV_ABSOLUTE_EVENTS)
|
||||||
|
absolute = Absolute;
|
||||||
|
|
||||||
|
xf86PostButtonEventP(pInfo->dev, absolute, button,
|
||||||
|
(act == BUTTON_PRESS) ? 1 : 0, 0,
|
||||||
|
(absolute ? 2 : 0), emu3B->startpos);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Timer function. Post a button down event to the server.
|
||||||
|
*
|
||||||
|
* @param arg The InputInfoPtr for this device.
|
||||||
|
*/
|
||||||
|
CARD32
|
||||||
|
Evdev3BEmuTimer(OsTimerPtr timer, CARD32 time, pointer arg)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = (InputInfoPtr)arg;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||||
|
|
||||||
|
#if HAVE_THREADED_INPUT
|
||||||
|
input_lock();
|
||||||
|
#else
|
||||||
|
int sigstate = xf86BlockSIGIO();
|
||||||
|
#endif
|
||||||
|
emu3B->state = EM3B_EMULATING;
|
||||||
|
Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, BUTTON_PRESS);
|
||||||
|
#if HAVE_THREADED_INPUT
|
||||||
|
input_unlock();
|
||||||
|
#else
|
||||||
|
xf86UnblockSIGIO(sigstate);
|
||||||
|
#endif
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Cancel all emulation, reset the timer and reset deltas.
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
Evdev3BCancel(InputInfoPtr pInfo)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||||
|
|
||||||
|
if (emu3B->state != EM3B_OFF)
|
||||||
|
{
|
||||||
|
TimerCancel(emu3B->timer);
|
||||||
|
emu3B->state = EM3B_OFF;
|
||||||
|
memset(emu3B->delta, 0, sizeof(emu3B->delta));
|
||||||
|
}
|
||||||
|
|
||||||
|
emu3B->flags = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Emulate a third button on button press. Note that emulation only triggers
|
||||||
|
* on button 1.
|
||||||
|
*
|
||||||
|
* Return TRUE if event was swallowed by middle mouse button emulation,
|
||||||
|
* FALSE otherwise.
|
||||||
|
*/
|
||||||
|
BOOL
|
||||||
|
Evdev3BEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||||
|
int ret = FALSE;
|
||||||
|
|
||||||
|
if (!emu3B->enabled)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
if (press)
|
||||||
|
emu3B->buttonstate |= button;
|
||||||
|
else
|
||||||
|
emu3B->buttonstate &= ~button;
|
||||||
|
|
||||||
|
/* Any other button pressed? Cancel timer */
|
||||||
|
if (button != 1)
|
||||||
|
{
|
||||||
|
switch (emu3B->state)
|
||||||
|
{
|
||||||
|
case EM3B_PENDING:
|
||||||
|
Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
|
||||||
|
Evdev3BCancel(pInfo);
|
||||||
|
break;
|
||||||
|
case EM3B_EMULATING:
|
||||||
|
/* We're emulating and now the user pressed a different
|
||||||
|
* button. Just release the emulating one, tell the user to
|
||||||
|
* not do that and get on with life */
|
||||||
|
Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, BUTTON_RELEASE);
|
||||||
|
Evdev3BCancel(pInfo);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Don't emulate if any other button is down */
|
||||||
|
if ((emu3B->buttonstate & ~0x1) != 0)
|
||||||
|
goto out;
|
||||||
|
|
||||||
|
/* Release event → cancel, send press and release now. */
|
||||||
|
if (!press)
|
||||||
|
{
|
||||||
|
switch(emu3B->state)
|
||||||
|
{
|
||||||
|
case EM3B_PENDING:
|
||||||
|
Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
|
||||||
|
Evdev3BCancel(pInfo);
|
||||||
|
break;
|
||||||
|
case EM3B_EMULATING:
|
||||||
|
Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, BUTTON_RELEASE);
|
||||||
|
Evdev3BCancel(pInfo);
|
||||||
|
ret = TRUE;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (press && emu3B->state == EM3B_OFF)
|
||||||
|
{
|
||||||
|
emu3B->state = EM3B_PENDING;
|
||||||
|
emu3B->timer = TimerSet(emu3B->timer, 0, emu3B->timeout,
|
||||||
|
Evdev3BEmuTimer, pInfo);
|
||||||
|
ret = TRUE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle absolute x/y motion. If the motion is above the threshold, cancel
|
||||||
|
* emulation.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
Evdev3BEmuProcessAbsMotion(InputInfoPtr pInfo, ValuatorMask *vals)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||||
|
int cancel = FALSE;
|
||||||
|
int axis = 0;
|
||||||
|
|
||||||
|
if (emu3B->state != EM3B_PENDING)
|
||||||
|
{
|
||||||
|
if (valuator_mask_isset(vals, 0))
|
||||||
|
emu3B->startpos[0] = valuator_mask_get(vals, 0);
|
||||||
|
if (valuator_mask_isset(vals, 1))
|
||||||
|
emu3B->startpos[1] = valuator_mask_get(vals, 1);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((emu3B->flags & EVDEV_ABSOLUTE_EVENTS) == 0)
|
||||||
|
emu3B->flags |= EVDEV_ABSOLUTE_EVENTS;
|
||||||
|
|
||||||
|
while (axis <= 1 && !cancel)
|
||||||
|
{
|
||||||
|
if (valuator_mask_isset(vals, axis))
|
||||||
|
{
|
||||||
|
double delta = valuator_mask_get_double(vals, axis) - emu3B->startpos[axis];
|
||||||
|
if (fabs(delta) > emu3B->threshold)
|
||||||
|
cancel = TRUE;
|
||||||
|
}
|
||||||
|
axis++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cancel)
|
||||||
|
{
|
||||||
|
Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
|
||||||
|
Evdev3BCancel(pInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle relative x/y motion. If the motion is above the threshold, cancel
|
||||||
|
* emulation.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
Evdev3BEmuProcessRelMotion(InputInfoPtr pInfo, double dx, double dy)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||||
|
|
||||||
|
if (emu3B->state != EM3B_PENDING)
|
||||||
|
return;
|
||||||
|
|
||||||
|
emu3B->delta[0] += dx;
|
||||||
|
emu3B->delta[1] += dy;
|
||||||
|
emu3B->flags |= EVDEV_RELATIVE_EVENTS;
|
||||||
|
|
||||||
|
if (fabs(emu3B->delta[0]) > emu3B->threshold ||
|
||||||
|
fabs(emu3B->delta[1]) > emu3B->threshold)
|
||||||
|
{
|
||||||
|
Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
|
||||||
|
Evdev3BCancel(pInfo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Evdev3BEmuPreInit(InputInfoPtr pInfo)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||||
|
|
||||||
|
emu3B->enabled = xf86SetBoolOption(pInfo->options,
|
||||||
|
"EmulateThirdButton",
|
||||||
|
FALSE);
|
||||||
|
emu3B->timeout = xf86SetIntOption(pInfo->options,
|
||||||
|
"EmulateThirdButtonTimeout",
|
||||||
|
1000);
|
||||||
|
emu3B->button = xf86SetIntOption(pInfo->options,
|
||||||
|
"EmulateThirdButtonButton",
|
||||||
|
3);
|
||||||
|
/* FIXME: this should be auto-configured based on axis ranges */
|
||||||
|
emu3B->threshold = xf86SetIntOption(pInfo->options,
|
||||||
|
"EmulateThirdButtonMoveThreshold",
|
||||||
|
DEFAULT_MOVE_THRESHOLD);
|
||||||
|
/* allocate now so we don't allocate in the signal handler */
|
||||||
|
emu3B->timer = TimerSet(NULL, 0, 0, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Evdev3BEmuOn(InputInfoPtr pInfo)
|
||||||
|
{
|
||||||
|
/* This function just exists for symmetry in evdev.c */
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
Evdev3BEmuFinalize(InputInfoPtr pInfo)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||||
|
|
||||||
|
TimerFree(emu3B->timer);
|
||||||
|
emu3B->timer = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
Evdev3BEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||||
|
BOOL checkonly)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||||
|
|
||||||
|
if (atom == prop_3bemu)
|
||||||
|
{
|
||||||
|
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
emu3B->enabled = *((BOOL*)val->data);
|
||||||
|
|
||||||
|
} else if (atom == prop_3btimeout)
|
||||||
|
{
|
||||||
|
if (val->format != 32 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
emu3B->timeout = *((CARD32*)val->data);
|
||||||
|
|
||||||
|
} else if (atom == prop_3bbutton)
|
||||||
|
{
|
||||||
|
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
emu3B->button = *((CARD8*)val->data);
|
||||||
|
} else if (atom == prop_3bthreshold)
|
||||||
|
{
|
||||||
|
if (val->format != 32 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
emu3B->threshold = *((CARD32*)val->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise properties for third button emulation
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
Evdev3BEmuInitProperty(DeviceIntPtr dev)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
if (!dev->button) /* don't init prop for keyboards */
|
||||||
|
return;
|
||||||
|
|
||||||
|
/* third button emulation on/off */
|
||||||
|
prop_3bemu = MakeAtom(EVDEV_PROP_THIRDBUTTON, strlen(EVDEV_PROP_THIRDBUTTON), TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_3bemu, XA_INTEGER, 8,
|
||||||
|
PropModeReplace, 1,
|
||||||
|
&emu3B->enabled,
|
||||||
|
FALSE);
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_3bemu, FALSE);
|
||||||
|
|
||||||
|
/* third button emulation timeout */
|
||||||
|
prop_3btimeout = MakeAtom(EVDEV_PROP_THIRDBUTTON_TIMEOUT,
|
||||||
|
strlen(EVDEV_PROP_THIRDBUTTON_TIMEOUT),
|
||||||
|
TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_3btimeout, XA_INTEGER, 32, PropModeReplace, 1,
|
||||||
|
&emu3B->timeout, FALSE);
|
||||||
|
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_3btimeout, FALSE);
|
||||||
|
|
||||||
|
/* third button emulation button to be triggered */
|
||||||
|
prop_3bbutton = MakeAtom(EVDEV_PROP_THIRDBUTTON_BUTTON,
|
||||||
|
strlen(EVDEV_PROP_THIRDBUTTON_BUTTON),
|
||||||
|
TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_3bbutton, XA_INTEGER, 8, PropModeReplace, 1,
|
||||||
|
&emu3B->button, FALSE);
|
||||||
|
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_3bbutton, FALSE);
|
||||||
|
|
||||||
|
/* third button emulation movement threshold */
|
||||||
|
prop_3bthreshold = MakeAtom(EVDEV_PROP_THIRDBUTTON_THRESHOLD,
|
||||||
|
strlen(EVDEV_PROP_THIRDBUTTON_THRESHOLD),
|
||||||
|
TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_3bthreshold, XA_INTEGER, 32, PropModeReplace, 1,
|
||||||
|
&emu3B->threshold, FALSE);
|
||||||
|
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_3bthreshold, FALSE);
|
||||||
|
|
||||||
|
XIRegisterPropertyHandler(dev, Evdev3BEmuSetProperty, NULL, NULL);
|
||||||
|
}
|
||||||
@@ -44,16 +44,13 @@
|
|||||||
|
|
||||||
#define WHEEL_NOT_CONFIGURED 0
|
#define WHEEL_NOT_CONFIGURED 0
|
||||||
|
|
||||||
#ifdef HAVE_PROPERTIES
|
|
||||||
static Atom prop_wheel_emu = 0;
|
static Atom prop_wheel_emu = 0;
|
||||||
static Atom prop_wheel_axismap = 0;
|
static Atom prop_wheel_axismap = 0;
|
||||||
static Atom prop_wheel_inertia = 0;
|
static Atom prop_wheel_inertia = 0;
|
||||||
static Atom prop_wheel_timeout = 0;
|
static Atom prop_wheel_timeout = 0;
|
||||||
static Atom prop_wheel_button = 0;
|
static Atom prop_wheel_button = 0;
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Local Funciton Prototypes */
|
/* Local Function Prototypes */
|
||||||
static BOOL EvdevWheelEmuHandleButtonMap(InputInfoPtr pInfo, WheelAxisPtr pAxis, char *axis_name);
|
|
||||||
static int EvdevWheelEmuInertia(InputInfoPtr pInfo, WheelAxisPtr axis, int value);
|
static int EvdevWheelEmuInertia(InputInfoPtr pInfo, WheelAxisPtr axis, int value);
|
||||||
|
|
||||||
/* Filter mouse button events */
|
/* Filter mouse button events */
|
||||||
@@ -98,9 +95,8 @@ BOOL
|
|||||||
EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
|
EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
|
||||||
{
|
{
|
||||||
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
WheelAxisPtr pAxis = NULL, pOtherAxis = NULL;
|
WheelAxisPtr pAxis = NULL;
|
||||||
int value = pEv->value;
|
int value = pEv->value;
|
||||||
int oldValue;
|
|
||||||
|
|
||||||
/* Has wheel emulation been configured to be enabled? */
|
/* Has wheel emulation been configured to be enabled? */
|
||||||
if (!pEvdev->emulateWheel.enabled)
|
if (!pEvdev->emulateWheel.enabled)
|
||||||
@@ -118,11 +114,15 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We don't want to intercept real mouse wheel events */
|
|
||||||
if(pEv->type == EV_ABS) {
|
if(pEv->type == EV_ABS) {
|
||||||
oldValue = pEvdev->vals[pEvdev->axis_map[pEv->code]];
|
int axis = pEvdev->abs_axis_map[pEv->code];
|
||||||
pEvdev->vals[pEvdev->axis_map[pEv->code]] = value;
|
int oldValue;
|
||||||
value -= oldValue; /* make value into a differential measurement */
|
|
||||||
|
if (axis > -1 && valuator_mask_fetch(pEvdev->old_vals, axis, &oldValue)) {
|
||||||
|
valuator_mask_set(pEvdev->abs_vals, axis, value);
|
||||||
|
value -= oldValue; /* make value into a differential measurement */
|
||||||
|
} else
|
||||||
|
value = 0; /* avoid a jump on the first touch */
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(pEv->code) {
|
switch(pEv->code) {
|
||||||
@@ -130,13 +130,11 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
|
|||||||
/* ABS_X has the same value as REL_X, so this case catches both */
|
/* ABS_X has the same value as REL_X, so this case catches both */
|
||||||
case REL_X:
|
case REL_X:
|
||||||
pAxis = &(pEvdev->emulateWheel.X);
|
pAxis = &(pEvdev->emulateWheel.X);
|
||||||
pOtherAxis = &(pEvdev->emulateWheel.Y);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* ABS_Y has the same value as REL_Y, so this case catches both */
|
/* ABS_Y has the same value as REL_Y, so this case catches both */
|
||||||
case REL_Y:
|
case REL_Y:
|
||||||
pAxis = &(pEvdev->emulateWheel.Y);
|
pAxis = &(pEvdev->emulateWheel.Y);
|
||||||
pOtherAxis = &(pEvdev->emulateWheel.X);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -144,15 +142,10 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* If we found REL_X, REL_Y, ABS_X or ABS_Y then emulate a mouse
|
/* If we found REL_X, REL_Y, ABS_X or ABS_Y then emulate a mouse
|
||||||
wheel. Reset the inertia of the other axis when a scroll event
|
wheel.
|
||||||
was sent to avoid the buildup of erroneous scroll events if the
|
|
||||||
user doesn't move in a perfectly straight line.
|
|
||||||
*/
|
*/
|
||||||
if (pAxis)
|
if (pAxis)
|
||||||
{
|
EvdevWheelEmuInertia(pInfo, pAxis, value);
|
||||||
if (EvdevWheelEmuInertia(pInfo, pAxis, value))
|
|
||||||
pOtherAxis->traveled_distance = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Eat motion events while emulateWheel button pressed. */
|
/* Eat motion events while emulateWheel button pressed. */
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@@ -198,7 +191,8 @@ EvdevWheelEmuInertia(InputInfoPtr pInfo, WheelAxisPtr axis, int value)
|
|||||||
/* Handle button mapping here to avoid code duplication,
|
/* Handle button mapping here to avoid code duplication,
|
||||||
returns true if a button mapping was found. */
|
returns true if a button mapping was found. */
|
||||||
static BOOL
|
static BOOL
|
||||||
EvdevWheelEmuHandleButtonMap(InputInfoPtr pInfo, WheelAxisPtr pAxis, char* axis_name)
|
EvdevWheelEmuHandleButtonMap(InputInfoPtr pInfo, WheelAxisPtr pAxis,
|
||||||
|
const char *axis_name)
|
||||||
{
|
{
|
||||||
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
char *option_string;
|
char *option_string;
|
||||||
@@ -230,14 +224,14 @@ EvdevWheelEmuHandleButtonMap(InputInfoPtr pInfo, WheelAxisPtr pAxis, char* axis_
|
|||||||
if (down_button > pEvdev->num_buttons) pEvdev->num_buttons = down_button;
|
if (down_button > pEvdev->num_buttons) pEvdev->num_buttons = down_button;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
xf86Msg(X_WARNING, "%s: Invalid %s value:\"%s\"\n",
|
xf86IDrvMsg(pInfo, X_WARNING, "Invalid %s value:\"%s\"\n",
|
||||||
pInfo->name, axis_name, option_string);
|
axis_name, option_string);
|
||||||
}
|
}
|
||||||
free(option_string);
|
free(option_string);
|
||||||
|
|
||||||
/* Clean up and log what happened */
|
/* Clean up and log what happened */
|
||||||
if (msg) {
|
if (msg) {
|
||||||
xf86Msg(X_CONFIG, "%s: %s: %s\n",pInfo->name, axis_name, msg);
|
xf86IDrvMsg(pInfo, X_CONFIG, "%s: %s\n", axis_name, msg);
|
||||||
free(msg);
|
free(msg);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@@ -250,14 +244,10 @@ void
|
|||||||
EvdevWheelEmuPreInit(InputInfoPtr pInfo)
|
EvdevWheelEmuPreInit(InputInfoPtr pInfo)
|
||||||
{
|
{
|
||||||
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
char val[4];
|
|
||||||
int wheelButton;
|
int wheelButton;
|
||||||
int inertia;
|
int inertia;
|
||||||
int timeout;
|
int timeout;
|
||||||
|
|
||||||
val[0] = 0;
|
|
||||||
val[1] = 0;
|
|
||||||
|
|
||||||
if (xf86SetBoolOption(pInfo->options, "EmulateWheel", FALSE)) {
|
if (xf86SetBoolOption(pInfo->options, "EmulateWheel", FALSE)) {
|
||||||
pEvdev->emulateWheel.enabled = TRUE;
|
pEvdev->emulateWheel.enabled = TRUE;
|
||||||
} else
|
} else
|
||||||
@@ -266,9 +256,9 @@ EvdevWheelEmuPreInit(InputInfoPtr pInfo)
|
|||||||
wheelButton = xf86SetIntOption(pInfo->options, "EmulateWheelButton", 4);
|
wheelButton = xf86SetIntOption(pInfo->options, "EmulateWheelButton", 4);
|
||||||
|
|
||||||
if ((wheelButton < 0) || (wheelButton > EVDEV_MAXBUTTONS)) {
|
if ((wheelButton < 0) || (wheelButton > EVDEV_MAXBUTTONS)) {
|
||||||
xf86Msg(X_WARNING, "%s: Invalid EmulateWheelButton value: %d\n",
|
xf86IDrvMsg(pInfo, X_WARNING, "Invalid EmulateWheelButton value: %d\n",
|
||||||
pInfo->name, wheelButton);
|
wheelButton);
|
||||||
xf86Msg(X_WARNING, "%s: Wheel emulation disabled.\n", pInfo->name);
|
xf86IDrvMsg(pInfo, X_WARNING, "Wheel emulation disabled.\n");
|
||||||
|
|
||||||
pEvdev->emulateWheel.enabled = FALSE;
|
pEvdev->emulateWheel.enabled = FALSE;
|
||||||
}
|
}
|
||||||
@@ -278,10 +268,9 @@ EvdevWheelEmuPreInit(InputInfoPtr pInfo)
|
|||||||
inertia = xf86SetIntOption(pInfo->options, "EmulateWheelInertia", 10);
|
inertia = xf86SetIntOption(pInfo->options, "EmulateWheelInertia", 10);
|
||||||
|
|
||||||
if (inertia <= 0) {
|
if (inertia <= 0) {
|
||||||
xf86Msg(X_WARNING, "%s: Invalid EmulateWheelInertia value: %d\n",
|
xf86IDrvMsg(pInfo, X_WARNING, "Invalid EmulateWheelInertia value: %d\n",
|
||||||
pInfo->name, inertia);
|
inertia);
|
||||||
xf86Msg(X_WARNING, "%s: Using built-in inertia value.\n",
|
xf86IDrvMsg(pInfo, X_WARNING, "Using built-in inertia value.\n");
|
||||||
pInfo->name);
|
|
||||||
|
|
||||||
inertia = 10;
|
inertia = 10;
|
||||||
}
|
}
|
||||||
@@ -291,10 +280,9 @@ EvdevWheelEmuPreInit(InputInfoPtr pInfo)
|
|||||||
timeout = xf86SetIntOption(pInfo->options, "EmulateWheelTimeout", 200);
|
timeout = xf86SetIntOption(pInfo->options, "EmulateWheelTimeout", 200);
|
||||||
|
|
||||||
if (timeout < 0) {
|
if (timeout < 0) {
|
||||||
xf86Msg(X_WARNING, "%s: Invalid EmulateWheelTimeout value: %d\n",
|
xf86IDrvMsg(pInfo, X_WARNING, "Invalid EmulateWheelTimeout value: %d\n",
|
||||||
pInfo->name, timeout);
|
timeout);
|
||||||
xf86Msg(X_WARNING, "%s: Using built-in timeout value.\n",
|
xf86IDrvMsg(pInfo, X_WARNING, "Using built-in timeout value.\n");
|
||||||
pInfo->name);
|
|
||||||
|
|
||||||
timeout = 200;
|
timeout = 200;
|
||||||
}
|
}
|
||||||
@@ -314,9 +302,9 @@ EvdevWheelEmuPreInit(InputInfoPtr pInfo)
|
|||||||
pEvdev->num_buttons = 5;
|
pEvdev->num_buttons = 5;
|
||||||
|
|
||||||
/* Display default Configuration */
|
/* Display default Configuration */
|
||||||
xf86Msg(X_CONFIG, "%s: YAxisMapping: buttons %d and %d\n",
|
xf86IDrvMsg(pInfo, X_CONFIG, "YAxisMapping: buttons %d and %d\n",
|
||||||
pInfo->name, pEvdev->emulateWheel.Y.up_button,
|
pEvdev->emulateWheel.Y.up_button,
|
||||||
pEvdev->emulateWheel.Y.down_button);
|
pEvdev->emulateWheel.Y.down_button);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -329,13 +317,13 @@ EvdevWheelEmuPreInit(InputInfoPtr pInfo)
|
|||||||
pEvdev->emulateWheel.X.traveled_distance = 0;
|
pEvdev->emulateWheel.X.traveled_distance = 0;
|
||||||
pEvdev->emulateWheel.Y.traveled_distance = 0;
|
pEvdev->emulateWheel.Y.traveled_distance = 0;
|
||||||
|
|
||||||
xf86Msg(X_CONFIG, "%s: EmulateWheelButton: %d, "
|
xf86IDrvMsg(pInfo, X_CONFIG,
|
||||||
"EmulateWheelInertia: %d, "
|
"EmulateWheelButton: %d, "
|
||||||
"EmulateWheelTimeout: %d\n",
|
"EmulateWheelInertia: %d, "
|
||||||
pInfo->name, pEvdev->emulateWheel.button, inertia, timeout);
|
"EmulateWheelTimeout: %d\n",
|
||||||
|
pEvdev->emulateWheel.button, inertia, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_PROPERTIES
|
|
||||||
static int
|
static int
|
||||||
EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||||
BOOL checkonly)
|
BOOL checkonly)
|
||||||
@@ -399,7 +387,7 @@ EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
|||||||
|
|
||||||
inertia = *((CARD16*)val->data);
|
inertia = *((CARD16*)val->data);
|
||||||
|
|
||||||
if (inertia < 0)
|
if (inertia <= 0)
|
||||||
return BadValue;
|
return BadValue;
|
||||||
|
|
||||||
if (!checkonly)
|
if (!checkonly)
|
||||||
@@ -485,4 +473,3 @@ EvdevWheelEmuInitProperty(DeviceIntPtr dev)
|
|||||||
|
|
||||||
XIRegisterPropertyHandler(dev, EvdevWheelEmuSetProperty, NULL, NULL);
|
XIRegisterPropertyHandler(dev, EvdevWheelEmuSetProperty, NULL, NULL);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|||||||
2796
src/evdev.c
2796
src/evdev.c
File diff suppressed because it is too large
Load Diff
170
src/evdev.h
170
src/evdev.h
@@ -28,17 +28,32 @@
|
|||||||
* Oliver McFadden (oliver.mcfadden@nokia.com)
|
* Oliver McFadden (oliver.mcfadden@nokia.com)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef EVDEV_H
|
#ifndef EVDEV_H
|
||||||
#define EVDEV_H
|
#define EVDEV_H
|
||||||
|
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
#include <linux/types.h>
|
#include <sys/types.h>
|
||||||
|
|
||||||
|
/* Tolerate prior #include <linux/input.h> */
|
||||||
|
#undef BUS_NONE
|
||||||
|
#undef BUS_PCI
|
||||||
|
#undef BUS_SBUS
|
||||||
|
#undef BUS_PLATFORM
|
||||||
|
#undef BUS_USB
|
||||||
|
|
||||||
#include <xorg-server.h>
|
#include <xorg-server.h>
|
||||||
#include <xf86Xinput.h>
|
#include <xf86Xinput.h>
|
||||||
#include <xf86_OSproc.h>
|
#include <xf86_OSproc.h>
|
||||||
#include <xkbstr.h>
|
#include <xkbstr.h>
|
||||||
|
|
||||||
|
#include <mtdev.h>
|
||||||
|
|
||||||
|
#include <libevdev/libevdev.h>
|
||||||
|
|
||||||
#ifndef EV_CNT /* linux 2.6.23 kernels and earlier lack _CNT defines */
|
#ifndef EV_CNT /* linux 2.6.23 kernels and earlier lack _CNT defines */
|
||||||
#define EV_CNT (EV_MAX+1)
|
#define EV_CNT (EV_MAX+1)
|
||||||
#endif
|
#endif
|
||||||
@@ -55,6 +70,22 @@
|
|||||||
#define LED_CNT (LED_MAX+1)
|
#define LED_CNT (LED_MAX+1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 18
|
||||||
|
#define LogMessageVerbSigSafe xf86MsgVerb
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 23
|
||||||
|
#define HAVE_THREADED_INPUT 1
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 24
|
||||||
|
#define BLOCK_HANDLER_ARGS void *data, void *waitTime
|
||||||
|
#define WAKEUP_HANDLER_ARGS void *data, int i
|
||||||
|
#else
|
||||||
|
#define BLOCK_HANDLER_ARGS pointer data, struct timeval **waitTime, pointer LastSelectMask
|
||||||
|
#define WAKEUP_HANDLER_ARGS void *data, int i, pointer LastSelectMask
|
||||||
|
#endif
|
||||||
|
|
||||||
#define EVDEV_MAXBUTTONS 32
|
#define EVDEV_MAXBUTTONS 32
|
||||||
#define EVDEV_MAXQUEUE 32
|
#define EVDEV_MAXQUEUE 32
|
||||||
|
|
||||||
@@ -72,31 +103,40 @@
|
|||||||
#define EVDEV_UNIGNORE_RELATIVE (1 << 10) /* explicitly unignore rel axes */
|
#define EVDEV_UNIGNORE_RELATIVE (1 << 10) /* explicitly unignore rel axes */
|
||||||
#define EVDEV_RELATIVE_MODE (1 << 11) /* Force relative events for devices with absolute axes */
|
#define EVDEV_RELATIVE_MODE (1 << 11) /* Force relative events for devices with absolute axes */
|
||||||
|
|
||||||
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3
|
|
||||||
#define HAVE_PROPERTIES 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef MAX_VALUATORS
|
#ifndef MAX_VALUATORS
|
||||||
#define MAX_VALUATORS 36
|
#define MAX_VALUATORS 36
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef XI_PROP_DEVICE_NODE
|
||||||
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 5
|
#define XI_PROP_DEVICE_NODE "Device Node"
|
||||||
typedef struct {
|
|
||||||
char *rules;
|
|
||||||
char *model;
|
|
||||||
char *layout;
|
|
||||||
char *variant;
|
|
||||||
char *options;
|
|
||||||
} XkbRMLVOSet;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define LONG_BITS (sizeof(long) * 8)
|
#define LONG_BITS (sizeof(long) * 8)
|
||||||
|
|
||||||
/* Number of longs needed to hold the given number of bits */
|
/* Number of longs needed to hold the given number of bits */
|
||||||
#define NLONGS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
|
#define NLONGS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
|
||||||
|
|
||||||
|
#define DEFAULT_MOUSE_DPI 1000.0
|
||||||
|
|
||||||
|
/* Function key mode */
|
||||||
|
enum fkeymode {
|
||||||
|
FKEYMODE_UNKNOWN = 0,
|
||||||
|
FKEYMODE_FKEYS, /* function keys send function keys */
|
||||||
|
FKEYMODE_MMKEYS, /* function keys send multimedia keys */
|
||||||
|
};
|
||||||
|
|
||||||
|
enum SlotState {
|
||||||
|
SLOTSTATE_OPEN = 8,
|
||||||
|
SLOTSTATE_CLOSE,
|
||||||
|
SLOTSTATE_UPDATE,
|
||||||
|
SLOTSTATE_EMPTY,
|
||||||
|
};
|
||||||
|
|
||||||
|
enum ButtonAction {
|
||||||
|
BUTTON_RELEASE = 0,
|
||||||
|
BUTTON_PRESS = 1
|
||||||
|
};
|
||||||
|
|
||||||
/* axis specific data for wheel emulation */
|
/* axis specific data for wheel emulation */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int up_button;
|
int up_button;
|
||||||
@@ -110,19 +150,39 @@ typedef struct {
|
|||||||
EV_QUEUE_KEY, /* xf86PostKeyboardEvent() */
|
EV_QUEUE_KEY, /* xf86PostKeyboardEvent() */
|
||||||
EV_QUEUE_BTN, /* xf86PostButtonEvent() */
|
EV_QUEUE_BTN, /* xf86PostButtonEvent() */
|
||||||
EV_QUEUE_PROXIMITY, /* xf86PostProximityEvent() */
|
EV_QUEUE_PROXIMITY, /* xf86PostProximityEvent() */
|
||||||
|
EV_QUEUE_TOUCH, /*xf86PostTouchEvent() */
|
||||||
} type;
|
} type;
|
||||||
int key; /* May be either a key code or button number. */
|
union {
|
||||||
int val; /* State of the key/button; pressed or released. */
|
int key; /* May be either a key code or button number. */
|
||||||
|
unsigned int touch; /* Touch ID */
|
||||||
|
} detail;
|
||||||
|
int val; /* State of the key/button/touch; pressed or released. */
|
||||||
|
ValuatorMask *touchMask;
|
||||||
} EventQueueRec, *EventQueuePtr;
|
} EventQueueRec, *EventQueuePtr;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char *device;
|
struct libevdev *dev;
|
||||||
|
|
||||||
|
char *device;
|
||||||
int grabDevice; /* grab the event device? */
|
int grabDevice; /* grab the event device? */
|
||||||
|
|
||||||
int num_vals; /* number of valuators */
|
int num_vals; /* number of valuators */
|
||||||
int axis_map[max(ABS_CNT, REL_CNT)]; /* Map evdev <axis> to index */
|
int num_mt_vals; /* number of multitouch valuators */
|
||||||
int vals[MAX_VALUATORS];
|
int abs_axis_map[ABS_CNT]; /* Map evdev ABS_* to index */
|
||||||
int old_vals[MAX_VALUATORS]; /* Translate absolute inputs to relative */
|
int rel_axis_map[REL_CNT]; /* Map evdev REL_* to index */
|
||||||
|
ValuatorMask *abs_vals; /* values for absolute axis */
|
||||||
|
ValuatorMask *rel_vals; /* values for relative axis */
|
||||||
|
ValuatorMask *old_vals; /* old absolute values for calculating relative motion */
|
||||||
|
ValuatorMask *prox; /* last absolute values set while not in proximity */
|
||||||
|
ValuatorMask *mt_mask;
|
||||||
|
ValuatorMask **last_mt_vals;
|
||||||
|
int cur_slot;
|
||||||
|
struct slot {
|
||||||
|
int dirty;
|
||||||
|
enum SlotState state;
|
||||||
|
} *slots;
|
||||||
|
struct mtdev *mtdev;
|
||||||
|
BOOL fake_mt;
|
||||||
|
|
||||||
int flags;
|
int flags;
|
||||||
int in_proximity; /* device in proximity */
|
int in_proximity; /* device in proximity */
|
||||||
@@ -131,16 +191,9 @@ typedef struct {
|
|||||||
BOOL swap_axes;
|
BOOL swap_axes;
|
||||||
BOOL invert_x;
|
BOOL invert_x;
|
||||||
BOOL invert_y;
|
BOOL invert_y;
|
||||||
|
int resolution;
|
||||||
|
|
||||||
int delta[REL_CNT];
|
|
||||||
unsigned int abs_queued, rel_queued, prox_queued;
|
unsigned int abs_queued, rel_queued, prox_queued;
|
||||||
unsigned int abs_prox; /* valuators posted while out of prox? */
|
|
||||||
|
|
||||||
/* XKB stuff has to be per-device rather than per-driver */
|
|
||||||
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 5
|
|
||||||
XkbComponentNamesRec xkbnames;
|
|
||||||
#endif
|
|
||||||
XkbRMLVOSet rmlvo;
|
|
||||||
|
|
||||||
/* Middle mouse button emulation */
|
/* Middle mouse button emulation */
|
||||||
struct {
|
struct {
|
||||||
@@ -150,7 +203,21 @@ typedef struct {
|
|||||||
int state; /* state machine (see bt3emu.c) */
|
int state; /* state machine (see bt3emu.c) */
|
||||||
Time expires; /* time of expiry */
|
Time expires; /* time of expiry */
|
||||||
Time timeout;
|
Time timeout;
|
||||||
|
uint8_t button; /* phys button to emit */
|
||||||
} emulateMB;
|
} emulateMB;
|
||||||
|
/* Third mouse button emulation */
|
||||||
|
struct emulate3B {
|
||||||
|
BOOL enabled;
|
||||||
|
BOOL state; /* current state */
|
||||||
|
Time timeout; /* timeout until third button press */
|
||||||
|
int buttonstate; /* phys. button state */
|
||||||
|
int button; /* phys button to emit */
|
||||||
|
int threshold; /* move threshold in dev coords */
|
||||||
|
OsTimerPtr timer;
|
||||||
|
double delta[2]; /* delta x/y, accumulating */
|
||||||
|
int startpos[2]; /* starting pos for abs devices */
|
||||||
|
int flags; /* remember if we had rel or abs movement */
|
||||||
|
} emulate3B;
|
||||||
struct {
|
struct {
|
||||||
int meta; /* meta key to lock any button */
|
int meta; /* meta key to lock any button */
|
||||||
BOOL meta_state; /* meta_button state */
|
BOOL meta_state; /* meta_button state */
|
||||||
@@ -167,6 +234,11 @@ typedef struct {
|
|||||||
Time expires; /* time of expiry */
|
Time expires; /* time of expiry */
|
||||||
Time timeout;
|
Time timeout;
|
||||||
} emulateWheel;
|
} emulateWheel;
|
||||||
|
struct {
|
||||||
|
int vert_delta;
|
||||||
|
int horiz_delta;
|
||||||
|
int dial_delta;
|
||||||
|
} smoothScroll;
|
||||||
/* run-time calibration */
|
/* run-time calibration */
|
||||||
struct {
|
struct {
|
||||||
int min_x;
|
int min_x;
|
||||||
@@ -181,44 +253,48 @@ typedef struct {
|
|||||||
int reopen_left; /* number of attempts left to re-open the device */
|
int reopen_left; /* number of attempts left to re-open the device */
|
||||||
OsTimerPtr reopen_timer;
|
OsTimerPtr reopen_timer;
|
||||||
|
|
||||||
/* Cached info from device. */
|
|
||||||
char name[1024];
|
|
||||||
unsigned long bitmask[NLONGS(EV_CNT)];
|
|
||||||
unsigned long key_bitmask[NLONGS(KEY_CNT)];
|
|
||||||
unsigned long rel_bitmask[NLONGS(REL_CNT)];
|
|
||||||
unsigned long abs_bitmask[NLONGS(ABS_CNT)];
|
|
||||||
unsigned long led_bitmask[NLONGS(LED_CNT)];
|
|
||||||
struct input_absinfo absinfo[ABS_CNT];
|
|
||||||
|
|
||||||
/* minor/major number */
|
/* minor/major number */
|
||||||
dev_t min_maj;
|
dev_t min_maj;
|
||||||
|
|
||||||
/* Event queue used to defer keyboard/button events until EV_SYN time. */
|
/* Event queue used to defer keyboard/button events until EV_SYN time. */
|
||||||
int num_queue;
|
int num_queue;
|
||||||
EventQueueRec queue[EVDEV_MAXQUEUE];
|
EventQueueRec queue[EVDEV_MAXQUEUE];
|
||||||
|
|
||||||
|
enum fkeymode fkeymode;
|
||||||
|
|
||||||
|
char *type_name;
|
||||||
} EvdevRec, *EvdevPtr;
|
} EvdevRec, *EvdevPtr;
|
||||||
|
|
||||||
/* Event posting functions */
|
/* Event posting functions */
|
||||||
void EvdevQueueKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value);
|
void EvdevQueueKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value);
|
||||||
void EvdevQueueButtonEvent(InputInfoPtr pInfo, int button, int value);
|
void EvdevQueueButtonEvent(InputInfoPtr pInfo, int button, int value);
|
||||||
void EvdevQueueProximityEvent(InputInfoPtr pInfo, int value);
|
void EvdevQueueProximityEvent(InputInfoPtr pInfo, int value);
|
||||||
void EvdevPostButtonEvent(InputInfoPtr pInfo, int button, int value);
|
void EvdevQueueTouchEvent(InputInfoPtr pInfo, unsigned int touch,
|
||||||
|
ValuatorMask *mask, uint16_t type);
|
||||||
|
void EvdevPostButtonEvent(InputInfoPtr pInfo, int button, enum ButtonAction act);
|
||||||
void EvdevQueueButtonClicks(InputInfoPtr pInfo, int button, int count);
|
void EvdevQueueButtonClicks(InputInfoPtr pInfo, int button, int count);
|
||||||
void EvdevPostRelativeMotionEvents(InputInfoPtr pInfo, int num_v, int first_v,
|
void EvdevPostRelativeMotionEvents(InputInfoPtr pInfo);
|
||||||
int v[MAX_VALUATORS]);
|
void EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo);
|
||||||
void EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo, int num_v, int first_v,
|
|
||||||
int v[MAX_VALUATORS]);
|
|
||||||
unsigned int EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code);
|
unsigned int EvdevUtilButtonEventToButtonNumber(EvdevPtr pEvdev, int code);
|
||||||
|
|
||||||
/* Middle Button emulation */
|
/* Middle Button emulation */
|
||||||
int EvdevMBEmuTimer(InputInfoPtr);
|
int EvdevMBEmuTimer(InputInfoPtr);
|
||||||
BOOL EvdevMBEmuFilterEvent(InputInfoPtr, int, BOOL);
|
BOOL EvdevMBEmuFilterEvent(InputInfoPtr, int, BOOL);
|
||||||
void EvdevMBEmuWakeupHandler(pointer, int, pointer);
|
void EvdevMBEmuWakeupHandler(WAKEUP_HANDLER_ARGS);
|
||||||
void EvdevMBEmuBlockHandler(pointer, struct timeval**, pointer);
|
void EvdevMBEmuBlockHandler(BLOCK_HANDLER_ARGS);
|
||||||
void EvdevMBEmuPreInit(InputInfoPtr);
|
void EvdevMBEmuPreInit(InputInfoPtr);
|
||||||
void EvdevMBEmuOn(InputInfoPtr);
|
void EvdevMBEmuOn(InputInfoPtr);
|
||||||
void EvdevMBEmuFinalize(InputInfoPtr);
|
void EvdevMBEmuFinalize(InputInfoPtr);
|
||||||
|
|
||||||
|
/* Third button emulation */
|
||||||
|
CARD32 Evdev3BEmuTimer(OsTimerPtr timer, CARD32 time, pointer arg);
|
||||||
|
BOOL Evdev3BEmuFilterEvent(InputInfoPtr, int, BOOL);
|
||||||
|
void Evdev3BEmuPreInit(InputInfoPtr pInfo);
|
||||||
|
void Evdev3BEmuOn(InputInfoPtr);
|
||||||
|
void Evdev3BEmuFinalize(InputInfoPtr);
|
||||||
|
void Evdev3BEmuProcessRelMotion(InputInfoPtr pInfo, double dx, double dy);
|
||||||
|
void Evdev3BEmuProcessAbsMotion(InputInfoPtr pInfo, ValuatorMask *vals);
|
||||||
|
|
||||||
/* Mouse Wheel emulation */
|
/* Mouse Wheel emulation */
|
||||||
void EvdevWheelEmuPreInit(InputInfoPtr pInfo);
|
void EvdevWheelEmuPreInit(InputInfoPtr pInfo);
|
||||||
BOOL EvdevWheelEmuFilterButton(InputInfoPtr pInfo, unsigned int button, int value);
|
BOOL EvdevWheelEmuFilterButton(InputInfoPtr pInfo, unsigned int button, int value);
|
||||||
@@ -228,9 +304,9 @@ BOOL EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv);
|
|||||||
void EvdevDragLockPreInit(InputInfoPtr pInfo);
|
void EvdevDragLockPreInit(InputInfoPtr pInfo);
|
||||||
BOOL EvdevDragLockFilterEvent(InputInfoPtr pInfo, unsigned int button, int value);
|
BOOL EvdevDragLockFilterEvent(InputInfoPtr pInfo, unsigned int button, int value);
|
||||||
|
|
||||||
#ifdef HAVE_PROPERTIES
|
|
||||||
void EvdevMBEmuInitProperty(DeviceIntPtr);
|
void EvdevMBEmuInitProperty(DeviceIntPtr);
|
||||||
|
void Evdev3BEmuInitProperty(DeviceIntPtr);
|
||||||
void EvdevWheelEmuInitProperty(DeviceIntPtr);
|
void EvdevWheelEmuInitProperty(DeviceIntPtr);
|
||||||
void EvdevDragLockInitProperty(DeviceIntPtr);
|
void EvdevDragLockInitProperty(DeviceIntPtr);
|
||||||
#endif
|
void EvdevAppleInitProperty(DeviceIntPtr);
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user