mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Compare commits
3 Commits
xf86-input
...
xf86-input
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24368d8379 | ||
|
|
4996694cc9 | ||
|
|
05f7057ad5 |
@@ -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
|
||||
|
||||
|
||||
21
configure.ac
21
configure.ac
@@ -23,7 +23,7 @@
|
||||
# Initialize Autoconf
|
||||
AC_PREREQ([2.60])
|
||||
AC_INIT([xf86-input-evdev],
|
||||
[2.10.3],
|
||||
[2.9.2],
|
||||
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
|
||||
[xf86-input-evdev])
|
||||
AC_CONFIG_SRCDIR([Makefile.am])
|
||||
@@ -44,11 +44,19 @@ XORG_MACROS_VERSION(1.8)
|
||||
XORG_DEFAULT_OPTIONS
|
||||
|
||||
# Obtain compiler/linker options from server and required extensions
|
||||
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.12] xproto [inputproto >= 2.1.99.3])
|
||||
PKG_CHECK_MODULES(XORG, [xorg-server >= 1.10] xproto inputproto)
|
||||
PKG_CHECK_MODULES(UDEV, libudev)
|
||||
|
||||
PKG_CHECK_MODULES(XI22, [inputproto >= 2.1.99.3] [xorg-server >= 1.11.99.901], HAVE_XI22="yes", HAVE_XI22="no")
|
||||
PKG_CHECK_MODULES(LIBEVDEV, [libevdev >= 0.4])
|
||||
PKG_CHECK_MODULES(MTDEV, mtdev)
|
||||
|
||||
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`
|
||||
|
||||
@@ -125,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
|
||||
@@ -251,12 +238,6 @@ Default: "1". Property: "Evdev Scrolling Distance".
|
||||
.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
|
||||
|
||||
@@ -229,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++;
|
||||
@@ -248,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;
|
||||
@@ -260,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);
|
||||
|
||||
@@ -95,7 +95,7 @@ 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;
|
||||
|
||||
/* Has wheel emulation been configured to be enabled? */
|
||||
@@ -119,7 +119,7 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
|
||||
int oldValue;
|
||||
|
||||
if (axis > -1 && valuator_mask_fetch(pEvdev->old_vals, axis, &oldValue)) {
|
||||
valuator_mask_set(pEvdev->abs_vals, axis, value);
|
||||
valuator_mask_set(pEvdev->vals, axis, value);
|
||||
value -= oldValue; /* make value into a differential measurement */
|
||||
} else
|
||||
value = 0; /* avoid a jump on the first touch */
|
||||
@@ -130,11 +130,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 +144,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;
|
||||
|
||||
512
src/evdev.c
512
src/evdev.c
File diff suppressed because it is too large
Load Diff
32
src/evdev.h
32
src/evdev.h
@@ -43,7 +43,9 @@
|
||||
#include <xf86_OSproc.h>
|
||||
#include <xkbstr.h>
|
||||
|
||||
#ifdef MULTITOUCH
|
||||
#include <mtdev.h>
|
||||
#endif
|
||||
|
||||
#include <libevdev/libevdev.h>
|
||||
|
||||
@@ -63,6 +65,10 @@
|
||||
#define LED_CNT (LED_MAX+1)
|
||||
#endif
|
||||
|
||||
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 14
|
||||
#define HAVE_SMOOTH_SCROLLING 1
|
||||
#endif
|
||||
|
||||
#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) < 18
|
||||
#define LogMessageVerbSigSafe xf86MsgVerb
|
||||
#endif
|
||||
@@ -97,8 +103,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,
|
||||
@@ -131,14 +135,20 @@ 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 {
|
||||
@@ -151,10 +161,9 @@ typedef struct {
|
||||
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 */
|
||||
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;
|
||||
@@ -162,8 +171,9 @@ typedef struct {
|
||||
int dirty;
|
||||
enum SlotState state;
|
||||
} *slots;
|
||||
#ifdef MULTITOUCH
|
||||
struct mtdev *mtdev;
|
||||
BOOL fake_mt;
|
||||
#endif
|
||||
|
||||
int flags;
|
||||
int in_proximity; /* device in proximity */
|
||||
@@ -172,8 +182,8 @@ 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;
|
||||
|
||||
/* Middle mouse button emulation */
|
||||
@@ -194,7 +204,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;
|
||||
@@ -249,8 +259,10 @@ typedef struct {
|
||||
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);
|
||||
@@ -272,7 +284,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