mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Compare commits
145 Commits
xf86-input
...
xf86-input
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3fa49dfcab | ||
|
|
941391ca34 | ||
|
|
2144f7d834 | ||
|
|
61b4e88e01 | ||
|
|
9ee70943ec | ||
|
|
415b6ffa95 | ||
|
|
f4ba2bd785 | ||
|
|
2e5f68754f | ||
|
|
8fdb2abb6f | ||
|
|
ca0fb396f1 | ||
|
|
7967677789 | ||
|
|
36064dca90 | ||
|
|
8bf93709cb | ||
|
|
37373a223b | ||
|
|
d764dded18 | ||
|
|
f352598e45 | ||
|
|
69d6ff3e01 | ||
|
|
6f4634111a | ||
|
|
1f641d75ed | ||
|
|
2994825665 | ||
|
|
9bfd9e8a36 | ||
|
|
dcca28a59c | ||
|
|
db8b1ca5cf | ||
|
|
8cc0d0f285 | ||
|
|
aa1609285d | ||
|
|
b07ab6ea97 | ||
|
|
7bc48c666d | ||
|
|
880ad1e19a | ||
|
|
6ab23e4519 | ||
|
|
88eedea281 | ||
|
|
9a5a4fed3a | ||
|
|
0a3657d2ee | ||
|
|
dc2191285e | ||
|
|
255b9f6bbf | ||
|
|
aa117d49a5 | ||
|
|
b358f1eb3a | ||
|
|
33cc112ca1 | ||
|
|
3c43d880f1 | ||
|
|
5462898935 | ||
|
|
9243d338d1 | ||
|
|
71e9a69ed6 | ||
|
|
220e2dfb8f | ||
|
|
ddc1266374 | ||
|
|
98ecb5233b | ||
|
|
92ca3dc2e7 | ||
|
|
3fa28c8acd | ||
|
|
d9809d7edd | ||
|
|
b11439a176 | ||
|
|
740dc202f7 | ||
|
|
7ac0c4456d | ||
|
|
b4f6ab126d | ||
|
|
a3ea979c2b | ||
|
|
a7fb654a68 | ||
|
|
3f06825a44 | ||
|
|
31853c39bf | ||
|
|
2c49e21a81 | ||
|
|
4361b3efa0 | ||
|
|
281a7b4b88 | ||
|
|
051cb8b528 | ||
|
|
1abcc88171 | ||
|
|
c89bbf80be | ||
|
|
178435832f | ||
|
|
c9cab83bac | ||
|
|
43dd2a9592 | ||
|
|
7977947e0d | ||
|
|
11a56d4a17 | ||
|
|
7b0f613c7f | ||
|
|
75af278861 | ||
|
|
4fd9cd2ea8 | ||
|
|
12c287df89 | ||
|
|
9f1b9aa6eb | ||
|
|
acb1d557e2 | ||
|
|
6a1f8f463d | ||
|
|
9620fe7765 | ||
|
|
a1714cac52 | ||
|
|
5a99ef7ed2 | ||
|
|
3b22e4703f | ||
|
|
0de20a8f1b | ||
|
|
978384ede7 | ||
|
|
df7ff12ed2 | ||
|
|
dd2c89ac93 | ||
|
|
4616c79f6c | ||
|
|
a31170718d | ||
|
|
95099cb036 | ||
|
|
c58bae0b77 | ||
|
|
32242871f7 | ||
|
|
aa5dfa1d6a | ||
|
|
2a6c1d7a60 | ||
|
|
0f0743e3cf | ||
|
|
095766ebb3 | ||
|
|
0dbb88c52b | ||
|
|
c928156702 | ||
|
|
07f40a04df | ||
|
|
e260993b6a | ||
|
|
dc72e6d8ae | ||
|
|
1906e4d5c1 | ||
|
|
3047c25db2 | ||
|
|
c158cf2b64 | ||
|
|
dae1a78a52 | ||
|
|
263bf04a9d | ||
|
|
c035f3d0f5 | ||
|
|
a7e8af65fc | ||
|
|
0592d97fbb | ||
|
|
4dfd86b220 | ||
|
|
d3fd42d864 | ||
|
|
dd1752ce3f | ||
|
|
0f0a149067 | ||
|
|
d170cba0cd | ||
|
|
2680382705 | ||
|
|
0f36384d06 | ||
|
|
ece72ce9e9 | ||
|
|
2bf6e29b40 | ||
|
|
2bd24649ec | ||
|
|
6867652c2c | ||
|
|
63af314368 | ||
|
|
4c5c9c111d | ||
|
|
4826969f23 | ||
|
|
33eb36f266 | ||
|
|
d5cf24d3f0 | ||
|
|
64554e4799 | ||
|
|
b77f939857 | ||
|
|
a43ab4999b | ||
|
|
af096e8c5d | ||
|
|
12498042fc | ||
|
|
0f8fcfccb3 | ||
|
|
0ab4c09e50 | ||
|
|
d348eb8ce7 | ||
|
|
2c1698fa61 | ||
|
|
8c39302594 | ||
|
|
f57e8face9 | ||
|
|
4912e2aa7f | ||
|
|
7243116f55 | ||
|
|
0089d931ac | ||
|
|
0f5a5ac09e | ||
|
|
36d68b006d | ||
|
|
bb1f421687 | ||
|
|
0405f7b17f | ||
|
|
088e0a175a | ||
|
|
cefedeb205 | ||
|
|
b0737bdbd1 | ||
|
|
5f2c8a2dcd | ||
|
|
ff783fce65 | ||
|
|
c638aa4a88 | ||
|
|
b46677e346 | ||
|
|
680b41dc76 |
19
.cvsignore
19
.cvsignore
@@ -1,19 +0,0 @@
|
|||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
*.la
|
|
||||||
*.lo
|
|
||||||
aclocal.m4
|
|
||||||
autom4te.cache
|
|
||||||
config.guess
|
|
||||||
config.h
|
|
||||||
config.h.in
|
|
||||||
config.log
|
|
||||||
config.status
|
|
||||||
config.sub
|
|
||||||
configure
|
|
||||||
depcomp
|
|
||||||
install-sh
|
|
||||||
libtool
|
|
||||||
ltmain.sh
|
|
||||||
missing
|
|
||||||
stamp-h1
|
|
||||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -22,6 +22,7 @@ missing
|
|||||||
*.lo
|
*.lo
|
||||||
*.la
|
*.la
|
||||||
stamp-h1
|
stamp-h1
|
||||||
*.bz2
|
xf86-input-evdev-*.tar.*
|
||||||
*.gz
|
|
||||||
*.pc
|
*.pc
|
||||||
|
*~
|
||||||
|
tags
|
||||||
|
|||||||
@@ -19,19 +19,22 @@
|
|||||||
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
AUTOMAKE_OPTIONS = foreign
|
AUTOMAKE_OPTIONS = foreign
|
||||||
|
|
||||||
|
# Ensure headers are installed below $(prefix) for distcheck
|
||||||
|
DISTCHECK_CONFIGURE_FLAGS = --with-sdkdir='$${includedir}/xorg'
|
||||||
|
|
||||||
SUBDIRS = src man include
|
SUBDIRS = src man include
|
||||||
|
|
||||||
pkgconfigdir = $(libdir)/pkgconfig
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
pkgconfig_DATA = xorg-evdev.pc
|
pkgconfig_DATA = xorg-evdev.pc
|
||||||
|
|
||||||
EXTRA_DIST = ChangeLog autogen.sh
|
EXTRA_DIST = ChangeLog
|
||||||
|
|
||||||
MAINTAINERCLEANFILES=ChangeLog
|
MAINTAINERCLEANFILES=ChangeLog
|
||||||
|
|
||||||
.PHONY: ChangeLog
|
.PHONY: ChangeLog
|
||||||
|
|
||||||
ChangeLog:
|
ChangeLog:
|
||||||
(GIT_DIR=$(top_srcdir)/.git git-log > .changelog.tmp && mv .changelog.tmp ChangeLog; rm -f .changelog.tmp) || \
|
$(CHANGELOG_CMD)
|
||||||
(touch ChangeLog; echo 'git directory not found: installing possibly empty changelog.' >&2)
|
|
||||||
|
|
||||||
dist-hook: ChangeLog
|
dist-hook: ChangeLog
|
||||||
|
|||||||
20
README
Normal file
20
README
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
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
|
||||||
29
configure.ac
29
configure.ac
@@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
AC_PREREQ(2.57)
|
AC_PREREQ(2.57)
|
||||||
AC_INIT([xf86-input-evdev],
|
AC_INIT([xf86-input-evdev],
|
||||||
2.0.99,
|
2.2.99.2,
|
||||||
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
|
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
|
||||||
xf86-input-evdev)
|
xf86-input-evdev)
|
||||||
|
|
||||||
@@ -32,15 +32,16 @@ AM_INIT_AUTOMAKE([dist-bzip2])
|
|||||||
|
|
||||||
AM_MAINTAINER_MODE
|
AM_MAINTAINER_MODE
|
||||||
|
|
||||||
DRIVER_NAME=evdev
|
# Require xorg-macros: XORG_DEFAULT_OPTIONS
|
||||||
AC_SUBST([DRIVER_NAME])
|
m4_ifndef([XORG_MACROS_VERSION], [AC_FATAL([must install xorg-macros 1.3 or later before running autoconf/autogen])])
|
||||||
|
XORG_MACROS_VERSION(1.3)
|
||||||
AM_CONFIG_HEADER([config.h])
|
AM_CONFIG_HEADER([config.h])
|
||||||
|
|
||||||
# Checks for programs.
|
# Checks for programs.
|
||||||
AC_DISABLE_STATIC
|
AC_DISABLE_STATIC
|
||||||
AC_PROG_LIBTOOL
|
AC_PROG_LIBTOOL
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
|
XORG_DEFAULT_OPTIONS
|
||||||
|
|
||||||
AH_TOP([#include "xorg-server.h"])
|
AH_TOP([#include "xorg-server.h"])
|
||||||
|
|
||||||
@@ -52,24 +53,22 @@ AC_ARG_WITH(xorg-module-dir,
|
|||||||
inputdir=${moduledir}/input
|
inputdir=${moduledir}/input
|
||||||
AC_SUBST(inputdir)
|
AC_SUBST(inputdir)
|
||||||
|
|
||||||
# Checks for extensions
|
# Checks for pkg-config packages. We need to be able to override sdkdir
|
||||||
XORG_DRIVER_CHECK_EXT(XINPUT, inputproto)
|
# to satisfy silly distcheck requirements.
|
||||||
|
|
||||||
# Checks for pkg-config packages
|
|
||||||
PKG_CHECK_MODULES(XORG, xorg-server xproto $REQUIRED_MODULES)
|
PKG_CHECK_MODULES(XORG, xorg-server xproto $REQUIRED_MODULES)
|
||||||
sdkdir=$(pkg-config --variable=sdkdir xorg-server)
|
XORG_CFLAGS="$CWARNFLAGS $XORG_CFLAGS"
|
||||||
AC_SUBST(sdkdir)
|
AC_ARG_WITH([sdkdir], [],
|
||||||
|
[sdkdir="$withval"],
|
||||||
CFLAGS="$CFLAGS $XORG_CFLAGS "' -I$(top_srcdir)/src'
|
[sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`])
|
||||||
AC_SUBST([CFLAGS])
|
AC_SUBST([sdkdir])
|
||||||
|
|
||||||
# Checks for libraries.
|
# Checks for libraries.
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
|
|
||||||
XORG_MANPAGE_SECTIONS
|
DRIVER_NAME=evdev
|
||||||
XORG_RELEASE_VERSION
|
AC_SUBST([DRIVER_NAME])
|
||||||
|
|
||||||
AC_OUTPUT([Makefile
|
AC_OUTPUT([Makefile
|
||||||
src/Makefile
|
src/Makefile
|
||||||
|
|||||||
@@ -31,7 +31,7 @@
|
|||||||
/* Middle mouse button emulation */
|
/* Middle mouse button emulation */
|
||||||
/* BOOL */
|
/* BOOL */
|
||||||
#define EVDEV_PROP_MIDBUTTON "Evdev Middle Button Emulation"
|
#define EVDEV_PROP_MIDBUTTON "Evdev Middle Button Emulation"
|
||||||
/* CARD16 */
|
/* CARD32 */
|
||||||
#define EVDEV_PROP_MIDBUTTON_TIMEOUT "Evdev Middle Button Timeout"
|
#define EVDEV_PROP_MIDBUTTON_TIMEOUT "Evdev Middle Button Timeout"
|
||||||
|
|
||||||
/* Wheel emulation */
|
/* Wheel emulation */
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
#define EVDEV_PROP_WHEEL_INERTIA "Evdev Wheel Emulation Inertia"
|
#define EVDEV_PROP_WHEEL_INERTIA "Evdev Wheel Emulation Inertia"
|
||||||
/* CARD16 */
|
/* CARD16 */
|
||||||
#define EVDEV_PROP_WHEEL_TIMEOUT "Evdev Wheel Emulation Timeout"
|
#define EVDEV_PROP_WHEEL_TIMEOUT "Evdev Wheel Emulation Timeout"
|
||||||
/* CARD8, value range 0-32, 0 to disable a value */
|
/* CARD8, value range 0-32, 0 to always scroll */
|
||||||
#define EVDEV_PROP_WHEEL_BUTTON "Evdev Wheel Emulation Button"
|
#define EVDEV_PROP_WHEEL_BUTTON "Evdev Wheel Emulation Button"
|
||||||
|
|
||||||
/* Drag lock */
|
/* Drag lock */
|
||||||
@@ -54,4 +54,16 @@
|
|||||||
/* BOOL, 2 values [x, y], 1 inverts axis */
|
/* BOOL, 2 values [x, y], 1 inverts axis */
|
||||||
#define EVDEV_PROP_INVERT_AXES "Evdev Axis Inversion"
|
#define EVDEV_PROP_INVERT_AXES "Evdev Axis Inversion"
|
||||||
|
|
||||||
|
/* Reopen attempts. */
|
||||||
|
/* CARD8 */
|
||||||
|
#define EVDEV_PROP_REOPEN "Evdev Reopen Attempts"
|
||||||
|
|
||||||
|
/* Run-time calibration */
|
||||||
|
/* CARD32, 4 values [minx, maxx, miny, maxy], or no values for unset */
|
||||||
|
#define EVDEV_PROP_CALIBRATION "Evdev Axis Calibration"
|
||||||
|
|
||||||
|
/* Swap x and y axis. */
|
||||||
|
/* BOOL */
|
||||||
|
#define EVDEV_PROP_SWAP_AXES "Evdev Axes Swap"
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
132
man/evdev.man
132
man/evdev.man
@@ -11,6 +11,7 @@ evdev \- Generic Linux input driver
|
|||||||
.BI " Option \*qDevice\*q \*q" devpath \*q
|
.BI " Option \*qDevice\*q \*q" devpath \*q
|
||||||
.BI " Option \*qEmulate3Buttons\*q \*q" True \*q
|
.BI " Option \*qEmulate3Buttons\*q \*q" True \*q
|
||||||
.BI " Option \*qEmulate3Timeout\*q \*q" 50 \*q
|
.BI " Option \*qEmulate3Timeout\*q \*q" 50 \*q
|
||||||
|
.BI " Option \*qGrabDevice\*q \*q" False \*q
|
||||||
\ \ ...
|
\ \ ...
|
||||||
.B EndSection
|
.B EndSection
|
||||||
.fi
|
.fi
|
||||||
@@ -43,22 +44,6 @@ The following driver
|
|||||||
.B Options
|
.B Options
|
||||||
are supported:
|
are supported:
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qDevice\*q \*q" string \*q
|
|
||||||
Specifies the device through which the device can be accessed. This will
|
|
||||||
generally be of the form \*q/dev/input/eventX\*q, where X is some integer.
|
|
||||||
The mapping from device node to hardware is system-dependent.
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qEmulate3Buttons\*q \*q" boolean \*q
|
|
||||||
Enable/disable the emulation of the third (middle) mouse button for mice
|
|
||||||
which only have two physical buttons. The third button is emulated by
|
|
||||||
pressing both buttons simultaneously. Default: on, until a middle mouse
|
|
||||||
button event is registered.
|
|
||||||
.TP 7
|
|
||||||
.BI "Option \*qEmulate3Timeout\*q \*q" integer \*q
|
|
||||||
Sets the timeout (in milliseconds) that the driver waits before deciding
|
|
||||||
if two buttons where pressed "simultaneously" when 3 button emulation is
|
|
||||||
enabled. Default: 50.
|
|
||||||
.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. The mapping is a space-separated list
|
||||||
of button mappings that correspond in order to the physical buttons on the
|
of button mappings that correspond in order to the physical buttons on the
|
||||||
@@ -69,18 +54,35 @@ 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". Invalid mappings are ignored and the default mapping
|
||||||
is used. Buttons not specified in the user's mapping use 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
|
||||||
|
Specifies the device through which the device can be accessed. This will
|
||||||
|
generally be of the form \*q/dev/input/eventX\*q, where X is some integer.
|
||||||
|
The mapping from device node to hardware is system-dependent.
|
||||||
|
.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. Button numbers occur in pairs,
|
||||||
with the lock button number occurring first, followed by the button
|
with the lock button number occurring first, followed by the button
|
||||||
number that is the target of the lock button.
|
number that is the target of the lock button. Property: "Evdev
|
||||||
|
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".
|
||||||
.TP 7
|
.TP 7
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulate3Buttons\*q \*q" boolean \*q
|
||||||
|
Enable/disable the emulation of the third (middle) mouse button for mice
|
||||||
|
which only have two physical buttons. The third button is emulated by
|
||||||
|
pressing both buttons simultaneously. Default: on, until a middle mouse
|
||||||
|
button event is registered. Property: "Evdev Middle Button Emulation".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulate3Timeout\*q \*q" integer \*q
|
||||||
|
Sets the timeout (in milliseconds) that the driver waits before deciding
|
||||||
|
if two buttons where pressed "simultaneously" when 3 button emulation is
|
||||||
|
enabled. Default: 50. Property: "Evdev Middle Button Timeout".
|
||||||
.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. Wheel emulation means emulating button
|
||||||
press/release events when the mouse is moved while a specific real button
|
press/release events when the mouse is moved while a specific real button
|
||||||
@@ -94,7 +96,7 @@ more buttons but no wheel. See the description of the
|
|||||||
.BR XAxisMapping ,
|
.BR XAxisMapping ,
|
||||||
and
|
and
|
||||||
.B YAxisMapping
|
.B YAxisMapping
|
||||||
options below. Default: off.
|
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.
|
||||||
@@ -103,11 +105,15 @@ press/release events as specified for the
|
|||||||
.B XAxisMapping
|
.B XAxisMapping
|
||||||
and
|
and
|
||||||
.B YAxisMapping
|
.B YAxisMapping
|
||||||
settings. Default: 4.
|
settings. If the button is 0 and
|
||||||
|
.BR EmulateWheel
|
||||||
|
is on, any motion of the device is converted into wheel events. Default: 4.
|
||||||
|
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.
|
press/release events in wheel emulation mode. Default: 10. Property: "Evdev
|
||||||
|
Wheel Emulation Inertia".
|
||||||
.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
|
||||||
@@ -115,7 +121,37 @@ Specifies the time in milliseconds the
|
|||||||
must be pressed before wheel emulation is started. If the
|
must be pressed before wheel emulation is started. If the
|
||||||
.BR EmulateWheelButton
|
.BR EmulateWheelButton
|
||||||
is released before this timeout, the original button press/release event
|
is released before this timeout, the original button press/release event
|
||||||
is sent. Default: 200.
|
is sent. Default: 200. Property: "Evdev Wheel Emulation Timeout".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qGrabDevice\*q \*q" boolean \*q
|
||||||
|
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
|
||||||
|
events to /dev/kbd or /dev/input/mice. Events from this device will not be
|
||||||
|
sent to virtual devices (e.g. rfkill or the Macintosh mouse button emulation).
|
||||||
|
Default: disabled.
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qInvertX\*q \*q" Bool \*q
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qInvertY\*q \*q" Bool \*q
|
||||||
|
Invert the given axis. Default: off. Property: "Evdev Axis Inversion".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qIgnoreRelativeAxes\*q \*q" Bool \*q
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qIgnoreAbsoluteAxes\*q \*q" Bool \*q
|
||||||
|
Ignore the specified type of axis. Default: off. The X server cannot deal
|
||||||
|
with devices that have both relative and absolute axes. Evdev tries to guess
|
||||||
|
wich axes to ignore given the device type and disables absolute axes for
|
||||||
|
mice and relative axes for tablets, touchscreens and touchpad. 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.
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qReopenAttempts\*q \*q" integer \*q
|
||||||
|
Number of reopen attempts after a read error occurs on the device (e.g. after
|
||||||
|
waking up from suspend). In between each attempt is a 100ms wait. Default: 10.
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qSwapAxes\*q \*q" Bool \*q
|
||||||
|
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
|
||||||
@@ -123,7 +159,8 @@ 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.
|
is mapped to the positive X axis motion. 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
|
||||||
@@ -131,14 +168,53 @@ 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"
|
is mapped to the positive Y axis motion. Default: "4 5". Property:
|
||||||
|
"Evdev Wheel Emulation Axes".
|
||||||
|
|
||||||
|
.SH SUPPORTED PROPERTIES
|
||||||
|
The following properties are provided by the
|
||||||
|
.B evdev
|
||||||
|
driver.
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qReopenAttempts\*q \*q" integer \*q
|
.BI "Evdev Axis Calibration"
|
||||||
Number of reopen attempts after a read error occurs on the device (e.g. after
|
4 32-bit values, order min-x, max-x, min-y, max-y or 0 values to disable
|
||||||
waking up from suspend). In between each attempt is a 100ms wait. Default: 10.
|
run-time axis calibration. This feature is required for devices that need to
|
||||||
|
scale to a different coordinate system than originally reported to the X
|
||||||
|
server, such as touchscreens that require run-time calibration.
|
||||||
|
.TP 7
|
||||||
|
.BI "Evdev Axis Inversion"
|
||||||
|
2 boolean values (8 bit, 0 or 1), order X, Y. 1 inverts the axis.
|
||||||
|
.TP 7
|
||||||
|
.BI "Evdev Axes Swap"
|
||||||
|
1 boolean value (8 bit, 0 or 1). 1 swaps x/y axes.
|
||||||
|
.TP 7
|
||||||
|
.BI "Evdev Drag Lock Buttons"
|
||||||
|
8-bit. Either 1 value or pairs of values. Value range 0-32, 0 disables a
|
||||||
|
value.
|
||||||
|
.TP 7
|
||||||
|
.BI "Evdev Middle Button Emulation"
|
||||||
|
1 boolean value (8 bit, 0 or 1).
|
||||||
|
.TP 7
|
||||||
|
.BI "Evdev Middle Button Timeout"
|
||||||
|
1 16-bit positive value.
|
||||||
|
.TP 7
|
||||||
|
.BI "Evdev Wheel Emulation"
|
||||||
|
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.
|
||||||
|
.TP 7
|
||||||
|
.BI "Evdev Wheel Emulation Inertia"
|
||||||
|
1 16-bit positive value.
|
||||||
|
.TP 7
|
||||||
|
.BI "Evdev Wheel Emulation Timeout"
|
||||||
|
1 16-bit positive value.
|
||||||
|
|
||||||
.SH AUTHORS
|
.SH AUTHORS
|
||||||
Kristian Høgsberg.
|
Kristian Høgsberg.
|
||||||
.SH "SEE ALSO"
|
.SH "SEE ALSO"
|
||||||
__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__),
|
__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__),
|
||||||
README.mouse.
|
README.mouse.
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
.deps
|
|
||||||
.libs
|
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
*.la
|
|
||||||
*.lo
|
|
||||||
@@ -24,6 +24,8 @@
|
|||||||
# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
|
# -avoid-version prevents gratuitous .0.0.0 version numbers on the end
|
||||||
# _ladir passes a dummy rpath to libtool so the thing will actually link
|
# _ladir passes a dummy rpath to libtool so the thing will actually link
|
||||||
# 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)
|
||||||
|
|
||||||
@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_ladir = @inputdir@
|
@DRIVER_NAME@_drv_ladir = @inputdir@
|
||||||
|
|||||||
143
src/draglock.c
143
src/draglock.c
@@ -53,7 +53,7 @@ void EvdevDragLockLockButton(InputInfoPtr pInfo, unsigned int button);
|
|||||||
|
|
||||||
/* Setup and configuration code */
|
/* Setup and configuration code */
|
||||||
void
|
void
|
||||||
EvdevDragLockInit(InputInfoPtr pInfo)
|
EvdevDragLockPreInit(InputInfoPtr pInfo)
|
||||||
{
|
{
|
||||||
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
char *option_string = NULL;
|
char *option_string = NULL;
|
||||||
@@ -147,18 +147,18 @@ EvdevDragLockInit(InputInfoPtr pInfo)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Updates DragLock button state and firest button event messges */
|
/* Updates DragLock button state and fires button event messges */
|
||||||
void
|
void
|
||||||
EvdevDragLockLockButton(InputInfoPtr pInfo, unsigned int button)
|
EvdevDragLockLockButton(InputInfoPtr pInfo, unsigned int button)
|
||||||
{
|
{
|
||||||
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
BOOL state=0;
|
BOOL state = 0;
|
||||||
|
|
||||||
/* update button state */
|
/* update button state */
|
||||||
state = pEvdev->dragLock.lock_state[button - 1] ? FALSE : TRUE;
|
state = pEvdev->dragLock.lock_state[button - 1] ? FALSE : TRUE;
|
||||||
pEvdev->dragLock.lock_state[button - 1] = state;
|
pEvdev->dragLock.lock_state[button - 1] = state;
|
||||||
|
|
||||||
xf86PostButtonEvent(pInfo->dev, 0, button, state, 0, 0);
|
EvdevQueueButtonEvent(pInfo, button, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Filter button presses looking for either a meta button or the
|
/* Filter button presses looking for either a meta button or the
|
||||||
@@ -210,6 +210,74 @@ EvdevDragLockFilterEvent(InputInfoPtr pInfo, unsigned int button, int value)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_PROPERTIES
|
#ifdef HAVE_PROPERTIES
|
||||||
|
/**
|
||||||
|
* Set the drag lock property.
|
||||||
|
* If only one value is supplied, then this is used as the meta button.
|
||||||
|
* If more than one value is supplied, then each value is the drag lock button
|
||||||
|
* for the pair. 0 disables a pair.
|
||||||
|
* i.e. to set bt 3 to draglock button 1, supply 0,0,1
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
EvdevDragLockSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||||
|
BOOL checkonly)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
|
||||||
|
if (atom == prop_dlock)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
if (val->format != 8 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
/* Don't allow changes while a lock is active */
|
||||||
|
if (pEvdev->dragLock.meta)
|
||||||
|
{
|
||||||
|
if (pEvdev->dragLock.meta_state)
|
||||||
|
return BadAccess;
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
for (i = 0; i < EVDEV_MAXBUTTONS; i++)
|
||||||
|
if (pEvdev->dragLock.lock_state[i])
|
||||||
|
return BadValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (val->size == 0)
|
||||||
|
return BadMatch;
|
||||||
|
else if (val->size == 1)
|
||||||
|
{
|
||||||
|
int meta = *((CARD8*)val->data);
|
||||||
|
if (meta > EVDEV_MAXBUTTONS)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
{
|
||||||
|
pEvdev->dragLock.meta = meta;
|
||||||
|
memset(pEvdev->dragLock.lock_pair, 0, sizeof(pEvdev->dragLock.lock_pair));
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
CARD8* vals = (CARD8*)val->data;
|
||||||
|
|
||||||
|
for (i = 0; i < val->size && i < EVDEV_MAXBUTTONS; i++)
|
||||||
|
if (vals[i] > EVDEV_MAXBUTTONS)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
{
|
||||||
|
pEvdev->dragLock.meta = 0;
|
||||||
|
memset(pEvdev->dragLock.lock_pair, 0, sizeof(pEvdev->dragLock.lock_pair));
|
||||||
|
|
||||||
|
for (i = 0; i < val->size && i < EVDEV_MAXBUTTONS; i++)
|
||||||
|
pEvdev->dragLock.lock_pair[i] = vals[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise property for drag lock buttons setting.
|
* Initialise property for drag lock buttons setting.
|
||||||
*/
|
*/
|
||||||
@@ -246,72 +314,7 @@ EvdevDragLockInitProperty(DeviceIntPtr dev)
|
|||||||
|
|
||||||
XISetDevicePropertyDeletable(dev, prop_dlock, FALSE);
|
XISetDevicePropertyDeletable(dev, prop_dlock, FALSE);
|
||||||
|
|
||||||
return;
|
XIRegisterPropertyHandler(dev, EvdevDragLockSetProperty, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the drag lock property.
|
|
||||||
* If only one value is supplied, then this is used as the meta button.
|
|
||||||
* If more than one value is supplied, then each value is the drag lock button
|
|
||||||
* for the pair. 0 disables a pair.
|
|
||||||
* i.e. to set bt 3 to draglock button 1, supply 0,0,1
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
EvdevDragLockSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
|
||||||
BOOL checkonly)
|
|
||||||
{
|
|
||||||
InputInfoPtr pInfo = dev->public.devicePrivate;
|
|
||||||
EvdevPtr pEvdev = pInfo->private;
|
|
||||||
|
|
||||||
if (atom == prop_dlock)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
if (val->format != 8 || val->type != XA_INTEGER)
|
|
||||||
return BadMatch;
|
|
||||||
|
|
||||||
/* Don't allow changes while a lock is active */
|
|
||||||
if (pEvdev->dragLock.meta)
|
|
||||||
{
|
|
||||||
if (pEvdev->dragLock.meta_state)
|
|
||||||
return BadAccess;
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
for (i = 0; i < EVDEV_MAXBUTTONS; i++)
|
|
||||||
if (pEvdev->dragLock.lock_state[i])
|
|
||||||
return BadValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (val->size == 1)
|
|
||||||
{
|
|
||||||
int meta = *((CARD8*)val->data);
|
|
||||||
if (meta > EVDEV_MAXBUTTONS)
|
|
||||||
return BadValue;
|
|
||||||
|
|
||||||
if (!checkonly)
|
|
||||||
{
|
|
||||||
pEvdev->dragLock.meta = meta;
|
|
||||||
memset(pEvdev->dragLock.lock_pair, 0, sizeof(pEvdev->dragLock.lock_pair));
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
{
|
|
||||||
CARD8* vals = (CARD8*)val->data;
|
|
||||||
|
|
||||||
for (i = 0; i < val->size && i < EVDEV_MAXBUTTONS; i++)
|
|
||||||
if (vals[i] > EVDEV_MAXBUTTONS)
|
|
||||||
return BadValue;
|
|
||||||
|
|
||||||
if (!checkonly)
|
|
||||||
{
|
|
||||||
pEvdev->dragLock.meta = 0;
|
|
||||||
memset(pEvdev->dragLock.lock_pair, 0, sizeof(pEvdev->dragLock.lock_pair));
|
|
||||||
|
|
||||||
for (i = 0; i < val->size && i < EVDEV_MAXBUTTONS; i++)
|
|
||||||
pEvdev->dragLock.lock_pair[i] = vals[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
89
src/emuMB.c
89
src/emuMB.c
@@ -198,7 +198,7 @@ EvdevMBEmuTimer(InputInfoPtr pInfo)
|
|||||||
|
|
||||||
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) {
|
||||||
xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0);
|
EvdevPostButtonEvent(pInfo, abs(id), (id >= 0));
|
||||||
pEvdev->emulateMB.state =
|
pEvdev->emulateMB.state =
|
||||||
stateTab[pEvdev->emulateMB.state][4][2];
|
stateTab[pEvdev->emulateMB.state][4][2];
|
||||||
} else {
|
} else {
|
||||||
@@ -231,6 +231,11 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
|
|||||||
if (!pEvdev->emulateMB.enabled)
|
if (!pEvdev->emulateMB.enabled)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
if (button == 2) {
|
||||||
|
EvdevMBEmuEnable(pInfo, FALSE);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* don't care about other buttons */
|
/* don't care about other buttons */
|
||||||
if (button != 1 && button != 3)
|
if (button != 1 && button != 3)
|
||||||
return ret;
|
return ret;
|
||||||
@@ -243,12 +248,12 @@ 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)
|
||||||
{
|
{
|
||||||
xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0);
|
EvdevQueueButtonEvent(pInfo, abs(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)
|
||||||
{
|
{
|
||||||
xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0);
|
EvdevQueueButtonEvent(pInfo, abs(id), (id >= 0));
|
||||||
ret = TRUE;
|
ret = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,29 +316,31 @@ EvdevMBEmuPreInit(InputInfoPtr pInfo)
|
|||||||
pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options,
|
pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options,
|
||||||
"Emulate3Buttons",
|
"Emulate3Buttons",
|
||||||
MBEMU_ENABLED);
|
MBEMU_ENABLED);
|
||||||
xf86Msg(X_INFO, "%s: Forcing middle mouse button emulation.\n",
|
xf86Msg(X_INFO, "%s: Forcing middle mouse button emulation %s.\n",
|
||||||
pInfo->name);
|
pInfo->name, (pEvdev->emulateMB.enabled) ? "on" : "off");
|
||||||
}
|
}
|
||||||
|
|
||||||
pEvdev->emulateMB.timeout = xf86SetIntOption(pInfo->options,
|
pEvdev->emulateMB.timeout = xf86SetIntOption(pInfo->options,
|
||||||
"Emulate3Timeout", 50);
|
"Emulate3Timeout", 50);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
EvdevMBEmuOn(InputInfoPtr pInfo)
|
||||||
|
{
|
||||||
|
if (!pInfo->dev->button) /* don't init for keyboards */
|
||||||
|
return;
|
||||||
|
|
||||||
RegisterBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
|
RegisterBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
|
||||||
EvdevMBEmuWakeupHandler,
|
EvdevMBEmuWakeupHandler,
|
||||||
(pointer)pInfo);
|
(pointer)pInfo);
|
||||||
|
|
||||||
#ifdef HAVE_PROPERTIES
|
|
||||||
XIChangeDeviceProperty(pInfo->dev, prop_mbemu, XA_INTEGER, 8,
|
|
||||||
PropModeReplace, 1, &pEvdev->emulateMB.enabled,
|
|
||||||
TRUE);
|
|
||||||
XIChangeDeviceProperty(pInfo->dev, prop_mbtimeout, XA_INTEGER, 16,
|
|
||||||
PropModeReplace, 1, &pEvdev->emulateMB.timeout,
|
|
||||||
TRUE);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EvdevMBEmuFinalize(InputInfoPtr pInfo)
|
EvdevMBEmuFinalize(InputInfoPtr pInfo)
|
||||||
{
|
{
|
||||||
|
if (!pInfo->dev->button) /* don't cleanup for keyboards */
|
||||||
|
return;
|
||||||
|
|
||||||
RemoveBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
|
RemoveBlockAndWakeupHandlers (EvdevMBEmuBlockHandler,
|
||||||
EvdevMBEmuWakeupHandler,
|
EvdevMBEmuWakeupHandler,
|
||||||
(pointer)pInfo);
|
(pointer)pInfo);
|
||||||
@@ -351,6 +358,32 @@ EvdevMBEmuEnable(InputInfoPtr pInfo, BOOL enable)
|
|||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_PROPERTIES
|
#ifdef HAVE_PROPERTIES
|
||||||
|
static int
|
||||||
|
EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||||
|
BOOL checkonly)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
|
||||||
|
if (atom == prop_mbemu)
|
||||||
|
{
|
||||||
|
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
pEvdev->emulateMB.enabled = *((BOOL*)val->data);
|
||||||
|
} else if (atom == prop_mbtimeout)
|
||||||
|
{
|
||||||
|
if (val->format != 32 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
pEvdev->emulateMB.timeout = *((CARD32*)val->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialise property for MB emulation on/off.
|
* Initialise property for MB emulation on/off.
|
||||||
*/
|
*/
|
||||||
@@ -376,37 +409,13 @@ EvdevMBEmuInitProperty(DeviceIntPtr dev)
|
|||||||
prop_mbtimeout = MakeAtom(EVDEV_PROP_MIDBUTTON_TIMEOUT,
|
prop_mbtimeout = MakeAtom(EVDEV_PROP_MIDBUTTON_TIMEOUT,
|
||||||
strlen(EVDEV_PROP_MIDBUTTON_TIMEOUT),
|
strlen(EVDEV_PROP_MIDBUTTON_TIMEOUT),
|
||||||
TRUE);
|
TRUE);
|
||||||
rc = XIChangeDeviceProperty(dev, prop_mbtimeout, XA_INTEGER, 16, PropModeReplace, 1,
|
rc = XIChangeDeviceProperty(dev, prop_mbtimeout, XA_INTEGER, 32, PropModeReplace, 1,
|
||||||
&pEvdev->emulateMB.timeout, FALSE);
|
&pEvdev->emulateMB.timeout, FALSE);
|
||||||
|
|
||||||
if (rc != Success)
|
if (rc != Success)
|
||||||
return;
|
return;
|
||||||
XISetDevicePropertyDeletable(dev, prop_mbtimeout, FALSE);
|
XISetDevicePropertyDeletable(dev, prop_mbtimeout, FALSE);
|
||||||
}
|
|
||||||
|
|
||||||
int
|
XIRegisterPropertyHandler(dev, EvdevMBEmuSetProperty, NULL, NULL);
|
||||||
EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
|
||||||
BOOL checkonly)
|
|
||||||
{
|
|
||||||
InputInfoPtr pInfo = dev->public.devicePrivate;
|
|
||||||
EvdevPtr pEvdev = pInfo->private;
|
|
||||||
|
|
||||||
if (atom == prop_mbemu)
|
|
||||||
{
|
|
||||||
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
|
||||||
return BadMatch;
|
|
||||||
|
|
||||||
if (!checkonly)
|
|
||||||
pEvdev->emulateMB.enabled = *((BOOL*)val->data);
|
|
||||||
} else if (atom == prop_mbtimeout)
|
|
||||||
{
|
|
||||||
if (val->format != 16 || val->size != 1 || val->type != XA_INTEGER)
|
|
||||||
return BadMatch;
|
|
||||||
|
|
||||||
if (!checkonly)
|
|
||||||
pEvdev->emulateMB.timeout = *((INT16*)val->data);
|
|
||||||
}
|
|
||||||
|
|
||||||
return Success;
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
259
src/emuWheel.c
259
src/emuWheel.c
@@ -54,7 +54,7 @@ static Atom prop_wheel_button = 0;
|
|||||||
|
|
||||||
/* Local Funciton Prototypes */
|
/* Local Funciton Prototypes */
|
||||||
static BOOL EvdevWheelEmuHandleButtonMap(InputInfoPtr pInfo, WheelAxisPtr pAxis, char *axis_name);
|
static BOOL EvdevWheelEmuHandleButtonMap(InputInfoPtr pInfo, WheelAxisPtr pAxis, char *axis_name);
|
||||||
static void EvdevWheelEmuInertia(InputInfoPtr pInfo, WheelAxisPtr axis, int value);
|
static int EvdevWheelEmuInertia(InputInfoPtr pInfo, WheelAxisPtr axis, int value);
|
||||||
|
|
||||||
/* Filter mouse button events */
|
/* Filter mouse button events */
|
||||||
BOOL
|
BOOL
|
||||||
@@ -82,8 +82,7 @@ EvdevWheelEmuFilterButton(InputInfoPtr pInfo, unsigned int button, int value)
|
|||||||
* If the button is released early enough emit the button
|
* If the button is released early enough emit the button
|
||||||
* press/release events
|
* press/release events
|
||||||
*/
|
*/
|
||||||
xf86PostButtonEvent(pInfo->dev, 0, button, 1, 0, 0);
|
EvdevQueueButtonClicks(pInfo, button, 1);
|
||||||
xf86PostButtonEvent(pInfo->dev, 0, button, 0, 0, 0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -99,38 +98,51 @@ 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;
|
WheelAxisPtr pAxis = NULL, pOtherAxis = NULL;
|
||||||
int value = pEv->value;
|
int value = pEv->value;
|
||||||
int ms;
|
|
||||||
|
|
||||||
/* Has wheel emulation been configured to be enabled? */
|
/* Has wheel emulation been configured to be enabled? */
|
||||||
if (!pEvdev->emulateWheel.enabled)
|
if (!pEvdev->emulateWheel.enabled)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
/* Handle our motion events if the emuWheel button is pressed*/
|
/* Handle our motion events if the emuWheel button is pressed
|
||||||
if (pEvdev->emulateWheel.button_state) {
|
* wheel button of 0 means always emulate wheel.
|
||||||
|
*/
|
||||||
|
if (pEvdev->emulateWheel.button_state || !pEvdev->emulateWheel.button) {
|
||||||
/* Just return if the timeout hasn't expired yet */
|
/* Just return if the timeout hasn't expired yet */
|
||||||
ms = pEvdev->emulateWheel.expires - GetTimeInMillis();
|
if (pEvdev->emulateWheel.button)
|
||||||
if (ms > 0)
|
{
|
||||||
return TRUE;
|
int ms = pEvdev->emulateWheel.expires - GetTimeInMillis();
|
||||||
|
if (ms > 0)
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* We don't want to intercept real mouse wheel events */
|
/* We don't want to intercept real mouse wheel events */
|
||||||
switch(pEv->code) {
|
switch(pEv->code) {
|
||||||
case REL_X:
|
case REL_X:
|
||||||
pAxis = &(pEvdev->emulateWheel.X);
|
pAxis = &(pEvdev->emulateWheel.X);
|
||||||
|
pOtherAxis = &(pEvdev->emulateWheel.Y);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REL_Y:
|
case REL_Y:
|
||||||
pAxis = &(pEvdev->emulateWheel.Y);
|
pAxis = &(pEvdev->emulateWheel.Y);
|
||||||
|
pOtherAxis = &(pEvdev->emulateWheel.X);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If we found REL_X or REL_Y, emulate a mouse wheel */
|
/* If we found REL_X or REL_Y, emulate a mouse wheel.
|
||||||
|
Reset the inertia of the other axis when a scroll event 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;
|
||||||
@@ -139,17 +151,20 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Simulate inertia for our emulated mouse wheel */
|
/* Simulate inertia for our emulated mouse wheel.
|
||||||
static void
|
Returns the number of wheel events generated.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
EvdevWheelEmuInertia(InputInfoPtr pInfo, WheelAxisPtr axis, int value)
|
EvdevWheelEmuInertia(InputInfoPtr pInfo, WheelAxisPtr axis, int value)
|
||||||
{
|
{
|
||||||
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
int button;
|
int button;
|
||||||
int inertia;
|
int inertia;
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
/* if this axis has not been configured, just eat the motion */
|
/* if this axis has not been configured, just eat the motion */
|
||||||
if (!axis->up_button)
|
if (!axis->up_button)
|
||||||
return;
|
return rc;
|
||||||
|
|
||||||
axis->traveled_distance += value;
|
axis->traveled_distance += value;
|
||||||
|
|
||||||
@@ -163,11 +178,11 @@ EvdevWheelEmuInertia(InputInfoPtr pInfo, WheelAxisPtr axis, int value)
|
|||||||
|
|
||||||
/* Produce button press events for wheel motion */
|
/* Produce button press events for wheel motion */
|
||||||
while(abs(axis->traveled_distance) > pEvdev->emulateWheel.inertia) {
|
while(abs(axis->traveled_distance) > pEvdev->emulateWheel.inertia) {
|
||||||
|
|
||||||
axis->traveled_distance -= inertia;
|
axis->traveled_distance -= inertia;
|
||||||
xf86PostButtonEvent(pInfo->dev, 0, button, 1, 0, 0);
|
EvdevQueueButtonClicks(pInfo, button, 1);
|
||||||
xf86PostButtonEvent(pInfo->dev, 0, button, 0, 0, 0);
|
rc++;
|
||||||
}
|
}
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Handle button mapping here to avoid code duplication,
|
/* Handle button mapping here to avoid code duplication,
|
||||||
@@ -201,8 +216,8 @@ EvdevWheelEmuHandleButtonMap(InputInfoPtr pInfo, WheelAxisPtr pAxis, char* axis_
|
|||||||
pAxis->down_button = down_button;
|
pAxis->down_button = down_button;
|
||||||
|
|
||||||
/* Update the number of buttons if needed */
|
/* Update the number of buttons if needed */
|
||||||
if (up_button > pEvdev->buttons) pEvdev->buttons = up_button;
|
if (up_button > pEvdev->num_buttons) pEvdev->num_buttons = up_button;
|
||||||
if (down_button > pEvdev->buttons) pEvdev->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",
|
xf86Msg(X_WARNING, "%s: Invalid %s value:\"%s\"\n",
|
||||||
@@ -285,8 +300,8 @@ EvdevWheelEmuPreInit(InputInfoPtr pInfo)
|
|||||||
|
|
||||||
/* Simpler to check just the largest value in this case */
|
/* Simpler to check just the largest value in this case */
|
||||||
/* XXX: we should post this to the server */
|
/* XXX: we should post this to the server */
|
||||||
if (5 > pEvdev->buttons)
|
if (5 > pEvdev->num_buttons)
|
||||||
pEvdev->buttons = 5;
|
pEvdev->num_buttons = 5;
|
||||||
|
|
||||||
/* Display default Configuration */
|
/* Display default Configuration */
|
||||||
xf86Msg(X_CONFIG, "%s: YAxisMapping: buttons %d and %d\n",
|
xf86Msg(X_CONFIG, "%s: YAxisMapping: buttons %d and %d\n",
|
||||||
@@ -308,35 +323,102 @@ EvdevWheelEmuPreInit(InputInfoPtr pInfo)
|
|||||||
"EmulateWheelInertia: %d, "
|
"EmulateWheelInertia: %d, "
|
||||||
"EmulateWheelTimeout: %d\n",
|
"EmulateWheelTimeout: %d\n",
|
||||||
pInfo->name, pEvdev->emulateWheel.button, inertia, timeout);
|
pInfo->name, pEvdev->emulateWheel.button, inertia, timeout);
|
||||||
|
|
||||||
#ifdef HAVE_PROPERTIES
|
|
||||||
XIChangeDeviceProperty(pInfo->dev, prop_wheel_emu, XA_INTEGER, 8,
|
|
||||||
PropModeReplace, 1, &pEvdev->emulateWheel.enabled, TRUE);
|
|
||||||
XIChangeDeviceProperty(pInfo->dev, prop_wheel_button, XA_INTEGER, 8,
|
|
||||||
PropModeReplace, 1, &pEvdev->emulateWheel.button, TRUE);
|
|
||||||
XIChangeDeviceProperty(pInfo->dev, prop_wheel_inertia, XA_INTEGER, 8,
|
|
||||||
PropModeReplace, 1, &pEvdev->emulateWheel.inertia, TRUE);
|
|
||||||
XIChangeDeviceProperty(pInfo->dev, prop_wheel_timeout, XA_INTEGER, 16,
|
|
||||||
PropModeReplace, 1, &pEvdev->emulateWheel.timeout, TRUE);
|
|
||||||
|
|
||||||
val[0] = pEvdev->emulateWheel.X.up_button;
|
|
||||||
val[1] = pEvdev->emulateWheel.X.down_button;
|
|
||||||
val[2] = pEvdev->emulateWheel.Y.up_button;
|
|
||||||
val[3] = pEvdev->emulateWheel.Y.down_button;
|
|
||||||
XIChangeDeviceProperty(pInfo->dev, prop_wheel_axismap, XA_INTEGER, 8,
|
|
||||||
PropModeReplace, 4, val, TRUE);
|
|
||||||
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_PROPERTIES
|
#ifdef HAVE_PROPERTIES
|
||||||
|
static int
|
||||||
|
EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||||
|
BOOL checkonly)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
|
||||||
|
if (atom == prop_wheel_emu)
|
||||||
|
{
|
||||||
|
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
{
|
||||||
|
pEvdev->emulateWheel.enabled = *((BOOL*)val->data);
|
||||||
|
/* Don't enable with zero inertia, otherwise we may get stuck in an
|
||||||
|
* infinite loop */
|
||||||
|
if (pEvdev->emulateWheel.inertia <= 0)
|
||||||
|
{
|
||||||
|
pEvdev->emulateWheel.inertia = 10;
|
||||||
|
/* We may get here before the property is actually enabled */
|
||||||
|
if (prop_wheel_inertia)
|
||||||
|
XIChangeDeviceProperty(dev, prop_wheel_inertia, XA_INTEGER,
|
||||||
|
16, PropModeReplace, 1,
|
||||||
|
&pEvdev->emulateWheel.inertia, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (atom == prop_wheel_button)
|
||||||
|
{
|
||||||
|
int bt;
|
||||||
|
|
||||||
|
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->emulateWheel.button = bt;
|
||||||
|
} else if (atom == prop_wheel_axismap)
|
||||||
|
{
|
||||||
|
if (val->format != 8 || val->size != 4 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
{
|
||||||
|
pEvdev->emulateWheel.X.up_button = *((CARD8*)val->data);
|
||||||
|
pEvdev->emulateWheel.X.down_button = *(((CARD8*)val->data) + 1);
|
||||||
|
pEvdev->emulateWheel.Y.up_button = *(((CARD8*)val->data) + 2);
|
||||||
|
pEvdev->emulateWheel.Y.down_button = *(((CARD8*)val->data) + 3);
|
||||||
|
}
|
||||||
|
} else if (atom == prop_wheel_inertia)
|
||||||
|
{
|
||||||
|
int inertia;
|
||||||
|
|
||||||
|
if (val->format != 16 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
inertia = *((CARD16*)val->data);
|
||||||
|
|
||||||
|
if (inertia < 0)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
pEvdev->emulateWheel.inertia = inertia;
|
||||||
|
} else if (atom == prop_wheel_timeout)
|
||||||
|
{
|
||||||
|
int timeout;
|
||||||
|
|
||||||
|
if (val->format != 16 || val->size != 1 || val->type != XA_INTEGER)
|
||||||
|
return BadMatch;
|
||||||
|
|
||||||
|
timeout = *((CARD16*)val->data);
|
||||||
|
|
||||||
|
if (timeout < 0)
|
||||||
|
return BadValue;
|
||||||
|
|
||||||
|
if (!checkonly)
|
||||||
|
pEvdev->emulateWheel.timeout = timeout;
|
||||||
|
}
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
EvdevWheelEmuInitProperty(DeviceIntPtr dev)
|
EvdevWheelEmuInitProperty(DeviceIntPtr dev)
|
||||||
{
|
{
|
||||||
InputInfoPtr pInfo = dev->public.devicePrivate;
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
EvdevPtr pEvdev = pInfo->private;
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
int rc = TRUE;
|
int rc = TRUE;
|
||||||
INT32 vals[4] = { TRUE, FALSE};
|
char vals[4];
|
||||||
|
|
||||||
if (!dev->button) /* don't init prop for keyboards */
|
if (!dev->button) /* don't init prop for keyboards */
|
||||||
return;
|
return;
|
||||||
@@ -390,96 +472,7 @@ EvdevWheelEmuInitProperty(DeviceIntPtr dev)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
XISetDevicePropertyDeletable(dev, prop_wheel_button, FALSE);
|
XISetDevicePropertyDeletable(dev, prop_wheel_button, FALSE);
|
||||||
|
|
||||||
|
XIRegisterPropertyHandler(dev, EvdevWheelEmuSetProperty, NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
|
||||||
BOOL checkonly)
|
|
||||||
{
|
|
||||||
InputInfoPtr pInfo = dev->public.devicePrivate;
|
|
||||||
EvdevPtr pEvdev = pInfo->private;
|
|
||||||
|
|
||||||
if (atom == prop_wheel_emu)
|
|
||||||
{
|
|
||||||
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
|
||||||
return BadMatch;
|
|
||||||
|
|
||||||
if (!checkonly)
|
|
||||||
{
|
|
||||||
pEvdev->emulateWheel.enabled = *((BOOL*)val->data);
|
|
||||||
/* Don't enable with zero inertia, otherwise we may get stuck in an
|
|
||||||
* infinite loop */
|
|
||||||
if (pEvdev->emulateWheel.inertia <= 0)
|
|
||||||
{
|
|
||||||
pEvdev->emulateWheel.inertia = 10;
|
|
||||||
/* We may get here before the property is actually enabled */
|
|
||||||
if (prop_wheel_inertia)
|
|
||||||
XIChangeDeviceProperty(dev, prop_wheel_inertia, XA_INTEGER,
|
|
||||||
16, PropModeReplace, 1,
|
|
||||||
&pEvdev->emulateWheel.inertia, TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Don't enable with negative timeout */
|
|
||||||
if (pEvdev->emulateWheel.timeout < 0)
|
|
||||||
{
|
|
||||||
pEvdev->emulateWheel.timeout = 200;
|
|
||||||
XIChangeDeviceProperty(dev, prop_wheel_timeout, XA_INTEGER, 16,
|
|
||||||
PropModeReplace, 1,
|
|
||||||
&pEvdev->emulateWheel.timeout, TRUE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else if (atom == prop_wheel_button)
|
|
||||||
{
|
|
||||||
int bt = *((CARD8*)val->data);
|
|
||||||
|
|
||||||
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
|
||||||
return BadMatch;
|
|
||||||
|
|
||||||
if (bt < 0 || bt >= EVDEV_MAXBUTTONS)
|
|
||||||
return BadValue;
|
|
||||||
|
|
||||||
if (!checkonly)
|
|
||||||
pEvdev->emulateWheel.button = bt;
|
|
||||||
} else if (atom == prop_wheel_axismap)
|
|
||||||
{
|
|
||||||
if (val->format != 8 || val->size != 4 || val->type != XA_INTEGER)
|
|
||||||
return BadMatch;
|
|
||||||
|
|
||||||
if (!checkonly)
|
|
||||||
{
|
|
||||||
pEvdev->emulateWheel.X.up_button = *((CARD8*)val->data);
|
|
||||||
pEvdev->emulateWheel.X.down_button = *(((CARD8*)val->data) + 1);
|
|
||||||
pEvdev->emulateWheel.Y.up_button = *(((CARD8*)val->data) + 2);
|
|
||||||
pEvdev->emulateWheel.Y.down_button = *(((CARD8*)val->data) + 3);
|
|
||||||
}
|
|
||||||
} else if (atom == prop_wheel_inertia)
|
|
||||||
{
|
|
||||||
int inertia = *((CARD16*)val->data);
|
|
||||||
|
|
||||||
if (val->format != 16 || val->size != 1 || val->type != XA_INTEGER)
|
|
||||||
return BadMatch;
|
|
||||||
|
|
||||||
if (inertia < 0)
|
|
||||||
return BadValue;
|
|
||||||
|
|
||||||
if (!checkonly)
|
|
||||||
pEvdev->emulateWheel.inertia = inertia;
|
|
||||||
} else if (atom == prop_wheel_timeout)
|
|
||||||
{
|
|
||||||
int timeout = *((CARD16*)val->data);
|
|
||||||
|
|
||||||
if (val->format != 16 || val->size != 1 || val->type != XA_INTEGER)
|
|
||||||
return BadMatch;
|
|
||||||
|
|
||||||
if (timeout < 0)
|
|
||||||
return BadValue;
|
|
||||||
|
|
||||||
if (!checkonly)
|
|
||||||
pEvdev->emulateWheel.timeout = timeout;
|
|
||||||
}
|
|
||||||
return Success;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
1890
src/evdev.c
1890
src/evdev.c
File diff suppressed because it is too large
Load Diff
137
src/evdev.h
137
src/evdev.h
@@ -25,29 +25,62 @@
|
|||||||
* Kristian Høgsberg (krh@redhat.com)
|
* Kristian Høgsberg (krh@redhat.com)
|
||||||
* Adam Jackson (ajax@redhat.com)
|
* Adam Jackson (ajax@redhat.com)
|
||||||
* Peter Hutterer (peter@cs.unisa.edu.au)
|
* Peter Hutterer (peter@cs.unisa.edu.au)
|
||||||
|
* Oliver McFadden (oliver.mcfadden@nokia.com)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#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 <xf86Xinput.h>
|
#include <xf86Xinput.h>
|
||||||
#include <xf86_OSproc.h>
|
#include <xf86_OSproc.h>
|
||||||
|
#include <xkbstr.h>
|
||||||
|
|
||||||
#if defined(XKB)
|
#ifndef EV_CNT /* linux 2.4 kernels and earlier lack _CNT defines */
|
||||||
/* XXX VERY WRONG. this is a client side header. */
|
#define EV_CNT (EV_MAX+1)
|
||||||
#include <X11/extensions/XKBstr.h>
|
#endif
|
||||||
|
#ifndef KEY_CNT
|
||||||
|
#define KEY_CNT (KEY_MAX+1)
|
||||||
|
#endif
|
||||||
|
#ifndef REL_CNT
|
||||||
|
#define REL_CNT (REL_MAX+1)
|
||||||
|
#endif
|
||||||
|
#ifndef ABS_CNT
|
||||||
|
#define ABS_CNT (ABS_MAX+1)
|
||||||
|
#endif
|
||||||
|
#ifndef LED_CNT
|
||||||
|
#define LED_CNT (LED_MAX+1)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define EVDEV_MAXBUTTONS 32
|
#define EVDEV_MAXBUTTONS 32
|
||||||
|
#define EVDEV_MAXQUEUE 32
|
||||||
|
|
||||||
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3
|
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3
|
||||||
#define HAVE_PROPERTIES 1
|
#define HAVE_PROPERTIES 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef MAX_VALUATORS
|
||||||
|
#define MAX_VALUATORS 36
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 5
|
||||||
|
typedef struct {
|
||||||
|
char *rules;
|
||||||
|
char *model;
|
||||||
|
char *layout;
|
||||||
|
char *variant;
|
||||||
|
char *options;
|
||||||
|
} XkbRMLVOSet;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#define LONG_BITS (sizeof(long) * 8)
|
#define LONG_BITS (sizeof(long) * 8)
|
||||||
#define NBITS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
|
|
||||||
|
/* Number of longs needed to hold the given number of bits */
|
||||||
|
#define NLONGS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
|
||||||
|
|
||||||
/* axis specific data for wheel emulation */
|
/* axis specific data for wheel emulation */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -56,28 +89,41 @@ typedef struct {
|
|||||||
int traveled_distance;
|
int traveled_distance;
|
||||||
} WheelAxis, *WheelAxisPtr;
|
} WheelAxis, *WheelAxisPtr;
|
||||||
|
|
||||||
|
/* Event queue used to defer keyboard/button events until EV_SYN time. */
|
||||||
|
typedef struct {
|
||||||
|
enum {
|
||||||
|
EV_QUEUE_KEY, /* xf86PostKeyboardEvent() */
|
||||||
|
EV_QUEUE_BTN, /* xf86PostButtonEvent() */
|
||||||
|
} type;
|
||||||
|
int key; /* May be either a key code or button number. */
|
||||||
|
int val; /* State of the key/button; pressed or released. */
|
||||||
|
} EventQueueRec, *EventQueuePtr;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const char *device;
|
const char *device;
|
||||||
int kernel24;
|
int grabDevice; /* grab the event device? */
|
||||||
int screen;
|
|
||||||
int min_x, min_y, max_x, max_y;
|
int num_vals; /* number of valuators */
|
||||||
int abs_x, abs_y, old_x, old_y;
|
int axis_map[max(ABS_CNT, REL_CNT)]; /* Map evdev <axis> to index */
|
||||||
|
int vals[MAX_VALUATORS];
|
||||||
|
int old_vals[MAX_VALUATORS]; /* Translate absolute inputs to relative */
|
||||||
|
|
||||||
int flags;
|
int flags;
|
||||||
int tool;
|
int tool;
|
||||||
int buttons; /* number of buttons */
|
int num_buttons; /* number of buttons */
|
||||||
|
BOOL swap_axes;
|
||||||
BOOL invert_x;
|
BOOL invert_x;
|
||||||
BOOL invert_y;
|
BOOL invert_y;
|
||||||
|
|
||||||
|
int delta[REL_CNT];
|
||||||
|
unsigned int abs, rel;
|
||||||
|
|
||||||
/* XKB stuff has to be per-device rather than per-driver */
|
/* XKB stuff has to be per-device rather than per-driver */
|
||||||
int noXkb;
|
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 5
|
||||||
#ifdef XKB
|
|
||||||
char *xkb_rules;
|
|
||||||
char *xkb_model;
|
|
||||||
char *xkb_layout;
|
|
||||||
char *xkb_variant;
|
|
||||||
char *xkb_options;
|
|
||||||
XkbComponentNamesRec xkbnames;
|
XkbComponentNamesRec xkbnames;
|
||||||
#endif
|
#endif
|
||||||
|
XkbRMLVOSet rmlvo;
|
||||||
|
|
||||||
/* Middle mouse button emulation */
|
/* Middle mouse button emulation */
|
||||||
struct {
|
struct {
|
||||||
BOOL enabled;
|
BOOL enabled;
|
||||||
@@ -103,6 +149,13 @@ typedef struct {
|
|||||||
Time expires; /* time of expiry */
|
Time expires; /* time of expiry */
|
||||||
Time timeout;
|
Time timeout;
|
||||||
} emulateWheel;
|
} emulateWheel;
|
||||||
|
/* run-time calibration */
|
||||||
|
struct {
|
||||||
|
int min_x;
|
||||||
|
int max_x;
|
||||||
|
int min_y;
|
||||||
|
int max_y;
|
||||||
|
} calibration;
|
||||||
|
|
||||||
unsigned char btnmap[32]; /* config-file specified button mapping */
|
unsigned char btnmap[32]; /* config-file specified button mapping */
|
||||||
|
|
||||||
@@ -112,42 +165,54 @@ typedef struct {
|
|||||||
|
|
||||||
/* Cached info from device. */
|
/* Cached info from device. */
|
||||||
char name[1024];
|
char name[1024];
|
||||||
long bitmask[NBITS(EV_MAX)];
|
unsigned long bitmask[NLONGS(EV_CNT)];
|
||||||
long key_bitmask[NBITS(KEY_MAX)];
|
unsigned long key_bitmask[NLONGS(KEY_CNT)];
|
||||||
long rel_bitmask[NBITS(REL_MAX)];
|
unsigned long rel_bitmask[NLONGS(REL_CNT)];
|
||||||
long abs_bitmask[NBITS(ABS_MAX)];
|
unsigned long abs_bitmask[NLONGS(ABS_CNT)];
|
||||||
long led_bitmask[NBITS(LED_MAX)];
|
unsigned long led_bitmask[NLONGS(LED_CNT)];
|
||||||
struct input_absinfo absinfo[ABS_MAX];
|
struct input_absinfo absinfo[ABS_CNT];
|
||||||
|
|
||||||
|
/* minor/major number */
|
||||||
|
dev_t min_maj;
|
||||||
|
|
||||||
|
/* Event queue used to defer keyboard/button events until EV_SYN time. */
|
||||||
|
int num_queue;
|
||||||
|
EventQueueRec queue[EVDEV_MAXQUEUE];
|
||||||
} EvdevRec, *EvdevPtr;
|
} EvdevRec, *EvdevPtr;
|
||||||
|
|
||||||
|
/* Event posting functions */
|
||||||
|
void EvdevQueueKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value);
|
||||||
|
void EvdevQueueButtonEvent(InputInfoPtr pInfo, int button, int value);
|
||||||
|
void EvdevPostButtonEvent(InputInfoPtr pInfo, int button, int value);
|
||||||
|
void EvdevQueueButtonClicks(InputInfoPtr pInfo, int button, int count);
|
||||||
|
void EvdevPostRelativeMotionEvents(InputInfoPtr pInfo, int *num_v, int *first_v,
|
||||||
|
int v[MAX_VALUATORS]);
|
||||||
|
void EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo, int *num_v, int *first_v,
|
||||||
|
int v[MAX_VALUATORS]);
|
||||||
|
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(pointer, int, pointer);
|
||||||
void EvdevMBEmuBlockHandler(pointer, struct timeval**, pointer);
|
void EvdevMBEmuBlockHandler(pointer, struct timeval**, pointer);
|
||||||
void EvdevMBEmuPreInit(InputInfoPtr);
|
void EvdevMBEmuPreInit(InputInfoPtr);
|
||||||
|
void EvdevMBEmuOn(InputInfoPtr);
|
||||||
void EvdevMBEmuFinalize(InputInfoPtr);
|
void EvdevMBEmuFinalize(InputInfoPtr);
|
||||||
void EvdevMBEmuEnable(InputInfoPtr, BOOL);
|
void EvdevMBEmuEnable(InputInfoPtr, BOOL);
|
||||||
|
|
||||||
unsigned int EvdevUtilButtonEventToButtonNumber(int code);
|
|
||||||
|
|
||||||
#ifdef HAVE_PROPERTIES
|
|
||||||
void EvdevMBEmuInitProperty(DeviceIntPtr);
|
|
||||||
int EvdevMBEmuSetProperty(DeviceIntPtr, Atom, XIPropertyValuePtr, BOOL);
|
|
||||||
|
|
||||||
void EvdevWheelEmuInitProperty(DeviceIntPtr);
|
|
||||||
int EvdevWheelEmuSetProperty(DeviceIntPtr, Atom, XIPropertyValuePtr, BOOL);
|
|
||||||
|
|
||||||
void EvdevDragLockInitProperty(DeviceIntPtr);
|
|
||||||
int EvdevDragLockSetProperty(DeviceIntPtr, Atom, XIPropertyValuePtr, BOOL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* 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);
|
||||||
BOOL EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv);
|
BOOL EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv);
|
||||||
|
|
||||||
/* Draglock code */
|
/* Draglock code */
|
||||||
void EvdevDragLockInit(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 EvdevWheelEmuInitProperty(DeviceIntPtr);
|
||||||
|
void EvdevDragLockInitProperty(DeviceIntPtr);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user