From 82f42730fa268e85dc95c43a6450c35f9e57acdf Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Mon, 15 Dec 2008 10:46:07 +1000 Subject: [PATCH] mi: force CopyKeyClass for key events. (#19048) While we don't want to copy all other device classes into the VCK, we need to copy the key class to transfer the layout from the SDs into the VCK. This resembles the functionality of SwitchCoreKeyboard in server 1.5. Thanks to Colin Guthrie for providing the follow-up patch (#19222) X.Org Bug 19048 Signed-off-by: Peter Hutterer --- Xi/exevents.c | 2 +- mi/mieq.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/Xi/exevents.c b/Xi/exevents.c index 6141f5e..083bb2f 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -186,7 +186,7 @@ XIGetDevice(xEvent* xE) * This code is basically the old SwitchCoreKeyboard. */ -static void +void CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master) { static DeviceIntPtr lastMapNotifyDevice = NULL; diff --git a/mi/mieq.c b/mi/mieq.c index db48f55..b7392a1 100644 --- a/mi/mieq.c +++ b/mi/mieq.c @@ -298,6 +298,8 @@ CopyGetMasterEvent(DeviceIntPtr mdev, xEvent* original, while (count--) ChangeDeviceID(mdev, &master->event[count]); } +extern void +CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master); /* Call this from ProcessInputEvents(). */ void @@ -360,8 +362,15 @@ mieqProcessInputEvents(void) NewCurrentScreen (dev, DequeueScreen(dev), x, y); } else { - if (master) + if (master) { + /* Force a copy of the key class into the VCK so that the layout + is transferred. */ + if (event->u.u.type == DeviceKeyPress || + event->u.u.type == DeviceKeyRelease) + CopyKeyClass(dev, master); + CopyGetMasterEvent(master, event, masterEvents, nevents); + } /* If someone's registered a custom event handler, let them * steal it. */ -- 1.6.0.6