summaryrefslogtreecommitdiff
path: root/xkb
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2011-05-03 02:59:53 +0100
committerPeter Hutterer <peter.hutterer@who-t.net>2011-05-06 13:15:24 +1000
commitc7634498d4cd42c8571805122224dc2d0e44a585 (patch)
tree8e5b62795407c50b6519f8d267cbcd27547b1e2d /xkb
parentb8540d18c7d3a0f93f9e2565a410986eddedcecb (diff)
XKB: Remove duplicate keymap-copying loop
Previously we had: foreach (device + slaves of device) { XkbCopyDeviceKeymap(i, device); [...] } if (device was last slave of its MD) { XkbCopyDeviceKeymap(master, device); } and now: foreach (device + slaves of device + MD if device was last slave) { XkbCopyDeviceKeymap(i, device); [...] } As an extra bonus, when changing the keymap on a slave device, we now ensure the LED info on the master is kept in sync. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'xkb')
-rw-r--r--xkb/xkb.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/xkb/xkb.c b/xkb/xkb.c
index e17e216c1..4d21200db 100644
--- a/xkb/xkb.c
+++ b/xkb/xkb.c
@@ -5586,6 +5586,7 @@ ProcXkbGetKbdByName(ClientPtr client)
{
DeviceIntPtr dev;
DeviceIntPtr tmpd;
+ DeviceIntPtr master;
xkbGetKbdByNameReply rep = {0};
xkbGetMapReply mrep = {0};
xkbGetCompatMapReply crep = {0};
@@ -5611,6 +5612,7 @@ ProcXkbGetKbdByName(ClientPtr client)
return BadAccess;
CHK_KBD_DEVICE(dev, stuff->deviceSpec, client, access_mode);
+ master = GetMaster(dev, MASTER_KEYBOARD);
xkb = dev->key->xkbInfo->desc;
status= Success;
@@ -5869,8 +5871,12 @@ ProcXkbGetKbdByName(ClientPtr client)
}
xkb->ctrls->num_groups= nTG;
+ /* Update the map and LED info on the device itself, as well as
+ * any slaves if it's an MD, or its MD if it's an SD and was the
+ * last device used on that MD. */
for (tmpd = inputInfo.devices; tmpd; tmpd = tmpd->next) {
- if (tmpd != dev && GetMaster(tmpd, MASTER_KEYBOARD) != dev)
+ if (tmpd != dev && GetMaster(tmpd, MASTER_KEYBOARD) != dev &&
+ (tmpd != master || dev != master->lastSlave))
continue;
if (tmpd != dev)
@@ -5900,12 +5906,6 @@ ProcXkbGetKbdByName(ClientPtr client)
if (geom_changed)
nkn.changed|= XkbNKN_GeometryMask;
XkbSendNewKeyboardNotify(dev,&nkn);
-
- if (!IsMaster(dev)) {
- DeviceIntPtr master = GetMaster(dev, MASTER_KEYBOARD);
- if (master && master->lastSlave == dev)
- XkbCopyDeviceKeymap(master, dev);
- }
}
if ((new!=NULL)&&(new!=xkb)) {
XkbFreeKeyboard(new,XkbAllComponentsMask,TRUE);