View | Details | Raw Unified | Return to bug 1217765
Collapse All | Expand All

(-)a/Xi/exevents.c (-2 / +6 lines)
Lines 612-623 DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to) Link Here
612
612
613
        if (from->button->xkb_acts) {
613
        if (from->button->xkb_acts) {
614
            if (!to->button->xkb_acts) {
614
            if (!to->button->xkb_acts) {
615
                to->button->xkb_acts = calloc(1, sizeof(XkbAction));
615
                to->button->xkb_acts = calloc(from->button->numButtons, sizeof(XkbAction));
616
                if (!to->button->xkb_acts)
616
                if (!to->button->xkb_acts)
617
                    FatalError("[Xi] not enough memory for xkb_acts.\n");
617
                    FatalError("[Xi] not enough memory for xkb_acts.\n");
618
            } else {
619
                to->button->xkb_acts = xnfreallocarray(to->button->xkb_acts,
620
                                                       from->button->numButtons,
621
                                                       sizeof(XkbAction));
618
            }
622
            }
619
            memcpy(to->button->xkb_acts, from->button->xkb_acts,
623
            memcpy(to->button->xkb_acts, from->button->xkb_acts,
620
                   sizeof(XkbAction));
624
                   from->button->numButtons * sizeof(XkbAction));
621
        }
625
        }
622
        else {
626
        else {
623
            free(to->button->xkb_acts);
627
            free(to->button->xkb_acts);
(-)a/dix/devices.c (-1 / +11 lines)
Lines 2530-2535 RecalculateMasterButtons(DeviceIntPtr slave) Link Here
2530
2530
2531
    if (master->button && master->button->numButtons != maxbuttons) {
2531
    if (master->button && master->button->numButtons != maxbuttons) {
2532
        int i;
2532
        int i;
2533
        int last_num_buttons = master->button->numButtons;
2534
2533
        DeviceChangedEvent event = {
2535
        DeviceChangedEvent event = {
2534
            .header = ET_Internal,
2536
            .header = ET_Internal,
2535
            .type = ET_DeviceChanged,
2537
            .type = ET_DeviceChanged,
Lines 2540-2545 RecalculateMasterButtons(DeviceIntPtr slave) Link Here
2540
        };
2542
        };
2541
2543
2542
        master->button->numButtons = maxbuttons;
2544
        master->button->numButtons = maxbuttons;
2545
        if (last_num_buttons < maxbuttons) {
2546
            master->button->xkb_acts = xnfreallocarray(master->button->xkb_acts,
2547
                                                       maxbuttons,
2548
                                                       sizeof(XkbAction));
2549
            memset(&master->button->xkb_acts[last_num_buttons],
2550
                   0,
2551
                   (maxbuttons - last_num_buttons) * sizeof(XkbAction));
2552
        }
2553
2543
2554
2544
        memcpy(&event.buttons.names, master->button->labels, maxbuttons *
2555
        memcpy(&event.buttons.names, master->button->labels, maxbuttons *
2545
               sizeof(Atom));
2556
               sizeof(Atom));
2546
- 

Return to bug 1217765