mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Compare commits
17 Commits
xf86-input
...
xf86-input
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
777cfa148f | ||
|
|
447fd220e0 | ||
|
|
f2c6da0242 | ||
|
|
9791afc4c1 | ||
|
|
f1ee12b9a3 | ||
|
|
74690817fc | ||
|
|
b2cbbb178e | ||
|
|
7d91fc7bfc | ||
|
|
09987eab9a | ||
|
|
8af0e6f1eb | ||
|
|
56e9a7a248 | ||
|
|
7df6523774 | ||
|
|
f4e76a4c53 | ||
|
|
ac772cde94 | ||
|
|
7749159241 | ||
|
|
833fc517d7 | ||
|
|
4d698d8ece |
106
.gitlab-ci.yml
106
.gitlab-ci.yml
@@ -1,106 +0,0 @@
|
||||
# vim: set expandtab shiftwidth=2 tabstop=8 textwidth=0 filetype=yaml:
|
||||
#
|
||||
# This CI uses the freedesktop.org ci-templates.
|
||||
# Please see the ci-templates documentation for details:
|
||||
# https://freedesktop.pages.freedesktop.org/ci-templates/
|
||||
|
||||
.templates_sha: &template_sha 25e8e9f020880aa35fffe3d6b259b933f0f9449f # see https://docs.gitlab.com/ee/ci/yaml/#includefile
|
||||
|
||||
|
||||
include:
|
||||
# Arch container builder template
|
||||
- project: 'freedesktop/ci-templates'
|
||||
ref: *template_sha
|
||||
file: '/templates/arch.yml'
|
||||
- project: 'freedesktop/ci-templates'
|
||||
ref: *template_sha
|
||||
file: '/templates/ci-fairy.yml'
|
||||
- template: Security/SAST.gitlab-ci.yml
|
||||
|
||||
|
||||
workflow:
|
||||
rules:
|
||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||
- if: $CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS
|
||||
when: never
|
||||
- if: $CI_COMMIT_BRANCH
|
||||
|
||||
|
||||
stages:
|
||||
- prep # prep work like rebuilding the container images if there is a change
|
||||
- build # for actually building and testing things in a container
|
||||
- test
|
||||
- deploy
|
||||
|
||||
|
||||
variables:
|
||||
FDO_UPSTREAM_REPO: 'xorg/driver/xf86-input-evdev'
|
||||
# The tag should be updated each time the list of packages is updated.
|
||||
# Changing a tag forces the associated image to be rebuilt.
|
||||
# Note: the tag has no meaning, we use a date format purely for readability
|
||||
FDO_DISTRIBUTION_TAG: '2023-10-01.0'
|
||||
FDO_DISTRIBUTION_PACKAGES: 'git gcc pkgconf autoconf automake libtool make xorg-util-macros xorgproto xorg-server-devel pixman systemd-libs libevdev mtdev'
|
||||
|
||||
|
||||
#
|
||||
# Verify that commit messages are as expected
|
||||
#
|
||||
check-commits:
|
||||
extends:
|
||||
- .fdo.ci-fairy
|
||||
stage: prep
|
||||
script:
|
||||
- ci-fairy check-commits --junit-xml=results.xml
|
||||
except:
|
||||
- master@xorg/driver/xf86-input-evdev
|
||||
variables:
|
||||
GIT_DEPTH: 100
|
||||
artifacts:
|
||||
reports:
|
||||
junit: results.xml
|
||||
|
||||
#
|
||||
# Verify that the merge request has the allow-collaboration checkbox ticked
|
||||
#
|
||||
check-merge-request:
|
||||
extends:
|
||||
- .fdo.ci-fairy
|
||||
stage: deploy
|
||||
script:
|
||||
- ci-fairy check-merge-request --require-allow-collaboration --junit-xml=results.xml
|
||||
artifacts:
|
||||
when: on_failure
|
||||
reports:
|
||||
junit: results.xml
|
||||
allow_failure: true
|
||||
|
||||
|
||||
#
|
||||
# Build a container with the given tag and the packages pre-installed.
|
||||
# This only happens if the tag changes, otherwise the existing image is
|
||||
# re-used.
|
||||
#
|
||||
container-prep:
|
||||
extends:
|
||||
- .fdo.container-build@arch
|
||||
stage: prep
|
||||
variables:
|
||||
GIT_STRATEGY: none
|
||||
|
||||
|
||||
#
|
||||
# The default build, runs on the image built above.
|
||||
#
|
||||
build:
|
||||
stage: build
|
||||
extends:
|
||||
- .fdo.distribution-image@arch
|
||||
script:
|
||||
- autoreconf -ivf
|
||||
- mkdir _builddir
|
||||
- pushd _builddir > /dev/null
|
||||
- ../configure --disable-silent-rules
|
||||
- make
|
||||
- make check
|
||||
- make distcheck
|
||||
- popd > /dev/null
|
||||
@@ -1,40 +0,0 @@
|
||||
#
|
||||
# Catch-all evdev loader for udev-based systems
|
||||
# We don't simply match on any device since that also adds accelerometers
|
||||
# and other devices that we don't really want to use. The list below
|
||||
# matches everything but joysticks.
|
||||
|
||||
Section "InputClass"
|
||||
Identifier "evdev pointer catchall"
|
||||
MatchIsPointer "on"
|
||||
MatchDevicePath "/dev/input/event*"
|
||||
Driver "evdev"
|
||||
EndSection
|
||||
|
||||
Section "InputClass"
|
||||
Identifier "evdev keyboard catchall"
|
||||
MatchIsKeyboard "on"
|
||||
MatchDevicePath "/dev/input/event*"
|
||||
Driver "evdev"
|
||||
EndSection
|
||||
|
||||
Section "InputClass"
|
||||
Identifier "evdev touchpad catchall"
|
||||
MatchIsTouchpad "on"
|
||||
MatchDevicePath "/dev/input/event*"
|
||||
Driver "evdev"
|
||||
EndSection
|
||||
|
||||
Section "InputClass"
|
||||
Identifier "evdev tablet catchall"
|
||||
MatchIsTablet "on"
|
||||
MatchDevicePath "/dev/input/event*"
|
||||
Driver "evdev"
|
||||
EndSection
|
||||
|
||||
Section "InputClass"
|
||||
Identifier "evdev touchscreen catchall"
|
||||
MatchIsTouchscreen "on"
|
||||
MatchDevicePath "/dev/input/event*"
|
||||
Driver "evdev"
|
||||
EndSection
|
||||
@@ -28,7 +28,6 @@ MAINTAINERCLEANFILES = ChangeLog INSTALL
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = xorg-evdev.pc
|
||||
|
||||
dist_xorgconf_DATA = 10-evdev.conf
|
||||
|
||||
.PHONY: ChangeLog INSTALL
|
||||
|
||||
@@ -39,5 +38,3 @@ ChangeLog:
|
||||
$(CHANGELOG_CMD)
|
||||
|
||||
dist-hook: ChangeLog INSTALL
|
||||
|
||||
EXTRA_DIST = README.md
|
||||
|
||||
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
|
||||
18
README.md
18
README.md
@@ -1,18 +0,0 @@
|
||||
xf86-input-evdev - Generic Linux input driver for the Xorg X server
|
||||
-------------------------------------------------------------------
|
||||
|
||||
All questions regarding this software should be directed at the
|
||||
Xorg mailing list:
|
||||
|
||||
https://lists.x.org/mailman/listinfo/xorg
|
||||
|
||||
The primary development code repository can be found at:
|
||||
|
||||
https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev
|
||||
|
||||
Please submit bug reports and requests to merge patches there.
|
||||
|
||||
For patch submission instructions, see:
|
||||
|
||||
https://www.x.org/wiki/Development/Documentation/SubmittingPatches
|
||||
|
||||
13
autogen.sh
13
autogen.sh
@@ -1,17 +1,12 @@
|
||||
#! /bin/sh
|
||||
|
||||
srcdir=`dirname "$0"`
|
||||
srcdir=`dirname $0`
|
||||
test -z "$srcdir" && srcdir=.
|
||||
|
||||
ORIGDIR=`pwd`
|
||||
cd "$srcdir"
|
||||
cd $srcdir
|
||||
|
||||
autoreconf -v --install || exit 1
|
||||
cd "$ORIGDIR" || exit $?
|
||||
cd $ORIGDIR || exit $?
|
||||
|
||||
git config --local --get format.subjectPrefix >/dev/null 2>&1 ||
|
||||
git config --local format.subjectPrefix "PATCH xf86-input-evdev"
|
||||
|
||||
if test -z "$NOCONFIGURE"; then
|
||||
exec "$srcdir"/configure "$@"
|
||||
fi
|
||||
$srcdir/configure --enable-maintainer-mode "$@"
|
||||
|
||||
29
configure.ac
29
configure.ac
@@ -23,15 +23,16 @@
|
||||
# Initialize Autoconf
|
||||
AC_PREREQ([2.60])
|
||||
AC_INIT([xf86-input-evdev],
|
||||
[2.11.0],
|
||||
[https://gitlab.freedesktop.org/xorg/driver/xf86-input-evdev/issues],
|
||||
[2.7.3],
|
||||
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
|
||||
[xf86-input-evdev])
|
||||
AC_CONFIG_SRCDIR([Makefile.am])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
AC_CONFIG_AUX_DIR(.)
|
||||
|
||||
# Initialize Automake
|
||||
AM_INIT_AUTOMAKE([foreign dist-xz])
|
||||
AM_INIT_AUTOMAKE([foreign dist-bzip2])
|
||||
AM_MAINTAINER_MODE
|
||||
|
||||
# Initialize libtool
|
||||
AC_DISABLE_STATIC
|
||||
@@ -44,11 +45,18 @@ XORG_MACROS_VERSION(1.8)
|
||||
XORG_DEFAULT_OPTIONS
|
||||
|
||||
# Obtain compiler/linker options from server and required extensions
|
||||
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.18] xproto [inputproto >= 2.1.99.3])
|
||||
PKG_CHECK_MODULES(UDEV, libudev, [AC_DEFINE(HAVE_LIBUDEV, 1,[libudev support])])
|
||||
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10] xproto inputproto)
|
||||
PKG_CHECK_MODULES(UDEV, libudev)
|
||||
|
||||
PKG_CHECK_MODULES(LIBEVDEV, [libevdev >= 0.4])
|
||||
PKG_CHECK_MODULES(MTDEV, mtdev)
|
||||
PKG_CHECK_MODULES(XI22, [inputproto >= 2.1.99.3] [xorg-server >= 1.11.99.901], HAVE_XI22="yes", HAVE_XI22="no")
|
||||
|
||||
if test "x$HAVE_XI22" = xyes; then
|
||||
# Obtain compiler/linker options for mtdev
|
||||
PKG_CHECK_MODULES(MTDEV, mtdev, HAVE_MTDEV="yes", HAVE_MTDEV="no")
|
||||
fi
|
||||
if test "x$HAVE_XI22" = xyes && test "x$HAVE_MTDEV" = xyes; then
|
||||
AC_DEFINE(MULTITOUCH, 1, [XI2.2 available])
|
||||
fi
|
||||
|
||||
# Define a configure option for an alternate input module directory
|
||||
AC_ARG_WITH(xorg-module-dir,
|
||||
@@ -59,13 +67,6 @@ AC_ARG_WITH(xorg-module-dir,
|
||||
inputdir=${moduledir}/input
|
||||
AC_SUBST(inputdir)
|
||||
|
||||
AC_ARG_WITH(xorg-conf-dir,
|
||||
AC_HELP_STRING([--with-xorg-conf-dir=DIR],
|
||||
[Default xorg.conf.d directory [[default=$prefix/share/X11/xorg.conf.d/]]]),
|
||||
[xorgconfdir="$withval"],
|
||||
[xorgconfdir="$prefix/share/X11/xorg.conf.d"])
|
||||
AC_SUBST(xorgconfdir)
|
||||
|
||||
# X Server SDK location is required to install evdev header files
|
||||
# This location is also relayed in the xorg-evdev.pc file
|
||||
sdkdir=`$PKG_CONFIG --variable=sdkdir xorg-server`
|
||||
|
||||
@@ -33,8 +33,6 @@
|
||||
#define EVDEV_PROP_MIDBUTTON "Evdev Middle Button Emulation"
|
||||
/* CARD32 */
|
||||
#define EVDEV_PROP_MIDBUTTON_TIMEOUT "Evdev Middle Button Timeout"
|
||||
/* CARD8 */
|
||||
#define EVDEV_PROP_MIDBUTTON_BUTTON "Evdev Middle Button Button"
|
||||
|
||||
/* Wheel emulation */
|
||||
/* BOOL */
|
||||
@@ -89,8 +87,4 @@
|
||||
*/
|
||||
#define EVDEV_PROP_FUNCTION_KEYS "Evdev Function Keys"
|
||||
|
||||
/* Smooth scroll */
|
||||
/* INT32, 3 values (vertical, horizontal, dial) */
|
||||
#define EVDEV_PROP_SCROLL_DISTANCE "Evdev Scrolling Distance"
|
||||
|
||||
#endif
|
||||
|
||||
@@ -94,11 +94,6 @@ 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".
|
||||
.TP 7
|
||||
.BI "Option \*qEmulate3Button\*q \*q" integer \*q
|
||||
Specifies the physical button number to be emitted if middle button emulation
|
||||
is triggered.
|
||||
Default: 2. Property: "Evdev Middle Button Button".
|
||||
.TP 7
|
||||
.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
|
||||
@@ -130,19 +125,6 @@ Property: "Evdev Wheel Emulation Button".
|
||||
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".
|
||||
.IP
|
||||
This value must be set for any device does not resemble a standard mouse.
|
||||
Specifically, on absolute devices such as tablets the value should be set to
|
||||
a reasonable fraction of the expected movement to avoid excess scroll events.
|
||||
.IP
|
||||
.B WARNING:
|
||||
the name \*qinertia\*q is a misnomer. This option defines the distance
|
||||
required to generate one scroll event similar to the
|
||||
.B VertScrollDelta
|
||||
and
|
||||
.B HorizScrollDelta
|
||||
options. It does not enable inertia in the
|
||||
physical sense, scrolling stops immediately once the movement has stopped.
|
||||
.TP 7
|
||||
.BI "Option \*qEmulateWheelTimeout\*q \*q" integer \*q
|
||||
Specifies the time in milliseconds the
|
||||
@@ -194,7 +176,7 @@ Invert the given axis. Default: off. Property: "Evdev Axis Inversion".
|
||||
.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
|
||||
which axes to ignore given the device type and disables absolute axes for
|
||||
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
|
||||
@@ -238,30 +220,6 @@ 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".
|
||||
.TP 7
|
||||
.BI "Option \*qTypeName\*q \*q"type"\*q
|
||||
Specify the X Input 1.x type (see XListInputDevices(__libmansuffix__)).
|
||||
There is rarely a need to use this option, evdev will guess the device type
|
||||
based on the device's capabilities. This option is provided for devices that
|
||||
need quirks.
|
||||
.TP 7
|
||||
.BI "Option \*qVertScrollDelta\*q \*q" integer \*q
|
||||
The amount of motion considered one unit of scrolling vertically.
|
||||
Default: "1". Property: "Evdev Scrolling Distance".
|
||||
.TP 7
|
||||
.BI "Option \*qHorizScrollDelta\*q \*q" integer \*q
|
||||
The amount of motion considered one unit of scrolling horizontally.
|
||||
Default: "1". Property: "Evdev Scrolling Distance".
|
||||
.TP 7
|
||||
.BI "Option \*qDialDelta\*q \*q" integer \*q
|
||||
The amount of motion considered one unit of turning the dial. Default: "1".
|
||||
Property: "Evdev Scrolling Distance".
|
||||
.TP 7
|
||||
.BI "Option \*qResolution\*q \*q" integer \*q
|
||||
Sets the resolution of the device in dots per inch. The resolution is used
|
||||
to scale relative motion events from mouse devices to 1000 DPI resolution. This
|
||||
can be used to make high resolution mice less sensitive without turning off
|
||||
acceleration. If set to 0 no scaling will be performed. Default: "0".
|
||||
|
||||
.SH SUPPORTED PROPERTIES
|
||||
The following properties are provided by the
|
||||
@@ -288,9 +246,6 @@ value.
|
||||
.BI "Evdev Middle Button Timeout"
|
||||
1 16-bit positive value.
|
||||
.TP 7
|
||||
.BI "Evdev Middle Button Button"
|
||||
1 8-bit value, allowed range 0-32, 0 disables the button.
|
||||
.TP 7
|
||||
.BI "Evdev Wheel Emulation"
|
||||
1 boolean value (8 bit, 0 or 1).
|
||||
.TP 7
|
||||
@@ -305,9 +260,6 @@ value.
|
||||
.TP 7
|
||||
.BI "Evdev Wheel Emulation Timeout"
|
||||
1 16-bit positive value.
|
||||
.TP 7
|
||||
.BI "Evdev Scrolling Distance"
|
||||
3 32-bit values: vertical, horizontal and dial.
|
||||
|
||||
.SH AUTHORS
|
||||
Kristian Høgsberg, Peter Hutterer
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
# TODO: -nostdlib/-Bstatic/-lgcc platform magic, not installing the .a, etc.
|
||||
|
||||
AM_CFLAGS = $(XORG_CFLAGS) $(CWARNFLAGS)
|
||||
AM_CPPFLAGS =-I$(top_srcdir)/include $(LIBEVDEV_CFLAGS)
|
||||
AM_CPPFLAGS =-I$(top_srcdir)/include
|
||||
|
||||
@DRIVER_NAME@_drv_la_LTLIBRARIES = @DRIVER_NAME@_drv.la
|
||||
@DRIVER_NAME@_drv_la_LDFLAGS = -module -avoid-version
|
||||
@DRIVER_NAME@_drv_la_LIBADD = $(MTDEV_LIBS) $(UDEV_LIBS) $(LIBEVDEV_LIBS)
|
||||
@DRIVER_NAME@_drv_la_LIBADD = $(MTDEV_LIBS) $(UDEV_LIBS)
|
||||
@DRIVER_NAME@_drv_ladir = @inputdir@
|
||||
|
||||
@DRIVER_NAME@_drv_la_SOURCES = @DRIVER_NAME@.c \
|
||||
@@ -39,6 +39,5 @@ AM_CPPFLAGS =-I$(top_srcdir)/include $(LIBEVDEV_CFLAGS)
|
||||
emuThird.c \
|
||||
emuWheel.c \
|
||||
draglock.c \
|
||||
apple.c \
|
||||
axis_labels.h
|
||||
apple.c
|
||||
|
||||
|
||||
@@ -303,8 +303,7 @@ EvdevAppleInitProperty(DeviceIntPtr dev)
|
||||
enum fkeymode fkeymode;
|
||||
|
||||
if (!product_check(apple_keyboard_table,
|
||||
libevdev_get_id_vendor(pEvdev->dev),
|
||||
libevdev_get_id_product(pEvdev->dev)))
|
||||
pEvdev->id_vendor, pEvdev->id_product))
|
||||
return;
|
||||
|
||||
fkeymode = get_fnmode();
|
||||
|
||||
@@ -1,198 +0,0 @@
|
||||
/*
|
||||
* Copyright © 2004-2008 Red Hat, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute, and sell this software
|
||||
* and its documentation for any purpose is hereby granted without
|
||||
* fee, provided that the above copyright notice appear in all copies
|
||||
* and that both that copyright notice and this permission notice
|
||||
* appear in supporting documentation, and that the name of Red Hat
|
||||
* not be used in advertising or publicity pertaining to distribution
|
||||
* of the software without specific, written prior permission. Red
|
||||
* Hat makes no representations about the suitability of this software
|
||||
* for any purpose. It is provided "as is" without express or implied
|
||||
* warranty.
|
||||
*
|
||||
* THE AUTHORS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
|
||||
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
|
||||
* NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
|
||||
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
|
||||
* NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include <xserver-properties.h>
|
||||
|
||||
#ifndef AXIS_LABELS
|
||||
#define AXIS_LABELS
|
||||
|
||||
/* Aligned with linux/input.h.
|
||||
Note that there are holes in the ABS_ range, these are simply replaced with
|
||||
MISC here */
|
||||
static const char* abs_labels[] = {
|
||||
AXIS_LABEL_PROP_ABS_X, /* 0x00 */
|
||||
AXIS_LABEL_PROP_ABS_Y, /* 0x01 */
|
||||
AXIS_LABEL_PROP_ABS_Z, /* 0x02 */
|
||||
AXIS_LABEL_PROP_ABS_RX, /* 0x03 */
|
||||
AXIS_LABEL_PROP_ABS_RY, /* 0x04 */
|
||||
AXIS_LABEL_PROP_ABS_RZ, /* 0x05 */
|
||||
AXIS_LABEL_PROP_ABS_THROTTLE, /* 0x06 */
|
||||
AXIS_LABEL_PROP_ABS_RUDDER, /* 0x07 */
|
||||
AXIS_LABEL_PROP_ABS_WHEEL, /* 0x08 */
|
||||
AXIS_LABEL_PROP_ABS_GAS, /* 0x09 */
|
||||
AXIS_LABEL_PROP_ABS_BRAKE, /* 0x0a */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_HAT0X, /* 0x10 */
|
||||
AXIS_LABEL_PROP_ABS_HAT0Y, /* 0x11 */
|
||||
AXIS_LABEL_PROP_ABS_HAT1X, /* 0x12 */
|
||||
AXIS_LABEL_PROP_ABS_HAT1Y, /* 0x13 */
|
||||
AXIS_LABEL_PROP_ABS_HAT2X, /* 0x14 */
|
||||
AXIS_LABEL_PROP_ABS_HAT2Y, /* 0x15 */
|
||||
AXIS_LABEL_PROP_ABS_HAT3X, /* 0x16 */
|
||||
AXIS_LABEL_PROP_ABS_HAT3Y, /* 0x17 */
|
||||
AXIS_LABEL_PROP_ABS_PRESSURE, /* 0x18 */
|
||||
AXIS_LABEL_PROP_ABS_DISTANCE, /* 0x19 */
|
||||
AXIS_LABEL_PROP_ABS_TILT_X, /* 0x1a */
|
||||
AXIS_LABEL_PROP_ABS_TILT_Y, /* 0x1b */
|
||||
AXIS_LABEL_PROP_ABS_TOOL_WIDTH, /* 0x1c */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_VOLUME /* 0x20 */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MISC, /* undefined */
|
||||
AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR, /* 0x30 */
|
||||
AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR, /* 0x31 */
|
||||
AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR, /* 0x32 */
|
||||
AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR, /* 0x33 */
|
||||
AXIS_LABEL_PROP_ABS_MT_ORIENTATION, /* 0x34 */
|
||||
AXIS_LABEL_PROP_ABS_MT_POSITION_X, /* 0x35 */
|
||||
AXIS_LABEL_PROP_ABS_MT_POSITION_Y, /* 0x36 */
|
||||
AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE, /* 0x37 */
|
||||
AXIS_LABEL_PROP_ABS_MT_BLOB_ID, /* 0x38 */
|
||||
AXIS_LABEL_PROP_ABS_MT_TRACKING_ID, /* 0x39 */
|
||||
AXIS_LABEL_PROP_ABS_MT_PRESSURE, /* 0x3a */
|
||||
#ifdef AXIS_LABEL_PROP_ABS_MT_DISTANCE
|
||||
AXIS_LABEL_PROP_ABS_MT_DISTANCE, /* 0x3b */
|
||||
AXIS_LABEL_PROP_ABS_MT_TOOL_X, /* 0x3c */
|
||||
AXIS_LABEL_PROP_ABS_MT_TOOL_Y, /* 0x3d */
|
||||
#endif /* AXIS_LABEL_PROP_ABS_MT_DISTANCE */
|
||||
};
|
||||
|
||||
static const char* rel_labels[] = {
|
||||
AXIS_LABEL_PROP_REL_X,
|
||||
AXIS_LABEL_PROP_REL_Y,
|
||||
AXIS_LABEL_PROP_REL_Z,
|
||||
AXIS_LABEL_PROP_REL_RX,
|
||||
AXIS_LABEL_PROP_REL_RY,
|
||||
AXIS_LABEL_PROP_REL_RZ,
|
||||
AXIS_LABEL_PROP_REL_HWHEEL,
|
||||
AXIS_LABEL_PROP_REL_DIAL,
|
||||
AXIS_LABEL_PROP_REL_WHEEL,
|
||||
AXIS_LABEL_PROP_REL_MISC
|
||||
};
|
||||
|
||||
static const char* btn_labels[][16] = {
|
||||
{ /* BTN_MISC group offset 0x100*/
|
||||
BTN_LABEL_PROP_BTN_0, /* 0x00 */
|
||||
BTN_LABEL_PROP_BTN_1, /* 0x01 */
|
||||
BTN_LABEL_PROP_BTN_2, /* 0x02 */
|
||||
BTN_LABEL_PROP_BTN_3, /* 0x03 */
|
||||
BTN_LABEL_PROP_BTN_4, /* 0x04 */
|
||||
BTN_LABEL_PROP_BTN_5, /* 0x05 */
|
||||
BTN_LABEL_PROP_BTN_6, /* 0x06 */
|
||||
BTN_LABEL_PROP_BTN_7, /* 0x07 */
|
||||
BTN_LABEL_PROP_BTN_8, /* 0x08 */
|
||||
BTN_LABEL_PROP_BTN_9 /* 0x09 */
|
||||
},
|
||||
{ /* BTN_MOUSE group offset 0x110 */
|
||||
BTN_LABEL_PROP_BTN_LEFT, /* 0x00 */
|
||||
BTN_LABEL_PROP_BTN_RIGHT, /* 0x01 */
|
||||
BTN_LABEL_PROP_BTN_MIDDLE, /* 0x02 */
|
||||
BTN_LABEL_PROP_BTN_SIDE, /* 0x03 */
|
||||
BTN_LABEL_PROP_BTN_EXTRA, /* 0x04 */
|
||||
BTN_LABEL_PROP_BTN_FORWARD, /* 0x05 */
|
||||
BTN_LABEL_PROP_BTN_BACK, /* 0x06 */
|
||||
BTN_LABEL_PROP_BTN_TASK /* 0x07 */
|
||||
},
|
||||
{ /* BTN_JOYSTICK group offset 0x120 */
|
||||
BTN_LABEL_PROP_BTN_TRIGGER, /* 0x00 */
|
||||
BTN_LABEL_PROP_BTN_THUMB, /* 0x01 */
|
||||
BTN_LABEL_PROP_BTN_THUMB2, /* 0x02 */
|
||||
BTN_LABEL_PROP_BTN_TOP, /* 0x03 */
|
||||
BTN_LABEL_PROP_BTN_TOP2, /* 0x04 */
|
||||
BTN_LABEL_PROP_BTN_PINKIE, /* 0x05 */
|
||||
BTN_LABEL_PROP_BTN_BASE, /* 0x06 */
|
||||
BTN_LABEL_PROP_BTN_BASE2, /* 0x07 */
|
||||
BTN_LABEL_PROP_BTN_BASE3, /* 0x08 */
|
||||
BTN_LABEL_PROP_BTN_BASE4, /* 0x09 */
|
||||
BTN_LABEL_PROP_BTN_BASE5, /* 0x0a */
|
||||
BTN_LABEL_PROP_BTN_BASE6, /* 0x0b */
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
BTN_LABEL_PROP_BTN_DEAD /* 0x0f */
|
||||
},
|
||||
{ /* BTN_GAMEPAD group offset 0x130 */
|
||||
BTN_LABEL_PROP_BTN_A, /* 0x00 */
|
||||
BTN_LABEL_PROP_BTN_B, /* 0x01 */
|
||||
BTN_LABEL_PROP_BTN_C, /* 0x02 */
|
||||
BTN_LABEL_PROP_BTN_X, /* 0x03 */
|
||||
BTN_LABEL_PROP_BTN_Y, /* 0x04 */
|
||||
BTN_LABEL_PROP_BTN_Z, /* 0x05 */
|
||||
BTN_LABEL_PROP_BTN_TL, /* 0x06 */
|
||||
BTN_LABEL_PROP_BTN_TR, /* 0x07 */
|
||||
BTN_LABEL_PROP_BTN_TL2, /* 0x08 */
|
||||
BTN_LABEL_PROP_BTN_TR2, /* 0x09 */
|
||||
BTN_LABEL_PROP_BTN_SELECT, /* 0x0a */
|
||||
BTN_LABEL_PROP_BTN_START, /* 0x0b */
|
||||
BTN_LABEL_PROP_BTN_MODE, /* 0x0c */
|
||||
BTN_LABEL_PROP_BTN_THUMBL, /* 0x0d */
|
||||
BTN_LABEL_PROP_BTN_THUMBR /* 0x0e */
|
||||
},
|
||||
{ /* BTN_DIGI group offset 0x140 */
|
||||
BTN_LABEL_PROP_BTN_TOOL_PEN, /* 0x00 */
|
||||
BTN_LABEL_PROP_BTN_TOOL_RUBBER, /* 0x01 */
|
||||
BTN_LABEL_PROP_BTN_TOOL_BRUSH, /* 0x02 */
|
||||
BTN_LABEL_PROP_BTN_TOOL_PENCIL, /* 0x03 */
|
||||
BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH, /* 0x04 */
|
||||
BTN_LABEL_PROP_BTN_TOOL_FINGER, /* 0x05 */
|
||||
BTN_LABEL_PROP_BTN_TOOL_MOUSE, /* 0x06 */
|
||||
BTN_LABEL_PROP_BTN_TOOL_LENS, /* 0x07 */
|
||||
NULL,
|
||||
NULL,
|
||||
BTN_LABEL_PROP_BTN_TOUCH, /* 0x0a */
|
||||
BTN_LABEL_PROP_BTN_STYLUS, /* 0x0b */
|
||||
BTN_LABEL_PROP_BTN_STYLUS2, /* 0x0c */
|
||||
BTN_LABEL_PROP_BTN_TOOL_DOUBLETAP, /* 0x0d */
|
||||
BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP /* 0x0e */
|
||||
},
|
||||
{ /* BTN_WHEEL group offset 0x150 */
|
||||
BTN_LABEL_PROP_BTN_GEAR_DOWN, /* 0x00 */
|
||||
BTN_LABEL_PROP_BTN_GEAR_UP /* 0x01 */
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -5,7 +5,7 @@
|
||||
* Copyright 1994-2002 by The XFree86 Project, Inc.
|
||||
* Copyright 2002 by Paul Elliott
|
||||
* (Ported from xf86-input-mouse, above copyrights taken from there)
|
||||
* Copyright © 2008 University of South Australia
|
||||
* Copyright © 2008 University of South Australia
|
||||
* Copyright 2008 by Chris Salch
|
||||
* Copyright 2008 Red Hat, Inc.
|
||||
*
|
||||
|
||||
72
src/emuMB.c
72
src/emuMB.c
@@ -45,7 +45,6 @@
|
||||
|
||||
static Atom prop_mbemu = 0; /* Middle button emulation on/off property */
|
||||
static Atom prop_mbtimeout = 0; /* Middle button timeout property */
|
||||
static Atom prop_mbbuton = 0; /* Middle button target button property */
|
||||
/*
|
||||
* Lets create a simple finite-state machine for 3 button emulation:
|
||||
*
|
||||
@@ -185,34 +184,23 @@ int
|
||||
EvdevMBEmuTimer(InputInfoPtr pInfo)
|
||||
{
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
int sigstate;
|
||||
int id;
|
||||
int mapped_id;
|
||||
|
||||
#if HAVE_THREADED_INPUT
|
||||
input_lock();
|
||||
#else
|
||||
int sigstate = xf86BlockSIGIO();
|
||||
#endif
|
||||
sigstate = xf86BlockSIGIO ();
|
||||
|
||||
pEvdev->emulateMB.pending = FALSE;
|
||||
if ((id = stateTab[pEvdev->emulateMB.state][4][0]) != 0) {
|
||||
mapped_id = abs(id);
|
||||
if (mapped_id == 2)
|
||||
mapped_id = pEvdev->emulateMB.button;
|
||||
EvdevPostButtonEvent(pInfo, mapped_id,
|
||||
EvdevPostButtonEvent(pInfo, abs(id),
|
||||
(id >= 0) ? BUTTON_PRESS : BUTTON_RELEASE);
|
||||
pEvdev->emulateMB.state =
|
||||
stateTab[pEvdev->emulateMB.state][4][2];
|
||||
} else {
|
||||
xf86IDrvMsg(pInfo, X_ERROR, "Got unexpected buttonTimer in state %d\n",
|
||||
pEvdev->emulateMB.state);
|
||||
ErrorF("Got unexpected buttonTimer in state %d\n",
|
||||
pEvdev->emulateMB.state);
|
||||
}
|
||||
|
||||
#if HAVE_THREADED_INPUT
|
||||
input_unlock();
|
||||
#else
|
||||
xf86UnblockSIGIO(sigstate);
|
||||
#endif
|
||||
xf86UnblockSIGIO (sigstate);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -231,7 +219,6 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
|
||||
{
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
int id;
|
||||
int mapped_id;
|
||||
int *btstate;
|
||||
int ret = FALSE;
|
||||
|
||||
@@ -250,10 +237,7 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
|
||||
|
||||
if ((id = stateTab[pEvdev->emulateMB.state][*btstate][0]) != 0)
|
||||
{
|
||||
mapped_id = abs(id);
|
||||
if (mapped_id == 2)
|
||||
mapped_id = pEvdev->emulateMB.button;
|
||||
EvdevQueueButtonEvent(pInfo, mapped_id, (id >= 0));
|
||||
EvdevQueueButtonEvent(pInfo, abs(id), (id >= 0));
|
||||
ret = TRUE;
|
||||
}
|
||||
if ((id = stateTab[pEvdev->emulateMB.state][*btstate][1]) != 0)
|
||||
@@ -277,7 +261,9 @@ EvdevMBEmuFilterEvent(InputInfoPtr pInfo, int button, BOOL press)
|
||||
}
|
||||
|
||||
|
||||
void EvdevMBEmuWakeupHandler(WAKEUP_HANDLER_ARGS)
|
||||
void EvdevMBEmuWakeupHandler(pointer data,
|
||||
int i,
|
||||
pointer LastSelectMask)
|
||||
{
|
||||
InputInfoPtr pInfo = (InputInfoPtr)data;
|
||||
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||
@@ -291,7 +277,9 @@ void EvdevMBEmuWakeupHandler(WAKEUP_HANDLER_ARGS)
|
||||
}
|
||||
}
|
||||
|
||||
void EvdevMBEmuBlockHandler(BLOCK_HANDLER_ARGS)
|
||||
void EvdevMBEmuBlockHandler(pointer data,
|
||||
struct timeval **waitTime,
|
||||
pointer LastSelectMask)
|
||||
{
|
||||
InputInfoPtr pInfo = (InputInfoPtr) data;
|
||||
EvdevPtr pEvdev= (EvdevPtr) pInfo->private;
|
||||
@@ -310,23 +298,12 @@ void
|
||||
EvdevMBEmuPreInit(InputInfoPtr pInfo)
|
||||
{
|
||||
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||
int bt;
|
||||
|
||||
pEvdev->emulateMB.enabled = xf86SetBoolOption(pInfo->options,
|
||||
"Emulate3Buttons",
|
||||
FALSE);
|
||||
pEvdev->emulateMB.timeout = xf86SetIntOption(pInfo->options,
|
||||
"Emulate3Timeout", 50);
|
||||
bt = xf86SetIntOption(pInfo->options, "Emulate3Button", 2);
|
||||
if (bt < 0 || bt > EVDEV_MAXBUTTONS) {
|
||||
xf86IDrvMsg(pInfo, X_WARNING, "Invalid Emulate3Button value: %d\n",
|
||||
bt);
|
||||
xf86IDrvMsg(pInfo, X_WARNING, "Middle button emulation disabled.\n");
|
||||
|
||||
pEvdev->emulateMB.enabled = FALSE;
|
||||
}
|
||||
|
||||
pEvdev->emulateMB.button = bt;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -358,7 +335,6 @@ EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||
{
|
||||
InputInfoPtr pInfo = dev->public.devicePrivate;
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
int bt;
|
||||
|
||||
if (atom == prop_mbemu)
|
||||
{
|
||||
@@ -374,18 +350,6 @@ EvdevMBEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||
|
||||
if (!checkonly)
|
||||
pEvdev->emulateMB.timeout = *((CARD32*)val->data);
|
||||
} else if (atom == prop_mbbuton)
|
||||
{
|
||||
if (val->format != 8 || val->size != 1 || val->type != XA_INTEGER)
|
||||
return BadMatch;
|
||||
|
||||
bt = *((CARD8*)val->data);
|
||||
|
||||
if (bt < 0 || bt > EVDEV_MAXBUTTONS)
|
||||
return BadValue;
|
||||
|
||||
if (!checkonly)
|
||||
pEvdev->emulateMB.button = bt;
|
||||
}
|
||||
|
||||
return Success;
|
||||
@@ -423,15 +387,5 @@ EvdevMBEmuInitProperty(DeviceIntPtr dev)
|
||||
return;
|
||||
XISetDevicePropertyDeletable(dev, prop_mbtimeout, FALSE);
|
||||
|
||||
prop_mbbuton = MakeAtom(EVDEV_PROP_MIDBUTTON_BUTTON,
|
||||
strlen(EVDEV_PROP_MIDBUTTON_BUTTON),
|
||||
TRUE);
|
||||
rc = XIChangeDeviceProperty(dev, prop_mbbuton, XA_INTEGER, 8, PropModeReplace, 1,
|
||||
&pEvdev->emulateMB.button, FALSE);
|
||||
|
||||
if (rc != Success)
|
||||
return;
|
||||
XISetDevicePropertyDeletable(dev, prop_mbbuton, FALSE);
|
||||
|
||||
XIRegisterPropertyHandler(dev, EvdevMBEmuSetProperty, NULL, NULL);
|
||||
}
|
||||
|
||||
@@ -89,19 +89,12 @@ Evdev3BEmuTimer(OsTimerPtr timer, CARD32 time, pointer arg)
|
||||
InputInfoPtr pInfo = (InputInfoPtr)arg;
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||
int sigstate = 0;
|
||||
|
||||
#if HAVE_THREADED_INPUT
|
||||
input_lock();
|
||||
#else
|
||||
int sigstate = xf86BlockSIGIO();
|
||||
#endif
|
||||
sigstate = xf86BlockSIGIO ();
|
||||
emu3B->state = EM3B_EMULATING;
|
||||
Evdev3BEmuPostButtonEvent(pInfo, emu3B->button, BUTTON_PRESS);
|
||||
#if HAVE_THREADED_INPUT
|
||||
input_unlock();
|
||||
#else
|
||||
xf86UnblockSIGIO(sigstate);
|
||||
#endif
|
||||
xf86UnblockSIGIO (sigstate);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -236,8 +229,8 @@ Evdev3BEmuProcessAbsMotion(InputInfoPtr pInfo, ValuatorMask *vals)
|
||||
{
|
||||
if (valuator_mask_isset(vals, axis))
|
||||
{
|
||||
double delta = valuator_mask_get_double(vals, axis) - emu3B->startpos[axis];
|
||||
if (fabs(delta) > emu3B->threshold)
|
||||
int delta = valuator_mask_get(vals, axis) - emu3B->startpos[axis];
|
||||
if (abs(delta) > emu3B->threshold)
|
||||
cancel = TRUE;
|
||||
}
|
||||
axis++;
|
||||
@@ -255,7 +248,7 @@ Evdev3BEmuProcessAbsMotion(InputInfoPtr pInfo, ValuatorMask *vals)
|
||||
* emulation.
|
||||
*/
|
||||
void
|
||||
Evdev3BEmuProcessRelMotion(InputInfoPtr pInfo, double dx, double dy)
|
||||
Evdev3BEmuProcessRelMotion(InputInfoPtr pInfo, int dx, int dy)
|
||||
{
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
struct emulate3B *emu3B = &pEvdev->emulate3B;
|
||||
@@ -267,8 +260,8 @@ Evdev3BEmuProcessRelMotion(InputInfoPtr pInfo, double dx, double dy)
|
||||
emu3B->delta[1] += dy;
|
||||
emu3B->flags |= EVDEV_RELATIVE_EVENTS;
|
||||
|
||||
if (fabs(emu3B->delta[0]) > emu3B->threshold ||
|
||||
fabs(emu3B->delta[1]) > emu3B->threshold)
|
||||
if (abs(emu3B->delta[0]) > emu3B->threshold ||
|
||||
abs(emu3B->delta[1]) > emu3B->threshold)
|
||||
{
|
||||
Evdev3BEmuPostButtonEvent(pInfo, 1, BUTTON_PRESS);
|
||||
Evdev3BCancel(pInfo);
|
||||
|
||||
@@ -50,7 +50,7 @@ static Atom prop_wheel_inertia = 0;
|
||||
static Atom prop_wheel_timeout = 0;
|
||||
static Atom prop_wheel_button = 0;
|
||||
|
||||
/* Local Function Prototypes */
|
||||
/* Local Funciton Prototypes */
|
||||
static int EvdevWheelEmuInertia(InputInfoPtr pInfo, WheelAxisPtr axis, int value);
|
||||
|
||||
/* Filter mouse button events */
|
||||
@@ -95,8 +95,9 @@ BOOL
|
||||
EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
|
||||
{
|
||||
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||
WheelAxisPtr pAxis = NULL;
|
||||
WheelAxisPtr pAxis = NULL, pOtherAxis = NULL;
|
||||
int value = pEv->value;
|
||||
int oldValue;
|
||||
|
||||
/* Has wheel emulation been configured to be enabled? */
|
||||
if (!pEvdev->emulateWheel.enabled)
|
||||
@@ -114,15 +115,12 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* We don't want to intercept real mouse wheel events */
|
||||
if(pEv->type == EV_ABS) {
|
||||
int axis = pEvdev->abs_axis_map[pEv->code];
|
||||
int oldValue;
|
||||
|
||||
if (axis > -1 && valuator_mask_fetch(pEvdev->old_vals, axis, &oldValue)) {
|
||||
valuator_mask_set(pEvdev->abs_vals, axis, value);
|
||||
value -= oldValue; /* make value into a differential measurement */
|
||||
} else
|
||||
value = 0; /* avoid a jump on the first touch */
|
||||
int axis = pEvdev->axis_map[pEv->code];
|
||||
oldValue = valuator_mask_get(pEvdev->vals, axis);
|
||||
valuator_mask_set(pEvdev->vals, axis, value);
|
||||
value -= oldValue; /* make value into a differential measurement */
|
||||
}
|
||||
|
||||
switch(pEv->code) {
|
||||
@@ -130,11 +128,13 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
|
||||
/* ABS_X has the same value as REL_X, so this case catches both */
|
||||
case REL_X:
|
||||
pAxis = &(pEvdev->emulateWheel.X);
|
||||
pOtherAxis = &(pEvdev->emulateWheel.Y);
|
||||
break;
|
||||
|
||||
/* ABS_Y has the same value as REL_Y, so this case catches both */
|
||||
case REL_Y:
|
||||
pAxis = &(pEvdev->emulateWheel.Y);
|
||||
pOtherAxis = &(pEvdev->emulateWheel.X);
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -142,10 +142,15 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
|
||||
}
|
||||
|
||||
/* If we found REL_X, REL_Y, ABS_X or ABS_Y then emulate a mouse
|
||||
wheel.
|
||||
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)
|
||||
EvdevWheelEmuInertia(pInfo, pAxis, value);
|
||||
{
|
||||
if (EvdevWheelEmuInertia(pInfo, pAxis, value))
|
||||
pOtherAxis->traveled_distance = 0;
|
||||
}
|
||||
|
||||
/* Eat motion events while emulateWheel button pressed. */
|
||||
return TRUE;
|
||||
@@ -387,7 +392,7 @@ EvdevWheelEmuSetProperty(DeviceIntPtr dev, Atom atom, XIPropertyValuePtr val,
|
||||
|
||||
inertia = *((CARD16*)val->data);
|
||||
|
||||
if (inertia <= 0)
|
||||
if (inertia < 0)
|
||||
return BadValue;
|
||||
|
||||
if (!checkonly)
|
||||
|
||||
1845
src/evdev.c
1845
src/evdev.c
File diff suppressed because it is too large
Load Diff
96
src/evdev.h
96
src/evdev.h
@@ -36,23 +36,16 @@
|
||||
#define EVDEV_H
|
||||
|
||||
#include <linux/input.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
/* Tolerate prior #include <linux/input.h> */
|
||||
#undef BUS_NONE
|
||||
#undef BUS_PCI
|
||||
#undef BUS_SBUS
|
||||
#undef BUS_PLATFORM
|
||||
#undef BUS_USB
|
||||
#include <linux/types.h>
|
||||
|
||||
#include <xorg-server.h>
|
||||
#include <xf86Xinput.h>
|
||||
#include <xf86_OSproc.h>
|
||||
#include <xkbstr.h>
|
||||
|
||||
#ifdef MULTITOUCH
|
||||
#include <mtdev.h>
|
||||
|
||||
#include <libevdev/libevdev.h>
|
||||
#endif
|
||||
|
||||
#ifndef EV_CNT /* linux 2.6.23 kernels and earlier lack _CNT defines */
|
||||
#define EV_CNT (EV_MAX+1)
|
||||
@@ -70,20 +63,8 @@
|
||||
#define LED_CNT (LED_MAX+1)
|
||||
#endif
|
||||
|
||||
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 18
|
||||
#define LogMessageVerbSigSafe xf86MsgVerb
|
||||
#endif
|
||||
|
||||
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 23
|
||||
#define HAVE_THREADED_INPUT 1
|
||||
#endif
|
||||
|
||||
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 24
|
||||
#define BLOCK_HANDLER_ARGS void *data, void *waitTime
|
||||
#define WAKEUP_HANDLER_ARGS void *data, int i
|
||||
#else
|
||||
#define BLOCK_HANDLER_ARGS pointer data, struct timeval **waitTime, pointer LastSelectMask
|
||||
#define WAKEUP_HANDLER_ARGS void *data, int i, pointer LastSelectMask
|
||||
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 14
|
||||
#define HAVE_SMOOTH_SCROLLING 1
|
||||
#endif
|
||||
|
||||
#define EVDEV_MAXBUTTONS 32
|
||||
@@ -116,8 +97,6 @@
|
||||
/* Number of longs needed to hold the given number of bits */
|
||||
#define NLONGS(x) (((x) + LONG_BITS - 1) / LONG_BITS)
|
||||
|
||||
#define DEFAULT_MOUSE_DPI 1000.0
|
||||
|
||||
/* Function key mode */
|
||||
enum fkeymode {
|
||||
FKEYMODE_UNKNOWN = 0,
|
||||
@@ -150,39 +129,42 @@ typedef struct {
|
||||
EV_QUEUE_KEY, /* xf86PostKeyboardEvent() */
|
||||
EV_QUEUE_BTN, /* xf86PostButtonEvent() */
|
||||
EV_QUEUE_PROXIMITY, /* xf86PostProximityEvent() */
|
||||
#ifdef MULTITOUCH
|
||||
EV_QUEUE_TOUCH, /*xf86PostTouchEvent() */
|
||||
#endif
|
||||
} type;
|
||||
union {
|
||||
int key; /* May be either a key code or button number. */
|
||||
#ifdef MULTITOUCH
|
||||
unsigned int touch; /* Touch ID */
|
||||
#endif
|
||||
} detail;
|
||||
int val; /* State of the key/button/touch; pressed or released. */
|
||||
#ifdef MULTITOUCH
|
||||
ValuatorMask *touchMask;
|
||||
#endif
|
||||
} EventQueueRec, *EventQueuePtr;
|
||||
|
||||
typedef struct {
|
||||
struct libevdev *dev;
|
||||
unsigned short id_vendor;
|
||||
unsigned short id_product;
|
||||
|
||||
char *device;
|
||||
int grabDevice; /* grab the event device? */
|
||||
|
||||
int num_vals; /* number of valuators */
|
||||
int num_mt_vals; /* number of multitouch valuators */
|
||||
int abs_axis_map[ABS_CNT]; /* Map evdev ABS_* to index */
|
||||
int rel_axis_map[REL_CNT]; /* Map evdev REL_* to index */
|
||||
ValuatorMask *abs_vals; /* values for absolute axis */
|
||||
ValuatorMask *rel_vals; /* values for relative axis */
|
||||
ValuatorMask *old_vals; /* old absolute values for calculating relative motion */
|
||||
ValuatorMask *prox; /* last absolute values set while not in proximity */
|
||||
int axis_map[max(ABS_CNT, REL_CNT)]; /* Map evdev <axis> to index */
|
||||
ValuatorMask *vals; /* new values coming in */
|
||||
ValuatorMask *old_vals; /* old values for calculating relative motion */
|
||||
ValuatorMask *prox; /* last values set while not in proximity */
|
||||
ValuatorMask *mt_mask;
|
||||
ValuatorMask **last_mt_vals;
|
||||
int cur_slot;
|
||||
struct slot {
|
||||
int dirty;
|
||||
enum SlotState state;
|
||||
} *slots;
|
||||
enum SlotState slot_state;
|
||||
#ifdef MULTITOUCH
|
||||
struct mtdev *mtdev;
|
||||
BOOL fake_mt;
|
||||
#endif
|
||||
|
||||
int flags;
|
||||
int in_proximity; /* device in proximity */
|
||||
@@ -191,10 +173,13 @@ typedef struct {
|
||||
BOOL swap_axes;
|
||||
BOOL invert_x;
|
||||
BOOL invert_y;
|
||||
int resolution;
|
||||
|
||||
int delta[REL_CNT];
|
||||
unsigned int abs_queued, rel_queued, prox_queued;
|
||||
|
||||
/* XKB stuff has to be per-device rather than per-driver */
|
||||
XkbRMLVOSet rmlvo;
|
||||
|
||||
/* Middle mouse button emulation */
|
||||
struct {
|
||||
BOOL enabled;
|
||||
@@ -203,7 +188,6 @@ typedef struct {
|
||||
int state; /* state machine (see bt3emu.c) */
|
||||
Time expires; /* time of expiry */
|
||||
Time timeout;
|
||||
uint8_t button; /* phys button to emit */
|
||||
} emulateMB;
|
||||
/* Third mouse button emulation */
|
||||
struct emulate3B {
|
||||
@@ -214,7 +198,7 @@ typedef struct {
|
||||
int button; /* phys button to emit */
|
||||
int threshold; /* move threshold in dev coords */
|
||||
OsTimerPtr timer;
|
||||
double delta[2]; /* delta x/y, accumulating */
|
||||
int delta[2]; /* delta x/y, accumulating */
|
||||
int startpos[2]; /* starting pos for abs devices */
|
||||
int flags; /* remember if we had rel or abs movement */
|
||||
} emulate3B;
|
||||
@@ -234,11 +218,6 @@ typedef struct {
|
||||
Time expires; /* time of expiry */
|
||||
Time timeout;
|
||||
} emulateWheel;
|
||||
struct {
|
||||
int vert_delta;
|
||||
int horiz_delta;
|
||||
int dial_delta;
|
||||
} smoothScroll;
|
||||
/* run-time calibration */
|
||||
struct {
|
||||
int min_x;
|
||||
@@ -253,6 +232,15 @@ typedef struct {
|
||||
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;
|
||||
|
||||
@@ -261,27 +249,29 @@ typedef struct {
|
||||
EventQueueRec queue[EVDEV_MAXQUEUE];
|
||||
|
||||
enum fkeymode fkeymode;
|
||||
|
||||
char *type_name;
|
||||
} EvdevRec, *EvdevPtr;
|
||||
|
||||
/* Event posting functions */
|
||||
void EvdevQueueKbdEvent(InputInfoPtr pInfo, struct input_event *ev, int value);
|
||||
void EvdevQueueButtonEvent(InputInfoPtr pInfo, int button, int value);
|
||||
void EvdevQueueProximityEvent(InputInfoPtr pInfo, int value);
|
||||
#ifdef MULTITOUCH
|
||||
void EvdevQueueTouchEvent(InputInfoPtr pInfo, unsigned int touch,
|
||||
ValuatorMask *mask, uint16_t type);
|
||||
#endif
|
||||
void EvdevPostButtonEvent(InputInfoPtr pInfo, int button, enum ButtonAction act);
|
||||
void EvdevQueueButtonClicks(InputInfoPtr pInfo, int button, int count);
|
||||
void EvdevPostRelativeMotionEvents(InputInfoPtr pInfo);
|
||||
void EvdevPostAbsoluteMotionEvents(InputInfoPtr pInfo);
|
||||
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 */
|
||||
int EvdevMBEmuTimer(InputInfoPtr);
|
||||
BOOL EvdevMBEmuFilterEvent(InputInfoPtr, int, BOOL);
|
||||
void EvdevMBEmuWakeupHandler(WAKEUP_HANDLER_ARGS);
|
||||
void EvdevMBEmuBlockHandler(BLOCK_HANDLER_ARGS);
|
||||
void EvdevMBEmuWakeupHandler(pointer, int, pointer);
|
||||
void EvdevMBEmuBlockHandler(pointer, struct timeval**, pointer);
|
||||
void EvdevMBEmuPreInit(InputInfoPtr);
|
||||
void EvdevMBEmuOn(InputInfoPtr);
|
||||
void EvdevMBEmuFinalize(InputInfoPtr);
|
||||
@@ -292,7 +282,7 @@ BOOL Evdev3BEmuFilterEvent(InputInfoPtr, int, BOOL);
|
||||
void Evdev3BEmuPreInit(InputInfoPtr pInfo);
|
||||
void Evdev3BEmuOn(InputInfoPtr);
|
||||
void Evdev3BEmuFinalize(InputInfoPtr);
|
||||
void Evdev3BEmuProcessRelMotion(InputInfoPtr pInfo, double dx, double dy);
|
||||
void Evdev3BEmuProcessRelMotion(InputInfoPtr pInfo, int dx, int dy);
|
||||
void Evdev3BEmuProcessAbsMotion(InputInfoPtr pInfo, ValuatorMask *vals);
|
||||
|
||||
/* Mouse Wheel emulation */
|
||||
|
||||
Reference in New Issue
Block a user