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 <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2009-01-28 20:52:45 +10:00 committed by Peter Hutterer
parent caade11b84
commit 32adf8d34f

View File

@ -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;
}