mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Compare commits
5 Commits
xf86-input
...
xf86-input
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f12eca9f83 | ||
|
|
33dc3d7128 | ||
|
|
7b0a65d989 | ||
|
|
d24431a186 | ||
|
|
ce7d8fdebc |
@@ -23,7 +23,7 @@
|
||||
# Initialize Autoconf
|
||||
AC_PREREQ([2.60])
|
||||
AC_INIT([xf86-input-evdev],
|
||||
[2.10.1],
|
||||
[2.10.2],
|
||||
[https://bugs.freedesktop.org/enter_bug.cgi?product=xorg],
|
||||
[xf86-input-evdev])
|
||||
AC_CONFIG_SRCDIR([Makefile.am])
|
||||
|
||||
@@ -125,6 +125,19 @@ 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
|
||||
|
||||
@@ -95,7 +95,7 @@ BOOL
|
||||
EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
|
||||
{
|
||||
EvdevPtr pEvdev = (EvdevPtr)pInfo->private;
|
||||
WheelAxisPtr pAxis = NULL, pOtherAxis = NULL;
|
||||
WheelAxisPtr pAxis = NULL;
|
||||
int value = pEv->value;
|
||||
|
||||
/* Has wheel emulation been configured to be enabled? */
|
||||
@@ -130,13 +130,11 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
|
||||
/* ABS_X has the same value as REL_X, so this case catches both */
|
||||
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:
|
||||
@@ -144,15 +142,10 @@ EvdevWheelEmuFilterMotion(InputInfoPtr pInfo, struct input_event *pEv)
|
||||
}
|
||||
|
||||
/* If we found REL_X, REL_Y, ABS_X or ABS_Y then emulate a mouse
|
||||
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.
|
||||
wheel.
|
||||
*/
|
||||
if (pAxis)
|
||||
{
|
||||
if (EvdevWheelEmuInertia(pInfo, pAxis, value))
|
||||
pOtherAxis->traveled_distance = 0;
|
||||
}
|
||||
EvdevWheelEmuInertia(pInfo, pAxis, value);
|
||||
|
||||
/* Eat motion events while emulateWheel button pressed. */
|
||||
return TRUE;
|
||||
|
||||
20
src/evdev.c
20
src/evdev.c
@@ -430,6 +430,14 @@ static void
|
||||
EvdevProcessValuators(InputInfoPtr pInfo)
|
||||
{
|
||||
EvdevPtr pEvdev = pInfo->private;
|
||||
int val;
|
||||
|
||||
if (pEvdev->abs_vals) {
|
||||
if (valuator_mask_fetch(pEvdev->abs_vals, 0, &val))
|
||||
valuator_mask_set(pEvdev->old_vals, 0, val);
|
||||
if (valuator_mask_fetch(pEvdev->abs_vals, 1, &val))
|
||||
valuator_mask_set(pEvdev->old_vals, 1, val);
|
||||
}
|
||||
|
||||
/* Apply transformations on relative coordinates */
|
||||
if (pEvdev->rel_queued) {
|
||||
@@ -765,6 +773,12 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo, struct input_event *ev)
|
||||
if (ev->code > ABS_MAX)
|
||||
return;
|
||||
|
||||
/* Always store the current abs valuator, we need it to update old_vals
|
||||
* which is required by wheel emulation */
|
||||
map = pEvdev->abs_axis_map[ev->code];
|
||||
if (map < 2)
|
||||
valuator_mask_set(pEvdev->abs_vals, map, value);
|
||||
|
||||
if (EvdevWheelEmuFilterMotion(pInfo, ev))
|
||||
return;
|
||||
|
||||
@@ -781,10 +795,7 @@ EvdevProcessAbsoluteMotionEvent(InputInfoPtr pInfo, struct input_event *ev)
|
||||
valuator_mask_set(pEvdev->rel_vals, map, value - oldval);
|
||||
pEvdev->rel_queued = 1;
|
||||
}
|
||||
valuator_mask_set(pEvdev->old_vals, map, value);
|
||||
} else {
|
||||
/* the normal case: just store the number. */
|
||||
valuator_mask_set(pEvdev->abs_vals, map, value);
|
||||
pEvdev->abs_queued = 1;
|
||||
}
|
||||
}
|
||||
@@ -2779,6 +2790,9 @@ static void EvdevInitButtonLabels(EvdevPtr pEvdev, int natoms, Atom *atoms)
|
||||
int group = (button % 0x100)/16;
|
||||
int idx = button - ((button/16) * 16);
|
||||
|
||||
if (group >= ArrayLength(btn_labels))
|
||||
break;
|
||||
|
||||
if (!libevdev_has_event_code(pEvdev->dev, EV_KEY, button))
|
||||
continue;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user