blob: d1c3d0fb6aaf17fb0c1d274be0a0e471ab59f976 [file] [log] [blame]
From 10a764c329681336d7605a5632716499480cbe5d Mon Sep 17 00:00:00 2001
From: Daniel Kurtz <djkurtz@chromium.org>
Date: Fri, 30 Mar 2012 08:55:35 +0800
Subject: [PATCH] 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: Daniel Kurtz <djkurtz@chromium.org>
---
dix/getevents.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/dix/getevents.c b/dix/getevents.c
index 151d82a..06390cd 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -838,7 +838,7 @@ scale_to_desktop(DeviceIntPtr dev, ValuatorMask *mask,
ScreenPtr scr = miPointerGetScreen(dev);
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 we have no axes, last.valuators must be in screen coords
--
1.7.7.3