diff options
Diffstat (limited to 'dix/devices.c')
-rw-r--r-- | dix/devices.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/dix/devices.c b/dix/devices.c index 5bf956ead..15e46a9a5 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -2525,6 +2525,8 @@ RecalculateMasterButtons(DeviceIntPtr slave) if (master->button && master->button->numButtons != maxbuttons) { int i; + int last_num_buttons = master->button->numButtons; + DeviceChangedEvent event = { .header = ET_Internal, .type = ET_DeviceChanged, @@ -2535,6 +2537,14 @@ RecalculateMasterButtons(DeviceIntPtr slave) }; master->button->numButtons = maxbuttons; + if (last_num_buttons < maxbuttons) { + master->button->xkb_acts = xnfreallocarray(master->button->xkb_acts, + maxbuttons, + sizeof(XkbAction)); + memset(&master->button->xkb_acts[last_num_buttons], + 0, + (maxbuttons - last_num_buttons) * sizeof(XkbAction)); + } memcpy(&event.buttons.names, master->button->labels, maxbuttons * sizeof(Atom)); |