[PATCH] Correct modifier map built when ProcSetModifierMapping is called

Peter Hutterer peter.hutterer at who-t.net
Tue Aug 4 22:43:43 PDT 2009


On Mon, Aug 03, 2009 at 11:49:56PM -0700, Alan Coopersmith wrote:
> 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 at sun.com>
> ---
>  dix/inpututils.c |    6 ++----
>  1 files changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/dix/inpututils.c b/dix/inpututils.c
> index 378deb0..66936c9 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;
> -- 
> 1.5.6.5

Pushed, thanks for the patch.
 
Cheers,
  Peter


More information about the xorg-devel mailing list