diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-04-16 11:06:52 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-04-19 22:28:11 +1000 |
commit | 74d0fc3aee05bc4f505274d81dd44c0d2b4368ff (patch) | |
tree | a3c61317943e2ab8942bbd7d0b547a0802856030 /dix/devices.c | |
parent | edb70caf21fa5da3c336c47c62218a3f05c635b8 (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/devices.c')
-rw-r--r-- | dix/devices.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/dix/devices.c b/dix/devices.c index ed6e6bdd4..1c702dc49 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -1088,6 +1088,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)); |