mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Compare commits
222 Commits
xf86-input
...
xf86-input
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6eab92c7e7 | ||
|
|
0e9990bf3b | ||
|
|
9d2156e5a6 | ||
|
|
f7850a4042 | ||
|
|
bd4102af6e | ||
|
|
22e816eb32 | ||
|
|
b6b377fe9a | ||
|
|
3772676fd6 | ||
|
|
4f05afd495 | ||
|
|
c6964dd28a | ||
|
|
175af93bdb | ||
|
|
7c3c7f83d0 | ||
|
|
aa6399fdb9 | ||
|
|
1d86f5dec1 | ||
|
|
fbd86e2530 | ||
|
|
9ea1f9a695 | ||
|
|
57b54ee399 | ||
|
|
f2dc0681fe | ||
|
|
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 | ||
|
|
9065d0ccb2 | ||
|
|
a9fcce1833 | ||
|
|
ab934d840d | ||
|
|
6f6ac98295 | ||
|
|
a2633c8078 | ||
|
|
e6c699dedc | ||
|
|
847eac8262 | ||
|
|
a196672a6b | ||
|
|
3985d42320 | ||
|
|
e138e4b79a | ||
|
|
125e2b8ce2 | ||
|
|
91bc0a0ba3 | ||
|
|
4c55186aed | ||
|
|
62069b97d2 | ||
|
|
2718a5c56b | ||
|
|
90d1d494f8 | ||
|
|
a77c2622cc | ||
|
|
84a0e39c0d | ||
|
|
7386937221 | ||
|
|
fcf8375f2b | ||
|
|
9930477cbe | ||
|
|
4509ec1daf | ||
|
|
a205dfc091 | ||
|
|
184206e717 | ||
|
|
79ff677c52 | ||
|
|
37e3addf89 | ||
|
|
e237de0dea | ||
|
|
92c6611b6f | ||
|
|
bd405ddc83 | ||
|
|
36d702006d | ||
|
|
6dc4199155 | ||
|
|
e8534d47c8 | ||
|
|
555f5a7cbf | ||
|
|
134829d911 | ||
|
|
4e121b297e | ||
|
|
9793de8137 | ||
|
|
a9d72b40fb | ||
|
|
c1f7f8c3d2 | ||
|
|
40e1474d84 | ||
|
|
d9097df01b | ||
|
|
5c074af5a9 | ||
|
|
72551662a0 | ||
|
|
53e7525744 | ||
|
|
5d13259a5d | ||
|
|
2b7edaa4ab | ||
|
|
bf0d81011e | ||
|
|
ef4bb69c1a | ||
|
|
d1818ef206 | ||
|
|
a9223edcd8 | ||
|
|
ec23c6b2f5 | ||
|
|
18d70d796f | ||
|
|
37b854cb64 | ||
|
|
8c06093191 | ||
|
|
0830676a0c | ||
|
|
1cf7b8f7ee | ||
|
|
826e6e7dd4 | ||
|
|
5a0ea39b79 | ||
|
|
373e13ae35 | ||
|
|
76800bfa75 |
13
.cvsignore → .gitignore
vendored
13
.cvsignore → .gitignore
vendored
@@ -1,7 +1,7 @@
|
|||||||
|
*.patch
|
||||||
|
ChangeLog
|
||||||
Makefile
|
Makefile
|
||||||
Makefile.in
|
Makefile.in
|
||||||
*.la
|
|
||||||
*.lo
|
|
||||||
aclocal.m4
|
aclocal.m4
|
||||||
autom4te.cache
|
autom4te.cache
|
||||||
config.guess
|
config.guess
|
||||||
@@ -15,5 +15,14 @@ depcomp
|
|||||||
install-sh
|
install-sh
|
||||||
libtool
|
libtool
|
||||||
ltmain.sh
|
ltmain.sh
|
||||||
|
man/evdev.4
|
||||||
missing
|
missing
|
||||||
|
.deps
|
||||||
|
.libs
|
||||||
|
*.lo
|
||||||
|
*.la
|
||||||
stamp-h1
|
stamp-h1
|
||||||
|
xf86-input-evdev-*.tar.*
|
||||||
|
*.pc
|
||||||
|
*~
|
||||||
|
tags
|
||||||
99
COPYING
99
COPYING
@@ -1,12 +1,95 @@
|
|||||||
This is a stub file. This package has not yet had its complete licensing
|
Various copyright notices found in this driver:
|
||||||
information compiled. Please see the individual source files for details on
|
|
||||||
your rights to use and modify this software.
|
|
||||||
|
|
||||||
Please submit updated COPYING files to the Xorg bugzilla:
|
Copyright © 2004-2008 Red Hat, Inc.
|
||||||
|
|
||||||
https://bugs.freedesktop.org/enter_bug.cgi?product=xorg
|
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.
|
||||||
|
|
||||||
All licensing questions regarding this software should be directed at the
|
THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||||
Xorg mailing list:
|
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.
|
||||||
|
|
||||||
|
Copyright 2005 Sun Microsystems, Inc. All rights reserved.
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included
|
||||||
|
in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||||
|
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||||
|
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||||
|
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||||
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
|
||||||
|
OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
|
Except as contained in this notice, the name of the copyright holders shall
|
||||||
|
not be used in advertising or otherwise to promote the sale, use or
|
||||||
|
other dealings in this Software without prior written authorization
|
||||||
|
from the copyright holders.
|
||||||
|
|
||||||
|
Copyright © 2008 University of South Australia
|
||||||
|
copyrights taken from xf86-input-mouse, partly valid for this driver.
|
||||||
|
Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
|
||||||
|
Copyright 1993 by David Dawes <dawes@xfree86.org>
|
||||||
|
Copyright 2002 by SuSE Linux AG, Author: Egbert Eich
|
||||||
|
Copyright 1994-2002 by The XFree86 Project, Inc.
|
||||||
|
Copyright 2002 by Paul Elliott
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
|
||||||
|
Copyright 2005 Adam Jackson.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a
|
||||||
|
copy of this software and associated documentation files (the "Software"),
|
||||||
|
to deal in the Software without restriction, including without limitation
|
||||||
|
on the rights to use, copy, modify, merge, publish, distribute, sub
|
||||||
|
license, and/or sell copies of the Software, and to permit persons to whom
|
||||||
|
the Software is furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice (including the next
|
||||||
|
paragraph) shall be included in all copies or substantial portions of the
|
||||||
|
Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
|
||||||
|
ADAM JACKSON BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||||
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||||
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
http://lists.freedesktop.org/mailman/listinfo/xorg
|
|
||||||
|
|||||||
47
ChangeLog
47
ChangeLog
@@ -1,47 +0,0 @@
|
|||||||
2006-01-09 David Nusinow,,, <set EMAIL_ADDRESS environment variable>
|
|
||||||
|
|
||||||
* man/Makefile.am:
|
|
||||||
* man/evdev.man:
|
|
||||||
Bugzilla #968 <https://bugs.freedesktop.org/show_bug.cgi?id=968>
|
|
||||||
Patch #4301 <https://bugs.freedesktop.org/attachment.cgi?id=4301>
|
|
||||||
Add evdev manpage
|
|
||||||
|
|
||||||
2005-12-20 Kevin E. Martin <kem-at-freedesktop-dot-org>
|
|
||||||
|
|
||||||
* configure.ac:
|
|
||||||
Update package version for X11R7 release.
|
|
||||||
|
|
||||||
2005-12-14 Kevin E. Martin <kem-at-freedesktop-dot-org>
|
|
||||||
|
|
||||||
* configure.ac:
|
|
||||||
Update package version number for final X11R7 release candidate.
|
|
||||||
|
|
||||||
2005-12-06 Kevin E. Martin <kem-at-freedesktop-dot-org>
|
|
||||||
|
|
||||||
* man/Makefile.am:
|
|
||||||
Change *man_SOURCES ==> *man_PRE to fix autotools warnings.
|
|
||||||
|
|
||||||
2005-12-03 Kevin E. Martin <kem-at-freedesktop-dot-org>
|
|
||||||
|
|
||||||
* configure.ac:
|
|
||||||
Update package version number for X11R7 RC3 release.
|
|
||||||
|
|
||||||
2005-12-01 Kevin E. Martin <kem-at-freedesktop-dot-org>
|
|
||||||
|
|
||||||
* configure.ac:
|
|
||||||
Remove extraneous AC_MSG_RESULT.
|
|
||||||
|
|
||||||
2005-11-29 Adam Jackson <ajax@freedesktop.org>
|
|
||||||
|
|
||||||
* configure.ac:
|
|
||||||
Only build dlloader modules by default.
|
|
||||||
|
|
||||||
2005-11-09 Kevin E. Martin <kem-at-freedesktop-dot-org>
|
|
||||||
|
|
||||||
* configure.ac:
|
|
||||||
Update package version number for X11R7 RC2 release.
|
|
||||||
|
|
||||||
2005-11-01 Kevin E. Martin <kem-at-freedesktop-dot-org>
|
|
||||||
|
|
||||||
* configure.ac:
|
|
||||||
Update pkgcheck dependencies to work with separate build roots.
|
|
||||||
20
Makefile.am
20
Makefile.am
@@ -19,4 +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
|
||||||
SUBDIRS = src man
|
|
||||||
|
# Ensure headers are installed below $(prefix) for distcheck
|
||||||
|
DISTCHECK_CONFIGURE_FLAGS = --with-sdkdir='$${includedir}/xorg'
|
||||||
|
|
||||||
|
SUBDIRS = src man include
|
||||||
|
|
||||||
|
pkgconfigdir = $(libdir)/pkgconfig
|
||||||
|
pkgconfig_DATA = xorg-evdev.pc
|
||||||
|
|
||||||
|
EXTRA_DIST = ChangeLog
|
||||||
|
|
||||||
|
MAINTAINERCLEANFILES=ChangeLog
|
||||||
|
|
||||||
|
.PHONY: ChangeLog
|
||||||
|
|
||||||
|
ChangeLog:
|
||||||
|
$(CHANGELOG_CMD)
|
||||||
|
|
||||||
|
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
|
||||||
53
configure.ac
53
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.0,
|
2.3.3,
|
||||||
[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,36 +32,19 @@ 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"])
|
||||||
|
|
||||||
#AC_DEFINE(XFree86LOADER,1,[Stub define for loadable drivers])
|
|
||||||
#
|
|
||||||
#AC_ARG_ENABLE(XINPUT, AS_HELP_STRING([--enable-xinput],
|
|
||||||
# [Build XInput support (default: yes)]),
|
|
||||||
# [XINPUT=$enableval],[XINPUT=yes])
|
|
||||||
#AM_CONDITIONAL(XINPUT, test "x$XINPUT" = "xyes")
|
|
||||||
#if test "x$XINPUT" = "xyes" ; then
|
|
||||||
# AC_DEFINE(XINPUT,1,[Enable XInput support])
|
|
||||||
#fi
|
|
||||||
#
|
|
||||||
#AC_ARG_ENABLE(XKB, AS_HELP_STRING([--enable-xkb],
|
|
||||||
# [Build XKB support (default: yes)]),
|
|
||||||
# [XKB=$enableval],[XKB=yes])
|
|
||||||
#AM_CONDITIONAL(XKB, test "x$XKB" = "xyes")
|
|
||||||
#if test "x$XKB" = "xyes" ; then
|
|
||||||
# AC_DEFINE(XKB,1,[Enable XKB support])
|
|
||||||
#fi
|
|
||||||
|
|
||||||
AC_ARG_WITH(xorg-module-dir,
|
AC_ARG_WITH(xorg-module-dir,
|
||||||
AC_HELP_STRING([--with-xorg-module-dir=DIR],
|
AC_HELP_STRING([--with-xorg-module-dir=DIR],
|
||||||
[Default xorg module directory [[default=$libdir/xorg/modules]]]),
|
[Default xorg module directory [[default=$libdir/xorg/modules]]]),
|
||||||
@@ -70,23 +53,25 @@ 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(RANDR, randrproto)
|
# to satisfy silly distcheck requirements.
|
||||||
XORG_DRIVER_CHECK_EXT(XINPUT, inputproto)
|
|
||||||
|
|
||||||
# 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_ARG_WITH([sdkdir], [],
|
||||||
CFLAGS="$CFLAGS $XORG_CFLAGS "' -I$(top_srcdir)/src'
|
[sdkdir="$withval"],
|
||||||
AC_SUBST([CFLAGS])
|
[sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`])
|
||||||
|
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 src/Makefile man/Makefile])
|
AC_OUTPUT([Makefile
|
||||||
|
src/Makefile
|
||||||
|
man/Makefile
|
||||||
|
include/Makefile
|
||||||
|
xorg-evdev.pc])
|
||||||
|
|||||||
2
include/Makefile.am
Normal file
2
include/Makefile.am
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
EXTRA_DIST = evdev-properties.h
|
||||||
|
sdk_HEADERS = evdev-properties.h
|
||||||
69
include/evdev-properties.h
Normal file
69
include/evdev-properties.h
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
/*
|
||||||
|
* Copyright © 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.
|
||||||
|
*
|
||||||
|
* Authors:
|
||||||
|
* Peter Hutterer (peter.hutterer@redhat.com)
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _EVDEV_PROPERTIES_H_
|
||||||
|
#define _EVDEV_PROPERTIES_H_
|
||||||
|
|
||||||
|
/* Middle mouse button emulation */
|
||||||
|
/* BOOL */
|
||||||
|
#define EVDEV_PROP_MIDBUTTON "Evdev Middle Button Emulation"
|
||||||
|
/* CARD32 */
|
||||||
|
#define EVDEV_PROP_MIDBUTTON_TIMEOUT "Evdev Middle Button Timeout"
|
||||||
|
|
||||||
|
/* Wheel emulation */
|
||||||
|
/* BOOL */
|
||||||
|
#define EVDEV_PROP_WHEEL "Evdev Wheel Emulation"
|
||||||
|
/* CARD8, 4 values [x up, x down, y up, y down], 0 to disable a value*/
|
||||||
|
#define EVDEV_PROP_WHEEL_AXES "Evdev Wheel Emulation Axes"
|
||||||
|
/* CARD16 */
|
||||||
|
#define EVDEV_PROP_WHEEL_INERTIA "Evdev Wheel Emulation Inertia"
|
||||||
|
/* CARD16 */
|
||||||
|
#define EVDEV_PROP_WHEEL_TIMEOUT "Evdev Wheel Emulation Timeout"
|
||||||
|
/* CARD8, value range 0-32, 0 to always scroll */
|
||||||
|
#define EVDEV_PROP_WHEEL_BUTTON "Evdev Wheel Emulation Button"
|
||||||
|
|
||||||
|
/* Drag lock */
|
||||||
|
/* CARD8, either 1 value or pairs, value range 0-32, 0 to disable a value*/
|
||||||
|
#define EVDEV_PROP_DRAGLOCK "Evdev Drag Lock Buttons"
|
||||||
|
|
||||||
|
/* Axis inversion */
|
||||||
|
/* BOOL, 2 values [x, y], 1 inverts axis */
|
||||||
|
#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
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
# $Id$
|
|
||||||
#
|
|
||||||
# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
|
# Copyright 2005 Sun Microsystems, Inc. All rights reserved.
|
||||||
#
|
#
|
||||||
# Permission to use, copy, modify, distribute, and sell this software and its
|
# Permission to use, copy, modify, distribute, and sell this software and its
|
||||||
|
|||||||
182
man/evdev.man
182
man/evdev.man
@@ -9,9 +9,9 @@ evdev \- Generic Linux input driver
|
|||||||
.BI " Identifier \*q" devname \*q
|
.BI " Identifier \*q" devname \*q
|
||||||
.B " Driver \*qevdev\*q"
|
.B " Driver \*qevdev\*q"
|
||||||
.BI " Option \*qDevice\*q \*q" devpath \*q
|
.BI " Option \*qDevice\*q \*q" devpath \*q
|
||||||
.BI " Option \*qPath\*q \*q" path \*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
|
||||||
@@ -44,31 +44,189 @@ The following driver
|
|||||||
.B Options
|
.B Options
|
||||||
are supported:
|
are supported:
|
||||||
.TP 7
|
.TP 7
|
||||||
|
.BI "Option \*qButtonMapping\*q \*q" string \*q
|
||||||
|
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
|
||||||
|
device (i.e. the first number is the mapping for button 1, etc.). 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
|
||||||
|
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.
|
||||||
|
.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. This will
|
||||||
generally be of the form \*q/dev/input/eventX\*q, where X is some integer.
|
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. This option is
|
The mapping from device node to hardware is system-dependent.
|
||||||
mandatory unless \*qPath\*q is given, and there is no default setting.
|
.TP 7
|
||||||
|
.BI "Option \*qDragLockButtons\*q \*q" "L1 B2 L3 B4" \*q
|
||||||
|
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
|
||||||
|
same time they move a mouse cursor. Button numbers occur in pairs,
|
||||||
|
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".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qDragLockButtons\*q \*q" "M1" \*q
|
||||||
|
Sets a \*qmaster drag lock button\*q that acts as a \*qMeta Key\*q
|
||||||
|
indicating that the next button pressed is to be
|
||||||
|
\*qdrag locked\*q. Property: "Evdev Drag Lock Buttons".
|
||||||
.TP 7
|
.TP 7
|
||||||
.BI "Option \*qPath\*q \*q" string \*q
|
|
||||||
Specifies the device through which the device can be accessed. This will
|
|
||||||
generally be of the form \*q/dev/input/by-path/xyz\*q, where xyz includes the
|
|
||||||
name of the device. The mapping from device node to hardware is
|
|
||||||
system-dependent. This option has precedence over the \*qDevice\*q option but
|
|
||||||
one of \*qPath\*q or \*qDevice\*q must be given.
|
|
||||||
.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. The third button is emulated by
|
||||||
pressing both buttons simultaneously. Default: on, until a middle mouse
|
pressing both buttons simultaneously. Default: on, until a middle mouse
|
||||||
button event is registered.
|
button event is registered. 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 where pressed "simultaneously" when 3 button emulation is
|
||||||
enabled. Default: 50.
|
enabled. Default: 50. Property: "Evdev Middle Button Timeout".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulateWheel\*q \*q" boolean \*q
|
||||||
|
Enable/disable "wheel" emulation. Wheel emulation means emulating button
|
||||||
|
press/release events when the mouse is moved while a specific real button
|
||||||
|
is pressed. Wheel button events (typically buttons 4 and 5) are
|
||||||
|
usually used for scrolling. Wheel emulation is useful for getting wheel-like
|
||||||
|
behaviour with trackballs. It can also be useful for mice with 4 or
|
||||||
|
more buttons but no wheel. See the description of the
|
||||||
|
.BR EmulateWheelButton ,
|
||||||
|
.BR EmulateWheelInertia ,
|
||||||
|
.BR EmulateWheelTimeout ,
|
||||||
|
.BR XAxisMapping ,
|
||||||
|
and
|
||||||
|
.B YAxisMapping
|
||||||
|
options. Default: off. Property "Evdev Wheel Emulation".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulateWheelButton\*q \*q" integer \*q
|
||||||
|
Specifies which button must be held down to enable wheel emulation mode.
|
||||||
|
While this button is down, X and/or Y pointer movement will generate button
|
||||||
|
press/release events as specified for the
|
||||||
|
.B XAxisMapping
|
||||||
|
and
|
||||||
|
.B YAxisMapping
|
||||||
|
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
|
||||||
|
.BI "Option \*qEmulateWheelInertia\*q \*q" integer \*q
|
||||||
|
Specifies how far (in pixels) the pointer must move to generate button
|
||||||
|
press/release events in wheel emulation mode. Default: 10. Property: "Evdev
|
||||||
|
Wheel Emulation Inertia".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qEmulateWheelTimeout\*q \*q" integer \*q
|
||||||
|
Specifies the time in milliseconds the
|
||||||
|
.BR EmulateWheelButton
|
||||||
|
must be pressed before wheel emulation is started. If the
|
||||||
|
.BR EmulateWheelButton
|
||||||
|
is released before this timeout, the original button press/release event
|
||||||
|
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: unset. 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.
|
||||||
|
.br
|
||||||
|
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
|
||||||
|
behavior and events from this axis are always forwarded. Users are
|
||||||
|
discouraged from setting this option.
|
||||||
|
.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 \*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
|
||||||
|
coordinate system than reported to the X server. This feature is required
|
||||||
|
for devices that need to scale to a different coordinate system than
|
||||||
|
originally reported by the kernel (e.g. touchscreens). 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
|
||||||
|
.BI "Option \*qSwapAxes\*q \*q" Bool \*q
|
||||||
|
Swap x/y axes. Default: off. Property: "Evdev Axes Swap".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qXAxisMapping\*q \*q" "N1 N2" \*q
|
||||||
|
Specifies which buttons are mapped to motion in the X direction in wheel
|
||||||
|
emulation mode. Button number
|
||||||
|
.I N1
|
||||||
|
is mapped to the negative X axis motion and button number
|
||||||
|
.I N2
|
||||||
|
is mapped to the positive X axis motion. Default: no mapping. Property:
|
||||||
|
"Evdev Wheel Emulation Axes".
|
||||||
|
.TP 7
|
||||||
|
.BI "Option \*qYAxisMapping\*q \*q" "N1 N2" \*q
|
||||||
|
Specifies which buttons are mapped to motion in the Y direction in wheel
|
||||||
|
emulation mode. Button number
|
||||||
|
.I N1
|
||||||
|
is mapped to the negative Y axis motion and button number
|
||||||
|
.I N2
|
||||||
|
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
|
||||||
|
.BI "Evdev Axis Calibration"
|
||||||
|
4 32-bit values, order min-x, max-x, min-y, max-y or 0 values to disable
|
||||||
|
in-driver axis 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,10 +24,17 @@
|
|||||||
# -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@
|
||||||
|
|
||||||
|
INCLUDES=-I$(top_srcdir)/include/
|
||||||
|
|
||||||
@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 \
|
||||||
|
emuWheel.c \
|
||||||
|
draglock.c
|
||||||
|
|
||||||
|
|||||||
321
src/draglock.c
Normal file
321
src/draglock.c
Normal file
@@ -0,0 +1,321 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
|
||||||
|
* Copyright 1993 by David Dawes <dawes@xfree86.org>
|
||||||
|
* Copyright 2002 by SuSE Linux AG, Author: Egbert Eich
|
||||||
|
* Copyright 1994-2002 by The XFree86 Project, Inc.
|
||||||
|
* Copyright 2002 by Paul Elliott
|
||||||
|
* (Ported from xf86-input-mouse, above copyrights taken from there)
|
||||||
|
* Copyright © 2008 University of South Australia
|
||||||
|
* Copyright 2008 by Chris Salch
|
||||||
|
* Copyright 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 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Draglock code */
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <xf86.h>
|
||||||
|
#include <xf86Xinput.h>
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
#include <exevents.h>
|
||||||
|
|
||||||
|
#include <evdev-properties.h>
|
||||||
|
#include "evdev.h"
|
||||||
|
|
||||||
|
#ifdef HAVE_PROPERTIES
|
||||||
|
static Atom prop_dlock = 0; /* Drag lock buttons. */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void EvdevDragLockLockButton(InputInfoPtr pInfo, unsigned int button);
|
||||||
|
|
||||||
|
|
||||||
|
/* Setup and configuration code */
|
||||||
|
void
|
||||||
|
EvdevDragLockPreInit(InputInfoPtr pInfo)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
|
char *option_string = NULL;
|
||||||
|
int meta_button = 0;
|
||||||
|
int lock_button = 0;
|
||||||
|
char *next_num = NULL;
|
||||||
|
char *end_str = NULL;
|
||||||
|
BOOL pairs = FALSE;
|
||||||
|
|
||||||
|
option_string = xf86CheckStrOption(pInfo->options, "DragLockButtons",NULL);
|
||||||
|
|
||||||
|
if (!option_string)
|
||||||
|
return;
|
||||||
|
|
||||||
|
next_num = option_string;
|
||||||
|
|
||||||
|
/* Loop until we hit the end of our option string */
|
||||||
|
while (next_num != NULL) {
|
||||||
|
lock_button = 0;
|
||||||
|
meta_button = strtol(next_num, &end_str, 10);
|
||||||
|
|
||||||
|
/* check to see if we found anything */
|
||||||
|
if (next_num != end_str) {
|
||||||
|
/* setup for the next number */
|
||||||
|
next_num = end_str;
|
||||||
|
} else {
|
||||||
|
/* we have nothing more to parse, drop out of the loop */
|
||||||
|
next_num = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for a button to lock if we have a meta button */
|
||||||
|
if (meta_button != 0 && next_num != NULL ) {
|
||||||
|
lock_button = strtol(next_num, &end_str, 10);
|
||||||
|
|
||||||
|
/* check to see if we found anything */
|
||||||
|
if (next_num != end_str) {
|
||||||
|
/* setup for the next number */
|
||||||
|
next_num = end_str;
|
||||||
|
} else {
|
||||||
|
/* we have nothing more to parse, drop out of the loop */
|
||||||
|
next_num = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Ok, let the user know what we found on this look */
|
||||||
|
if (meta_button != 0) {
|
||||||
|
if (lock_button == 0) {
|
||||||
|
if (!pairs) {
|
||||||
|
/* We only have a meta button */
|
||||||
|
pEvdev->dragLock.meta = meta_button;
|
||||||
|
|
||||||
|
xf86Msg(X_CONFIG, "%s: DragLockButtons : "
|
||||||
|
"%i as meta\n",
|
||||||
|
pInfo->name, meta_button);
|
||||||
|
} else {
|
||||||
|
xf86Msg(X_ERROR, "%s: DragLockButtons : "
|
||||||
|
"Incomplete pair specifying button pairs %s\n",
|
||||||
|
pInfo->name, option_string);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
/* Do bounds checking to make sure we don't crash */
|
||||||
|
if ((meta_button <= EVDEV_MAXBUTTONS) && (meta_button >= 0 ) &&
|
||||||
|
(lock_button <= EVDEV_MAXBUTTONS) && (lock_button >= 0)) {
|
||||||
|
|
||||||
|
xf86Msg(X_CONFIG, "%s: DragLockButtons : %i -> %i\n",
|
||||||
|
pInfo->name, meta_button, lock_button);
|
||||||
|
|
||||||
|
pEvdev->dragLock.lock_pair[meta_button - 1] = lock_button;
|
||||||
|
pairs=TRUE;
|
||||||
|
} else {
|
||||||
|
/* Let the user know something was wrong
|
||||||
|
with this pair of buttons */
|
||||||
|
xf86Msg(X_CONFIG, "%s: DragLockButtons : "
|
||||||
|
"Invalid button pair %i -> %i\n",
|
||||||
|
pInfo->name, meta_button, lock_button);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
xf86Msg(X_ERROR, "%s: Found DragLockButtons "
|
||||||
|
"with invalid lock button string : '%s'\n",
|
||||||
|
pInfo->name, option_string);
|
||||||
|
|
||||||
|
/* This should be the case anyhow, just make sure */
|
||||||
|
next_num = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check for end of string, to avoid annoying error */
|
||||||
|
if (next_num != NULL && *next_num == '\0')
|
||||||
|
next_num = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Updates DragLock button state and fires button event messges */
|
||||||
|
void
|
||||||
|
EvdevDragLockLockButton(InputInfoPtr pInfo, unsigned int button)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
|
BOOL state = 0;
|
||||||
|
|
||||||
|
/* update button state */
|
||||||
|
state = pEvdev->dragLock.lock_state[button - 1] ? FALSE : TRUE;
|
||||||
|
pEvdev->dragLock.lock_state[button - 1] = state;
|
||||||
|
|
||||||
|
EvdevQueueButtonEvent(pInfo, button, state);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Filter button presses looking for either a meta button or the
|
||||||
|
* control of a button pair.
|
||||||
|
*
|
||||||
|
* @param button button number (1 for left, 3 for right)
|
||||||
|
* @param value TRUE if button press, FALSE if release
|
||||||
|
*
|
||||||
|
* @return TRUE if the event was swallowed here, FALSE otherwise.
|
||||||
|
*/
|
||||||
|
BOOL
|
||||||
|
EvdevDragLockFilterEvent(InputInfoPtr pInfo, unsigned int button, int value)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
|
|
||||||
|
if (button == 0)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
/* Do we have a single meta key or
|
||||||
|
several button pairings? */
|
||||||
|
if (pEvdev->dragLock.meta != 0) {
|
||||||
|
|
||||||
|
if (pEvdev->dragLock.meta == button) {
|
||||||
|
|
||||||
|
/* setup up for button lock */
|
||||||
|
if (value)
|
||||||
|
pEvdev->dragLock.meta_state = TRUE;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
} else if (pEvdev->dragLock.meta_state) { /* waiting to lock */
|
||||||
|
|
||||||
|
pEvdev->dragLock.meta_state = FALSE;
|
||||||
|
|
||||||
|
EvdevDragLockLockButton(pInfo, button);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
} else if (pEvdev->dragLock.lock_pair[button - 1] && value) {
|
||||||
|
/* A meta button in a meta/lock pair was pressed */
|
||||||
|
EvdevDragLockLockButton(pInfo, pEvdev->dragLock.lock_pair[button - 1]);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Eat events for buttons that are locked */
|
||||||
|
if (pEvdev->dragLock.lock_state[button - 1])
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#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 if ((val->size % 2) == 0)
|
||||||
|
{
|
||||||
|
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 += 2)
|
||||||
|
pEvdev->dragLock.lock_pair[vals[i] - 1] = vals[i + 1];
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
return BadMatch;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialise property for drag lock buttons setting.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
EvdevDragLockInitProperty(DeviceIntPtr dev)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
|
||||||
|
if (!dev->button) /* don't init prop for keyboards */
|
||||||
|
return;
|
||||||
|
|
||||||
|
prop_dlock = MakeAtom(EVDEV_PROP_DRAGLOCK, strlen(EVDEV_PROP_DRAGLOCK), TRUE);
|
||||||
|
if (pEvdev->dragLock.meta)
|
||||||
|
{
|
||||||
|
XIChangeDeviceProperty(dev, prop_dlock, XA_INTEGER, 8,
|
||||||
|
PropModeReplace, 1, &pEvdev->dragLock.meta,
|
||||||
|
FALSE);
|
||||||
|
} else {
|
||||||
|
int highest = 0;
|
||||||
|
int i;
|
||||||
|
CARD8 pair[EVDEV_MAXBUTTONS] = {0};
|
||||||
|
|
||||||
|
for (i = 0; i < EVDEV_MAXBUTTONS; i++)
|
||||||
|
{
|
||||||
|
if (pEvdev->dragLock.lock_pair[i])
|
||||||
|
highest = i;
|
||||||
|
pair[i] = pEvdev->dragLock.lock_pair[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
XIChangeDeviceProperty(dev, prop_dlock, XA_INTEGER, 8, PropModeReplace,
|
||||||
|
highest + 1, pair, FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_dlock, FALSE);
|
||||||
|
|
||||||
|
XIRegisterPropertyHandler(dev, EvdevDragLockSetProperty, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
119
src/emuMB.c
119
src/emuMB.c
@@ -11,11 +11,11 @@
|
|||||||
* and its documentation for any purpose is hereby granted without
|
* and its documentation for any purpose is hereby granted without
|
||||||
* fee, provided that the above copyright notice appear in all copies
|
* fee, provided that the above copyright notice appear in all copies
|
||||||
* and that both that copyright notice and this permission notice
|
* and that both that copyright notice and this permission notice
|
||||||
* appear in supporting documentation, and that the name of Red Hat
|
* appear in supporting documentation, and that the name of the authors
|
||||||
* not be used in advertising or publicity pertaining to distribution
|
* not be used in advertising or publicity pertaining to distribution of the
|
||||||
* of the software without specific, written prior permission. Red
|
* software without specific, written prior permission. The authors make no
|
||||||
* Hat makes no representations about the suitability of this software
|
* representations about the suitability of this software for any
|
||||||
* for any purpose. It is provided "as is" without express or implied
|
* purpose. It is provided "as is" without express or implied
|
||||||
* warranty.
|
* warranty.
|
||||||
*
|
*
|
||||||
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||||
@@ -34,8 +34,12 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <X11/Xatom.h>
|
||||||
#include <xf86.h>
|
#include <xf86.h>
|
||||||
|
#include <xf86Xinput.h>
|
||||||
|
#include <exevents.h>
|
||||||
|
|
||||||
|
#include <evdev-properties.h>
|
||||||
#include "evdev.h"
|
#include "evdev.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
@@ -44,6 +48,10 @@ enum {
|
|||||||
MBEMU_AUTO
|
MBEMU_AUTO
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifdef HAVE_PROPERTIES
|
||||||
|
static Atom prop_mbemu = 0; /* Middle button emulation on/off property */
|
||||||
|
static Atom prop_mbtimeout = 0; /* Middle button timeout property */
|
||||||
|
#endif
|
||||||
/*
|
/*
|
||||||
* Lets create a simple finite-state machine for 3 button emulation:
|
* Lets create a simple finite-state machine for 3 button emulation:
|
||||||
*
|
*
|
||||||
@@ -190,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 {
|
||||||
@@ -206,14 +214,14 @@ EvdevMBEmuTimer(InputInfoPtr pInfo)
|
|||||||
/**
|
/**
|
||||||
* Emulate a middle button on button press.
|
* Emulate a middle button on button press.
|
||||||
*
|
*
|
||||||
* @param code Evdev event code (BTN_LEFT or BTN_RIGHT)
|
* @param code button number (1 for left, 3 for right)
|
||||||
* @param press TRUE if press, FALSE if release.
|
* @param press TRUE if press, FALSE if release.
|
||||||
*
|
*
|
||||||
* @return TRUE if event was swallowed by middle mouse button emulation, FALSE
|
* @return TRUE if event was swallowed by middle mouse button emulation, FALSE
|
||||||
* otherwise.
|
* otherwise.
|
||||||
*/
|
*/
|
||||||
BOOL
|
BOOL
|
||||||
EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int code, BOOL press)
|
EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
|
||||||
{
|
{
|
||||||
EvdevPtr pEvdev = pInfo->private;
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
int id;
|
int id;
|
||||||
@@ -223,24 +231,29 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int code, 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 (code != BTN_LEFT && code != BTN_RIGHT)
|
if (button != 1 && button != 3)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
btstate = &pEvdev->emulateMB.buttonstate;
|
btstate = &pEvdev->emulateMB.buttonstate;
|
||||||
if (press)
|
if (press)
|
||||||
*btstate |= (code == BTN_LEFT) ? 0x1 : 0x2;
|
*btstate |= (button == 1) ? 0x1 : 0x2;
|
||||||
else
|
else
|
||||||
*btstate &= (code == BTN_LEFT) ? ~0x1 : ~0x2;
|
*btstate &= (button == 1) ? ~0x1 : ~0x2;
|
||||||
|
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -303,21 +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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
||||||
@@ -332,3 +355,67 @@ EvdevMBEmuEnable(InputInfoPtr pInfo, BOOL enable)
|
|||||||
if (pEvdev->emulateMB.enabled == MBEMU_AUTO)
|
if (pEvdev->emulateMB.enabled == MBEMU_AUTO)
|
||||||
pEvdev->emulateMB.enabled = enable;
|
pEvdev->emulateMB.enabled = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#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.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
EvdevMBEmuInitProperty(DeviceIntPtr dev)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
if (!dev->button) /* don't init prop for keyboards */
|
||||||
|
return;
|
||||||
|
|
||||||
|
prop_mbemu = MakeAtom(EVDEV_PROP_MIDBUTTON, strlen(EVDEV_PROP_MIDBUTTON), TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_mbemu, XA_INTEGER, 8,
|
||||||
|
PropModeReplace, 1,
|
||||||
|
&pEvdev->emulateMB.enabled,
|
||||||
|
FALSE);
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_mbemu, FALSE);
|
||||||
|
|
||||||
|
prop_mbtimeout = MakeAtom(EVDEV_PROP_MIDBUTTON_TIMEOUT,
|
||||||
|
strlen(EVDEV_PROP_MIDBUTTON_TIMEOUT),
|
||||||
|
TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_mbtimeout, XA_INTEGER, 32, PropModeReplace, 1,
|
||||||
|
&pEvdev->emulateMB.timeout, FALSE);
|
||||||
|
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_mbtimeout, FALSE);
|
||||||
|
|
||||||
|
XIRegisterPropertyHandler(dev, EvdevMBEmuSetProperty, NULL, NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|||||||
478
src/emuWheel.c
Normal file
478
src/emuWheel.c
Normal file
@@ -0,0 +1,478 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
|
||||||
|
* Copyright 1993 by David Dawes <dawes@xfree86.org>
|
||||||
|
* Copyright 2002 by SuSE Linux AG, Author: Egbert Eich
|
||||||
|
* Copyright 1994-2002 by The XFree86 Project, Inc.
|
||||||
|
* Copyright 2002 by Paul Elliott
|
||||||
|
* (Ported from xf86-input-mouse, above copyrights taken from there)
|
||||||
|
* Copyright 2008 by Chris Salch
|
||||||
|
* Copyright © 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 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.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Mouse wheel emulation code. */
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <X11/Xatom.h>
|
||||||
|
#include <xf86.h>
|
||||||
|
#include <xf86Xinput.h>
|
||||||
|
#include <exevents.h>
|
||||||
|
|
||||||
|
#include <evdev-properties.h>
|
||||||
|
#include "evdev.h"
|
||||||
|
|
||||||
|
#define WHEEL_NOT_CONFIGURED 0
|
||||||
|
|
||||||
|
#ifdef HAVE_PROPERTIES
|
||||||
|
static Atom prop_wheel_emu = 0;
|
||||||
|
static Atom prop_wheel_axismap = 0;
|
||||||
|
static Atom prop_wheel_inertia = 0;
|
||||||
|
static Atom prop_wheel_timeout = 0;
|
||||||
|
static Atom prop_wheel_button = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Local Funciton Prototypes */
|
||||||
|
static BOOL EvdevWheelEmuHandleButtonMap(InputInfoPtr pInfo, WheelAxisPtr pAxis, char *axis_name);
|
||||||
|
static int EvdevWheelEmuInertia(InputInfoPtr pInfo, WheelAxisPtr axis, int value);
|
||||||
|
|
||||||
|
/* Filter mouse button events */
|
||||||
|
BOOL
|
||||||
|
EvdevWheelEmuFilterButton(InputInfoPtr pInfo, unsigned int button, int value)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
|
int ms;
|
||||||
|
|
||||||
|
/* Has wheel emulation been configured to be enabled? */
|
||||||
|
if (!pEvdev->emulateWheel.enabled)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
/* Check for EmulateWheelButton */
|
||||||
|
if (pEvdev->emulateWheel.button == button) {
|
||||||
|
pEvdev->emulateWheel.button_state = value;
|
||||||
|
|
||||||
|
if (value)
|
||||||
|
/* Start the timer when the button is pressed */
|
||||||
|
pEvdev->emulateWheel.expires = pEvdev->emulateWheel.timeout +
|
||||||
|
GetTimeInMillis();
|
||||||
|
else {
|
||||||
|
ms = pEvdev->emulateWheel.expires - GetTimeInMillis();
|
||||||
|
if (ms > 0) {
|
||||||
|
/*
|
||||||
|
* If the button is released early enough emit the button
|
||||||
|
* press/release events
|
||||||
|
*/
|
||||||
|
EvdevQueueButtonClicks(pInfo, button, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Don't care about this event */
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Filter mouse wheel events */
|
||||||
|
BOOL
|
||||||
|
EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
|
WheelAxisPtr pAxis = NULL, pOtherAxis = NULL;
|
||||||
|
int value = pEv->value;
|
||||||
|
|
||||||
|
/* Has wheel emulation been configured to be enabled? */
|
||||||
|
if (!pEvdev->emulateWheel.enabled)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
/* Handle our motion events if the emuWheel button is pressed
|
||||||
|
* 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 */
|
||||||
|
if (pEvdev->emulateWheel.button)
|
||||||
|
{
|
||||||
|
int ms = pEvdev->emulateWheel.expires - GetTimeInMillis();
|
||||||
|
if (ms > 0)
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* We don't want to intercept real mouse wheel events */
|
||||||
|
switch(pEv->code) {
|
||||||
|
case REL_X:
|
||||||
|
pAxis = &(pEvdev->emulateWheel.X);
|
||||||
|
pOtherAxis = &(pEvdev->emulateWheel.Y);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case REL_Y:
|
||||||
|
pAxis = &(pEvdev->emulateWheel.Y);
|
||||||
|
pOtherAxis = &(pEvdev->emulateWheel.X);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 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 (EvdevWheelEmuInertia(pInfo, pAxis, value))
|
||||||
|
pOtherAxis->traveled_distance = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Eat motion events while emulateWheel button pressed. */
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Simulate inertia for our emulated mouse wheel.
|
||||||
|
Returns the number of wheel events generated.
|
||||||
|
*/
|
||||||
|
static int
|
||||||
|
EvdevWheelEmuInertia(InputInfoPtr pInfo, WheelAxisPtr axis, int value)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
|
int button;
|
||||||
|
int inertia;
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
|
/* if this axis has not been configured, just eat the motion */
|
||||||
|
if (!axis->up_button)
|
||||||
|
return rc;
|
||||||
|
|
||||||
|
axis->traveled_distance += value;
|
||||||
|
|
||||||
|
if (axis->traveled_distance < 0) {
|
||||||
|
button = axis->up_button;
|
||||||
|
inertia = -pEvdev->emulateWheel.inertia;
|
||||||
|
} else {
|
||||||
|
button = axis->down_button;
|
||||||
|
inertia = pEvdev->emulateWheel.inertia;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Produce button press events for wheel motion */
|
||||||
|
while(abs(axis->traveled_distance) > pEvdev->emulateWheel.inertia) {
|
||||||
|
axis->traveled_distance -= inertia;
|
||||||
|
EvdevQueueButtonClicks(pInfo, button, 1);
|
||||||
|
rc++;
|
||||||
|
}
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Handle button mapping here to avoid code duplication,
|
||||||
|
returns true if a button mapping was found. */
|
||||||
|
static BOOL
|
||||||
|
EvdevWheelEmuHandleButtonMap(InputInfoPtr pInfo, WheelAxisPtr pAxis, char* axis_name)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
|
char *option_string;
|
||||||
|
|
||||||
|
pAxis->up_button = WHEEL_NOT_CONFIGURED;
|
||||||
|
|
||||||
|
/* Check to see if there is configuration for this axis */
|
||||||
|
option_string = xf86SetStrOption(pInfo->options, axis_name, NULL);
|
||||||
|
if (option_string) {
|
||||||
|
int up_button = 0;
|
||||||
|
int down_button = 0;
|
||||||
|
char *msg = NULL;
|
||||||
|
|
||||||
|
if ((sscanf(option_string, "%d %d", &up_button, &down_button) == 2) &&
|
||||||
|
((up_button > 0) && (up_button <= EVDEV_MAXBUTTONS)) &&
|
||||||
|
((down_button > 0) && (down_button <= EVDEV_MAXBUTTONS))) {
|
||||||
|
|
||||||
|
/* Use xstrdup to allocate a string for us */
|
||||||
|
msg = xstrdup("buttons XX and YY");
|
||||||
|
|
||||||
|
if (msg)
|
||||||
|
sprintf(msg, "buttons %d and %d", up_button, down_button);
|
||||||
|
|
||||||
|
pAxis->up_button = up_button;
|
||||||
|
pAxis->down_button = down_button;
|
||||||
|
|
||||||
|
/* Update the number of buttons if needed */
|
||||||
|
if (up_button > pEvdev->num_buttons) pEvdev->num_buttons = up_button;
|
||||||
|
if (down_button > pEvdev->num_buttons) pEvdev->num_buttons = down_button;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
xf86Msg(X_WARNING, "%s: Invalid %s value:\"%s\"\n",
|
||||||
|
pInfo->name, axis_name, option_string);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Clean up and log what happened */
|
||||||
|
if (msg) {
|
||||||
|
xf86Msg(X_CONFIG, "%s: %s: %s\n",pInfo->name, axis_name, msg);
|
||||||
|
xfree(msg);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Setup the basic configuration options used by mouse wheel emulation */
|
||||||
|
void
|
||||||
|
EvdevWheelEmuPreInit(InputInfoPtr pInfo)
|
||||||
|
{
|
||||||
|
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||||
|
char val[4];
|
||||||
|
int wheelButton;
|
||||||
|
int inertia;
|
||||||
|
int timeout;
|
||||||
|
|
||||||
|
val[0] = 0;
|
||||||
|
val[1] = 0;
|
||||||
|
|
||||||
|
if (xf86SetBoolOption(pInfo->options, "EmulateWheel", FALSE)) {
|
||||||
|
pEvdev->emulateWheel.enabled = TRUE;
|
||||||
|
} else
|
||||||
|
pEvdev->emulateWheel.enabled = FALSE;
|
||||||
|
|
||||||
|
wheelButton = xf86SetIntOption(pInfo->options, "EmulateWheelButton", 4);
|
||||||
|
|
||||||
|
if ((wheelButton < 0) || (wheelButton > EVDEV_MAXBUTTONS)) {
|
||||||
|
xf86Msg(X_WARNING, "%s: Invalid EmulateWheelButton value: %d\n",
|
||||||
|
pInfo->name, wheelButton);
|
||||||
|
xf86Msg(X_WARNING, "%s: Wheel emulation disabled.\n", pInfo->name);
|
||||||
|
|
||||||
|
pEvdev->emulateWheel.enabled = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
pEvdev->emulateWheel.button = wheelButton;
|
||||||
|
|
||||||
|
inertia = xf86SetIntOption(pInfo->options, "EmulateWheelInertia", 10);
|
||||||
|
|
||||||
|
if (inertia <= 0) {
|
||||||
|
xf86Msg(X_WARNING, "%s: Invalid EmulateWheelInertia value: %d\n",
|
||||||
|
pInfo->name, inertia);
|
||||||
|
xf86Msg(X_WARNING, "%s: Using built-in inertia value.\n",
|
||||||
|
pInfo->name);
|
||||||
|
|
||||||
|
inertia = 10;
|
||||||
|
}
|
||||||
|
|
||||||
|
pEvdev->emulateWheel.inertia = inertia;
|
||||||
|
|
||||||
|
timeout = xf86SetIntOption(pInfo->options, "EmulateWheelTimeout", 200);
|
||||||
|
|
||||||
|
if (timeout < 0) {
|
||||||
|
xf86Msg(X_WARNING, "%s: Invalid EmulateWheelTimeout value: %d\n",
|
||||||
|
pInfo->name, timeout);
|
||||||
|
xf86Msg(X_WARNING, "%s: Using built-in timeout value.\n",
|
||||||
|
pInfo->name);
|
||||||
|
|
||||||
|
timeout = 200;
|
||||||
|
}
|
||||||
|
|
||||||
|
pEvdev->emulateWheel.timeout = timeout;
|
||||||
|
|
||||||
|
/* Configure the Y axis or default it */
|
||||||
|
if (!EvdevWheelEmuHandleButtonMap(pInfo, &(pEvdev->emulateWheel.Y),
|
||||||
|
"YAxisMapping")) {
|
||||||
|
/* Default the Y axis to sane values */
|
||||||
|
pEvdev->emulateWheel.Y.up_button = 4;
|
||||||
|
pEvdev->emulateWheel.Y.down_button = 5;
|
||||||
|
|
||||||
|
/* Simpler to check just the largest value in this case */
|
||||||
|
/* XXX: we should post this to the server */
|
||||||
|
if (5 > pEvdev->num_buttons)
|
||||||
|
pEvdev->num_buttons = 5;
|
||||||
|
|
||||||
|
/* Display default Configuration */
|
||||||
|
xf86Msg(X_CONFIG, "%s: YAxisMapping: buttons %d and %d\n",
|
||||||
|
pInfo->name, pEvdev->emulateWheel.Y.up_button,
|
||||||
|
pEvdev->emulateWheel.Y.down_button);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* This axis should default to an unconfigured state as most people
|
||||||
|
are not going to expect a Horizontal wheel. */
|
||||||
|
EvdevWheelEmuHandleButtonMap(pInfo, &(pEvdev->emulateWheel.X),
|
||||||
|
"XAxisMapping");
|
||||||
|
|
||||||
|
/* Used by the inertia code */
|
||||||
|
pEvdev->emulateWheel.X.traveled_distance = 0;
|
||||||
|
pEvdev->emulateWheel.Y.traveled_distance = 0;
|
||||||
|
|
||||||
|
xf86Msg(X_CONFIG, "%s: EmulateWheelButton: %d, "
|
||||||
|
"EmulateWheelInertia: %d, "
|
||||||
|
"EmulateWheelTimeout: %d\n",
|
||||||
|
pInfo->name, pEvdev->emulateWheel.button, inertia, timeout);
|
||||||
|
}
|
||||||
|
|
||||||
|
#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
|
||||||
|
EvdevWheelEmuInitProperty(DeviceIntPtr dev)
|
||||||
|
{
|
||||||
|
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||||
|
EvdevPtr pEvdev = pInfo->private;
|
||||||
|
int rc = TRUE;
|
||||||
|
char vals[4];
|
||||||
|
|
||||||
|
if (!dev->button) /* don't init prop for keyboards */
|
||||||
|
return;
|
||||||
|
|
||||||
|
prop_wheel_emu = MakeAtom(EVDEV_PROP_WHEEL, strlen(EVDEV_PROP_WHEEL), TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_wheel_emu, XA_INTEGER, 8,
|
||||||
|
PropModeReplace, 1,
|
||||||
|
&pEvdev->emulateWheel.enabled, FALSE);
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_wheel_emu, FALSE);
|
||||||
|
|
||||||
|
vals[0] = pEvdev->emulateWheel.X.up_button;
|
||||||
|
vals[1] = pEvdev->emulateWheel.X.down_button;
|
||||||
|
vals[2] = pEvdev->emulateWheel.Y.up_button;
|
||||||
|
vals[3] = pEvdev->emulateWheel.Y.down_button;
|
||||||
|
|
||||||
|
prop_wheel_axismap = MakeAtom(EVDEV_PROP_WHEEL_AXES, strlen(EVDEV_PROP_WHEEL_AXES), TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_wheel_axismap, XA_INTEGER, 8,
|
||||||
|
PropModeReplace, 4, vals, FALSE);
|
||||||
|
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_wheel_axismap, FALSE);
|
||||||
|
|
||||||
|
prop_wheel_inertia = MakeAtom(EVDEV_PROP_WHEEL_INERTIA, strlen(EVDEV_PROP_WHEEL_INERTIA), TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_wheel_inertia, XA_INTEGER, 16,
|
||||||
|
PropModeReplace, 1,
|
||||||
|
&pEvdev->emulateWheel.inertia, FALSE);
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_wheel_inertia, FALSE);
|
||||||
|
|
||||||
|
prop_wheel_timeout = MakeAtom(EVDEV_PROP_WHEEL_TIMEOUT, strlen(EVDEV_PROP_WHEEL_TIMEOUT), TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_wheel_timeout, XA_INTEGER, 16,
|
||||||
|
PropModeReplace, 1,
|
||||||
|
&pEvdev->emulateWheel.timeout, FALSE);
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_wheel_timeout, FALSE);
|
||||||
|
|
||||||
|
prop_wheel_button = MakeAtom(EVDEV_PROP_WHEEL_BUTTON, strlen(EVDEV_PROP_WHEEL_BUTTON), TRUE);
|
||||||
|
rc = XIChangeDeviceProperty(dev, prop_wheel_button, XA_INTEGER, 8,
|
||||||
|
PropModeReplace, 1,
|
||||||
|
&pEvdev->emulateWheel.button, FALSE);
|
||||||
|
if (rc != Success)
|
||||||
|
return;
|
||||||
|
|
||||||
|
XISetDevicePropertyDeletable(dev, prop_wheel_button, FALSE);
|
||||||
|
|
||||||
|
XIRegisterPropertyHandler(dev, EvdevWheelEmuSetProperty, NULL, NULL);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
2328
src/evdev.c
2328
src/evdev.c
File diff suppressed because it is too large
Load Diff
165
src/evdev.h
165
src/evdev.h
@@ -25,39 +25,105 @@
|
|||||||
* 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
|
#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
|
||||||
|
|
||||||
|
#define EVDEV_MAXBUTTONS 32
|
||||||
|
#define EVDEV_MAXQUEUE 32
|
||||||
|
|
||||||
|
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 3
|
||||||
|
#define HAVE_PROPERTIES 1
|
||||||
|
#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)
|
||||||
|
|
||||||
|
/* 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 */
|
||||||
|
typedef struct {
|
||||||
|
int up_button;
|
||||||
|
int down_button;
|
||||||
|
int traveled_distance;
|
||||||
|
} 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 {
|
||||||
int kernel24;
|
const char *device;
|
||||||
int screen;
|
int grabDevice; /* grab the event device? */
|
||||||
int min_x, min_y, max_x, max_y;
|
|
||||||
int abs_x, abs_y, old_x, old_y;
|
int num_vals; /* number of valuators */
|
||||||
|
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 num_buttons; /* number of buttons */
|
||||||
|
BOOL swap_axes;
|
||||||
|
BOOL invert_x;
|
||||||
|
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;
|
||||||
@@ -67,15 +133,86 @@ typedef struct {
|
|||||||
Time expires; /* time of expiry */
|
Time expires; /* time of expiry */
|
||||||
Time timeout;
|
Time timeout;
|
||||||
} emulateMB;
|
} emulateMB;
|
||||||
|
struct {
|
||||||
|
int meta; /* meta key to lock any button */
|
||||||
|
BOOL meta_state; /* meta_button state */
|
||||||
|
unsigned int lock_pair[EVDEV_MAXBUTTONS]; /* specify a meta/lock pair */
|
||||||
|
BOOL lock_state[EVDEV_MAXBUTTONS]; /* state of any locked buttons */
|
||||||
|
} dragLock;
|
||||||
|
struct {
|
||||||
|
BOOL enabled;
|
||||||
|
int button;
|
||||||
|
int button_state;
|
||||||
|
int inertia;
|
||||||
|
WheelAxis X;
|
||||||
|
WheelAxis Y;
|
||||||
|
Time expires; /* time of expiry */
|
||||||
|
Time timeout;
|
||||||
|
} 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 */
|
||||||
|
|
||||||
|
int reopen_attempts; /* max attempts to re-open after read failure */
|
||||||
|
int reopen_left; /* number of attempts left to re-open the device */
|
||||||
|
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 */
|
||||||
|
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);
|
||||||
|
|
||||||
|
/* Mouse Wheel emulation */
|
||||||
|
void EvdevWheelEmuPreInit(InputInfoPtr pInfo);
|
||||||
|
BOOL EvdevWheelEmuFilterButton(InputInfoPtr pInfo, unsigned int button, int value);
|
||||||
|
BOOL EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv);
|
||||||
|
|
||||||
|
/* Draglock code */
|
||||||
|
void EvdevDragLockPreInit(InputInfoPtr pInfo);
|
||||||
|
BOOL EvdevDragLockFilterEvent(InputInfoPtr pInfo, unsigned int button, int value);
|
||||||
|
|
||||||
|
#ifdef HAVE_PROPERTIES
|
||||||
|
void EvdevMBEmuInitProperty(DeviceIntPtr);
|
||||||
|
void EvdevWheelEmuInitProperty(DeviceIntPtr);
|
||||||
|
void EvdevDragLockInitProperty(DeviceIntPtr);
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
6
xorg-evdev.pc.in
Normal file
6
xorg-evdev.pc.in
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
sdkdir=@sdkdir@
|
||||||
|
|
||||||
|
Name: xorg-evdev
|
||||||
|
Description: X.Org evdev input driver.
|
||||||
|
Version: @PACKAGE_VERSION@
|
||||||
|
Cflags: -I${sdkdir}
|
||||||
Reference in New Issue
Block a user