Only initialize the number of buttons we actually have.

This takes into account driver-configured button mappings, i.e. if device
with one button has this button mapped to 25 through the ButtonMapping
option, the X server will think the device has result 25 buttons.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 255b9f6bbf)
This commit is contained in:
Peter Hutterer
2009-05-21 10:23:37 +10:00
parent b8519930e4
commit 1432b5153e

View File

@@ -1095,9 +1095,7 @@ EvdevAddButtonClass(DeviceIntPtr device)
pInfo = device->public.devicePrivate;
pEvdev = pInfo->private;
/* FIXME: count number of actual buttons */
if (!InitButtonClassDeviceStruct(device, ArrayLength(pEvdev->btnmap),
pEvdev->btnmap))
if (!InitButtonClassDeviceStruct(device, pEvdev->buttons, pEvdev->btnmap))
return !Success;
return Success;