From 32adf8d34fb7db9b78859241f2670349b75c3f7e Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 28 Jan 2009 20:52:45 +1000 Subject: [PATCH] Xi: If the MD doesn't have a key/kbdfeed class, init the keyboard. This fixes crashes on mouse/keyboard combos where the mouse is both a keyboard and a mouse. Upon copying the SD's key info into the VCP, the NULL xkbInfo of the VCP would crash the server. Signed-off-by: Peter Hutterer --- Xi/exevents.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index 2a161f047..34e9e7317 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -237,7 +237,14 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to) { classes = dixLookupPrivate(&to->devPrivates, UnusedClassesPrivateKey); + to->kbdfeed = classes->kbdfeed; + if (!to->kbdfeed) + { + XkbRMLVOSet rmlvo; + XkbGetRulesDflts(&rmlvo); + InitKeyboardDeviceStruct(to, &rmlvo, NULL, NULL); + } } k = &to->kbdfeed; @@ -481,9 +488,9 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to) to->key = classes->key; if (!to->key) { - to->key = xcalloc(1, sizeof(KeyClassRec)); - if (!to->key) - FatalError("[Xi] no memory for class shift.\n"); + XkbRMLVOSet rmlvo; + XkbGetRulesDflts(&rmlvo); + InitKeyboardDeviceStruct(to, &rmlvo, NULL, NULL); } else classes->key = NULL; }