From 95b678e6dc41f2524ada4eb11289687fafce7588 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Mon, 3 Aug 2009 23:49:56 -0700 Subject: [PATCH] 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 Signed-off-by: Peter Hutterer --- dix/inpututils.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/dix/inpututils.c b/dix/inpututils.c index 378deb0e09..66936c9681 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;