Xi: don't care about CoreDevicePrivateKey when copying keys

If we get here, we must copy.

Signed-off-by: Peter Hutterer <peter.hutterer@redhat.com>
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
This commit is contained in:
Peter Hutterer 2008-08-14 17:21:28 +09:30 committed by Daniel Stone
parent 23862ede59
commit 58a6b5b9ef

View File

@ -203,8 +203,6 @@ CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master)
dk = device->key; dk = device->key;
mk = master->key; mk = master->key;
if (device != dixLookupPrivate(&master->devPrivates,
CoreDevicePrivateKey)) {
memcpy(mk->modifierMap, dk->modifierMap, MAP_LENGTH); memcpy(mk->modifierMap, dk->modifierMap, MAP_LENGTH);
if (dk->maxKeysPerModifier) if (dk->maxKeysPerModifier)
@ -245,25 +243,16 @@ CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master)
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
mk->modifierKeyCount[i] = dk->modifierKeyCount[i]; mk->modifierKeyCount[i] = dk->modifierKeyCount[i];
#ifdef XKB if (dk->xkbInfo && dk->xkbInfo->desc) {
if (!noXkbExtension && dk->xkbInfo && dk->xkbInfo->desc) { if (!mk->xkbInfo || !mk->xkbInfo->desc) {
if (!mk->xkbInfo || !mk->xkbInfo->desc)
{
XkbInitDevice(master); XkbInitDevice(master);
XkbFinishDeviceInit(master); XkbFinishDeviceInit(master);
} }
if (!XkbCopyKeymap(dk->xkbInfo->desc, mk->xkbInfo->desc, True)) if (!XkbCopyKeymap(dk->xkbInfo->desc, mk->xkbInfo->desc, True))
FatalError("Couldn't pivot keymap from device to core!\n"); FatalError("Couldn't pivot keymap from device to core!\n");
} }
#endif
dixSetPrivate(&master->devPrivates, CoreDevicePrivateKey, device); if (lastMapNotifyDevice != master) {
sendNotify = TRUE;
} else if (lastMapNotifyDevice != master)
sendNotify = TRUE;
if (sendNotify)
{
SendMappingNotify(master, MappingKeyboard, SendMappingNotify(master, MappingKeyboard,
mk->curKeySyms.minKeyCode, mk->curKeySyms.minKeyCode,
(mk->curKeySyms.maxKeyCode - (mk->curKeySyms.maxKeyCode -
@ -271,6 +260,13 @@ CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master)
serverClient); serverClient);
lastMapNotifyDevice = master; lastMapNotifyDevice = master;
} }
/* Copy the state here. This means we'll only have consistency
* between state and active keymap, rather than between state and
* keycodes pressed, but there's pretty much no way to win here,
* so might as well go for the one that would seem to give the
* least nonsensical result. */
mk->xkbInfo->state = dk->xkbInfo->state;
} }
/** /**