summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-04-16 11:06:52 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-04-21 13:11:51 +1000
commite2e5932bda3f473629d4be6f3ca4dcab18993eb6 (patch)
tree51a2164b388bf24e2e22d929e03cf533cc370803 /dix
parent063833f3a6d9f8f657e3de309c8d6d5c3d606513 (diff)
dix: don't allow more than MAX_VALUATORS on one device.
Some keyboards (?) advertise more than MAX_VALUATORS axes. Parts of the internal event delivery relies on not having more than MAX_VALUATOR axes, so let's cap it down. If there's real devices that require more than the current 36, I'm sure we can bump this up. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix')
-rw-r--r--dix/devices.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/dix/devices.c b/dix/devices.c
index d14eddd72..9f56842f6 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1081,6 +1081,14 @@ InitValuatorClassDeviceStruct(DeviceIntPtr dev, int numAxes,
if (!dev)
return FALSE;
+ if (numAxes >= MAX_VALUATORS)
+ {
+ LogMessage(X_WARNING,
+ "Device '%s' has %d axes, only using first %d.\n",
+ dev->name, numAxes, MAX_VALUATORS);
+ numAxes = MAX_VALUATORS;
+ }
+
valc = (ValuatorClassPtr)xcalloc(1, sizeof(ValuatorClassRec) +
numAxes * sizeof(AxisInfo) +
numAxes * sizeof(unsigned int));