mirror of
https://github.com/X11Libre/xf86-input-libinput.git
synced 2026-03-24 09:34:04 +00:00
Init the right number of buttons for pointer devices
This only makes room for the highest button number present on the device, it doesn't cater for devices with 'holes'. i.e. if a device has only BTN_BACK, it will initialize buttons for all below too. Which is also evdev's current behavior. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
@@ -246,11 +246,19 @@ xf86libinput_init_pointer(InputInfoPtr pInfo)
|
||||
struct xf86libinput *driver_data = pInfo->private;
|
||||
int min, max, res;
|
||||
int nbuttons = 7;
|
||||
int i;
|
||||
|
||||
unsigned char btnmap[MAX_BUTTONS + 1];
|
||||
Atom btnlabels[MAX_BUTTONS];
|
||||
Atom axislabels[TOUCHPAD_NUM_AXES];
|
||||
|
||||
for (i = BTN_BACK; i >= BTN_SIDE; i--) {
|
||||
if (libinput_device_has_button(driver_data->device, i)) {
|
||||
nbuttons += i - BTN_SIDE + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
init_button_map(btnmap, ARRAY_SIZE(btnmap));
|
||||
init_button_labels(btnlabels, ARRAY_SIZE(btnlabels));
|
||||
init_axis_labels(axislabels, ARRAY_SIZE(axislabels));
|
||||
|
||||
Reference in New Issue
Block a user