summaryrefslogtreecommitdiff
path: root/dix/inpututils.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@sun.com>2009-08-03 23:49:56 -0700
committerPeter Hutterer <peter.hutterer@who-t.net>2009-08-05 11:15:54 +1000
commit95b678e6dc41f2524ada4eb11289687fafce7588 (patch)
treeb18626a5677b01c6d8e989220a81b6f723d9bb05 /dix/inpututils.c
parent4ca305956e5ea6f606b22ef62aa462186a7b95f0 (diff)
Correct modifier map built when ProcSetModifierMapping is called
Fixes xmodmap changes to modifiers to stop corrupting modifier maps Previous code had two bugs: - the code to increment mod was after the code to continue if no modifier was set, so mod wouldn't be incremented for modifiers with no keys mapped to them (such as if you called xmodmap -e 'clear Lock') - the value it set in the modifier map was the raw modifier number, not the bitmask value for that modifier Signed-off-by: Alan Coopersmith <alan.coopersmith@sun.com> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix/inpututils.c')
-rw-r--r--dix/inpututils.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/dix/inpututils.c b/dix/inpututils.c
index 378deb0e0..66936c968 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -227,7 +227,7 @@ do_modmap_change(ClientPtr client, DeviceIntPtr dev, CARD8 *modmap)
static int build_modmap_from_modkeymap(CARD8 *modmap, KeyCode *modkeymap,
int max_keys_per_mod)
{
- int i, mod = 0, len = max_keys_per_mod * 8;
+ int i, len = max_keys_per_mod * 8;
memset(modmap, 0, MAP_LENGTH);
@@ -241,9 +241,7 @@ static int build_modmap_from_modkeymap(CARD8 *modmap, KeyCode *modkeymap,
if (modmap[modkeymap[i]])
return BadValue;
- if (!(i % max_keys_per_mod))
- mod++;
- modmap[modkeymap[i]] = mod;
+ modmap[modkeymap[i]] = 1 << (i / max_keys_per_mod);
}
return Success;