Commit d9c212d2 authored by Peter Hutterer's avatar Peter Hutterer

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's avatarPeter Hutterer <>
parent d48f437a
......@@ -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;
init_button_map(btnmap, ARRAY_SIZE(btnmap));
init_button_labels(btnlabels, ARRAY_SIZE(btnlabels));
init_axis_labels(axislabels, ARRAY_SIZE(axislabels));
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment