Compare commits

...

7 Commits

Author SHA1 Message Date
Peter Hutterer
f12eca9f83 evdev 2.10.2
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-29 09:13:35 +10:00
Peter Hutterer
33dc3d7128 Prevent buffer overrun accessing btn_labels
We go up to BTN_JOYSTICK, hence group can have a value of up to including 15.
The actual btn_labels only has 6 elements though.

Found by coverity.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-04-27 09:11:03 +10:00
Peter Hutterer
7b0a65d989 Don't reset the other axis on wheel emulation scroll buildup
The idea was that of a direction lock: as we move vertically we should not
build up any horizontal scroll motion even if we move slightly diagonally.

The effect was though that the axis would be reset completely as soon as an
event from the other axis occured. With the default threshold of 10, if one in
ten events was a REL_X, we'd never get a wheel event.

Drop this code, it's not needed. By default wheel emulation doesn't do
horizontal scrolling, if a config snippet sets XAxisMapping the user wants
horizontal scrolling. And since we just add the value anyway, as long as the
user does a roughly vertical motion we won't get over the threshold anyway.

https://bugs.freedesktop.org/show_bug.cgi?id=93617

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 10:48:36 +10:00
Peter Hutterer
d24431a186 Restore wheel emulation for absolute devices
Wheel emulation relies on oldVals, which stopped updating in 3dcf6f123c.

Since wheel emulation may filter the abs event, store the event before we do
anything with it. If we really want the abs_event, abs_queued will be set to
1, otherwise the value will be ignored.

And now that we know abs_value is always valied, we can copy its value into
old_vals, so that wheel emulation can calculate the delta correctly.

https://bugs.freedesktop.org/show_bug.cgi?id=93617

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-20 10:48:35 +10:00
Peter Hutterer
ce7d8fdebc man: add a warning that wheel emu inertia must be set and it isn't inertia
First, it's not actually inertia, it's simply the scroll distance, yay for the
misnomer.

And it needs to be set for any device that is more fine-grained than a
mouse, especially absolute devices. For example the VirtualBox device has an
abs max of 32767, so a simple motion may have a delta of to 2000 units and
that results in 200 scroll events. That's a bit excessive.

Related to: https://bugs.freedesktop.org/show_bug.cgi?id=93617

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-14 11:53:56 +10:00
Peter Hutterer
6a3beab613 evdev 2.10.1
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
2016-01-08 15:11:59 +10:00
Peter Hutterer
d7e61a7074 Only map x and y to axes 0 and 1
The Logitech G600 has one device with all axes north of ABS_MISC. The current
code assigns ABS_MISC as first axis to map to axis 0, i.e. x. On button press,
one node sends the BTN_LEFT but the other node sends an ABS_MISC with a 1 0
value. ABS_MISC is mapped to axis 0, this moves the pointer to (0, y) on
every button click.

Avoid this by simply mapping any axis other than x/y to at least axis 3, and
make sure we only override the MT 0/1 axes when we actually have MT axes.

https://bugs.freedesktop.org/show_bug.cgi?id=92856

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Keith Packard <keithp@keithp.com>
2015-11-13 06:50:28 +10:00
4 changed files with 42 additions and 17 deletions

View File

@@ -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])

View File

@@ -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

View File

@@ -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;

View File

@@ -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;