From aa6687322de85a2d1025a3ae851fb290a089b2d3 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Tue, 15 Apr 2008 23:03:06 +0930 Subject: [PATCH] Xi: when copying button classes, copy xkb_acts as well. This should be the last piece in the quest for the class copy. --- Xi/exevents.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index f41250821..a828044fa 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -247,8 +247,6 @@ CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master) * Copies the feedback classes from device "from" into device "to". Classes * are duplicated (not just flipping the pointers). All feedback classes are * linked lists, the full list is duplicated. - * - * XXX: some XKB stuff is still missing. */ static void DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to) @@ -622,8 +620,18 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to) } } #ifdef XKB - to->button->xkb_acts = NULL; - /* XXX: XkbAction needs to be copied */ + if (from->button->xkb_acts) + { + if (!to->button->xkb_acts) + { + to->button->xkb_acts = xcalloc(1, sizeof(XkbAction)); + if (!to->button->xkb_acts) + FatalError("[Xi] not enough memory for xkb_acts.\n"); + } + memcpy(to->button->xkb_acts, from->button->xkb_acts, + sizeof(XkbAction)); + } else + xfree(to->button->xkb_acts); #endif } else if (to->button && !from->button) {