mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Compare commits
7 Commits
xf86-input
...
xf86-input
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f12eca9f83 | ||
|
|
33dc3d7128 | ||
|
|
7b0a65d989 | ||
|
|
d24431a186 | ||
|
|
ce7d8fdebc | ||
|
|
6a3beab613 | ||
|
|
d7e61a7074 |
@@ -23,7 +23,7 @@
|
||||
# Initialize Autoconf
|
||||
AC_PREREQ([2.60])
|
||||
AC_INIT([xf86-input-evdev],
|
||||
[2.10.0],
|
||||
[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;
|
||||
|
||||
31
src/evdev.c
31
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;
|
||||
}
|
||||
}
|
||||
@@ -1377,7 +1388,7 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int num_scroll_axes)
|
||||
}
|
||||
atoms = malloc((pEvdev->num_vals + num_mt_axes) * sizeof(Atom));
|
||||
|
||||
i = 0;
|
||||
i = 2;
|
||||
for (axis = ABS_X; i < MAX_VALUATORS && axis <= ABS_MAX; axis++) {
|
||||
int j;
|
||||
pEvdev->abs_axis_map[axis] = -1;
|
||||
@@ -1385,9 +1396,14 @@ EvdevAddAbsValuatorClass(DeviceIntPtr device, int num_scroll_axes)
|
||||
is_blacklisted_axis(axis))
|
||||
continue;
|
||||
|
||||
mapping = i;
|
||||
if (axis == ABS_X)
|
||||
mapping = 0;
|
||||
else if (axis == ABS_Y)
|
||||
mapping = 1;
|
||||
else
|
||||
mapping = i;
|
||||
|
||||
for (j = 0; j < ArrayLength(mt_axis_mappings); j++)
|
||||
for (j = 0; !pEvdev->fake_mt && j < ArrayLength(mt_axis_mappings); j++)
|
||||
{
|
||||
if (mt_axis_mappings[j].code == axis)
|
||||
mt_axis_mappings[j].mapping = mapping;
|
||||
@@ -2774,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