Commit 15607cf2 authored by Daniel Kurtz's avatar Daniel Kurtz Committed by Jeremy Huddleston Sequoia

dix: don't BUG_WARN for button events from button-only device

Events from button-only devices still need coordinates, and they get them
from scale_to_desktop().  Therefore, a dev without valuators is not a bug.
However, a dev with valuators, but less than two of them still is a bug.

This was noticed when unplugging a "Creative Technology SB Arena Headset",
which has some BTNs and some KEYs, but no REL or ABS valuators.
It emits [BTN_3] = 0 on unplug, which would trigger the BUG_WARN.
Signed-off-by: default avatarDaniel Kurtz <djkurtz@chromium.org>
Reviewed-by: default avatarChase Douglas <chase.douglas@canonical.com>
Signed-off-by: Peter Hutterer's avatarPeter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit c5a45b0f)
parent 3ad72a80
...@@ -842,7 +842,7 @@ scale_to_desktop(DeviceIntPtr dev, ValuatorMask *mask, ...@@ -842,7 +842,7 @@ scale_to_desktop(DeviceIntPtr dev, ValuatorMask *mask,
ScreenPtr scr = miPointerGetScreen(dev); ScreenPtr scr = miPointerGetScreen(dev);
double x, y; double x, y;
BUG_WARN(!dev->valuator || dev->valuator->numAxes < 2); BUG_WARN(dev->valuator && dev->valuator->numAxes < 2);
if (!dev->valuator || dev->valuator->numAxes < 2) { if (!dev->valuator || dev->valuator->numAxes < 2) {
/* if we have no axes, last.valuators must be in screen coords /* if we have no axes, last.valuators must be in screen coords
* anyway */ * anyway */
......
Markdown is supported
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