sync with OpenBSD -current

This commit is contained in:
purplerain 2023-12-26 01:57:52 +00:00
parent deeab190c1
commit 3c98303280
Signed by: purplerain
GPG key ID: F42C07F07E2E35B7
10 changed files with 24 additions and 13 deletions

View file

@ -611,13 +611,13 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
}
if (from->button->xkb_acts) {
if (!to->button->xkb_acts) {
to->button->xkb_acts = calloc(1, sizeof(XkbAction));
if (!to->button->xkb_acts)
FatalError("[Xi] not enough memory for xkb_acts.\n");
}
size_t maxbuttons = max(to->button->numButtons, from->button->numButtons);
to->button->xkb_acts = xnfreallocarray(to->button->xkb_acts,
maxbuttons,
sizeof(XkbAction));
memset(to->button->xkb_acts, 0, maxbuttons * sizeof(XkbAction));
memcpy(to->button->xkb_acts, from->button->xkb_acts,
sizeof(XkbAction));
from->button->numButtons * sizeof(XkbAction));
}
else {
free(to->button->xkb_acts);