dix: remove superfluous loop in change_modmap.

A device can only be attached to a single master device. So instead of
looping and searching for the master device, we can just use dev->u.master
directly.

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer 2009-05-20 14:38:25 +10:00
parent b89dcfbfbd
commit 42719ce5c7

View File

@ -275,14 +275,10 @@ change_modmap(ClientPtr client, DeviceIntPtr dev, KeyCode *modkeymap,
do_modmap_change(client, tmp, modmap);
}
}
else {
for (tmp = inputInfo.devices; tmp; tmp = tmp->next) {
if (tmp->isMaster && tmp->u.lastSlave == dev) {
/* If this fails, expect the results to be weird. */
if (check_modmap_change(client, tmp, modmap))
do_modmap_change(client, tmp, modmap);
}
}
else if (dev->u.master && dev->u.master->u.lastSlave == dev) {
/* If this fails, expect the results to be weird. */
if (check_modmap_change(client, dev->u.master, modmap))
do_modmap_change(client, dev->u.master, modmap);
}
return Success;