Commit 240cd067 authored by Michal Suchánek's avatar Michal Suchánek Committed by Peter Hutterer
Browse files

Avoid crash on button events on device without valuators.

Backport of 2416ee4a

.

Signed-off-by: Michal Suchánek's avatarMichal Suchanek <hramrach@gmail.com>
Reviewed-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
parent db9620c0
......@@ -198,9 +198,11 @@ set_valuators(DeviceIntPtr dev, DeviceEvent* event, ValuatorMask *mask)
{
int i;
if (!dev->valuator)
return;
/* Set the data to the previous value for unset absolute axes. The values
* may be used when sent as part of an XI 1.x valuator event. */
for (i = 0; i < valuator_mask_size(mask); i++)
for (i = 0; (i < valuator_mask_size(mask)) && (i < dev->valuator->numAxes); i++)
{
if (valuator_mask_isset(mask, i))
{
......@@ -640,7 +642,7 @@ clipAxis(DeviceIntPtr pDev, int axisNum, int *val)
{
AxisInfoPtr axis;
if (axisNum >= pDev->valuator->numAxes)
if (!pDev->valuator || axisNum >= pDev->valuator->numAxes)
return;
axis = pDev->valuator->axes + axisNum;
......@@ -1185,7 +1187,8 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type, int buttons
if (flags & POINTER_ABSOLUTE)
{
if (flags & POINTER_SCREEN) /* valuators are in screen coords */
if ((flags & POINTER_SCREEN) && /* valuators are in screen coords */
pDev->valuator && (pDev->valuator->numAxes >= 2))
{
int scaled;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment