mirror of
https://github.com/X11Libre/xf86-input-evdev.git
synced 2026-04-14 11:44:16 +00:00
Don't update first_val and num_val if we don't have data (#32480)
For touchpads, rel_queued may be on (due to abs to rel conversion) but the delta for x/y is 0/0 on the first touch. Hence, we don't have any valuators to post. The current results in a num_vals of -15 and a subsequent segfault when the data is posted to the server. Start with a last valuator of -1, so that we know if we have at least one to post. X.Org Bug 32480 <http://bugs.freedesktop.org/show_bug.cgi?id=32480> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Chase Douglas <chase.douglas@canonical.com>
This commit is contained in:
@@ -402,7 +402,7 @@ EvdevProcessValuators(InputInfoPtr pInfo, int v[MAX_VALUATORS], int *num_v,
|
||||
}
|
||||
|
||||
if (pEvdev->rel_queued) {
|
||||
int first = REL_CNT, last = 0;
|
||||
int first = REL_CNT, last = -1;
|
||||
int i;
|
||||
|
||||
if (pEvdev->swap_axes) {
|
||||
@@ -428,8 +428,11 @@ EvdevProcessValuators(InputInfoPtr pInfo, int v[MAX_VALUATORS], int *num_v,
|
||||
}
|
||||
}
|
||||
|
||||
*num_v = (last - first + 1);
|
||||
*first_v = first;
|
||||
if (last >= 0)
|
||||
{
|
||||
*num_v = (last - first + 1);
|
||||
*first_v = first;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* Some devices only generate valid abs coords when BTN_TOOL_PEN is
|
||||
|
||||
Reference in New Issue
Block a user