[PATCH] xkb: Add missing support for NoLock and NoUnlock flag output

Ran Benita ran234 at gmail.com
Mon Feb 17 12:00:59 PST 2014


On Sat, Feb 15, 2014 at 05:36:13PM +0100, Andreas Wettstein wrote:
> The LockMods, ISOLock and LockControls support an "affect" flag to selectively
> enable and disable locking and unlocking for these actions.  This change adds
> output of these flags.
> 
> Signed-off-by: Andreas Wettstein <wettstein509 at solnet.ch>

This duplication with xkbfile really sucks..

Reviewed-By: Ran Benita <ran234 at gmail.com>

> ---
>  xkb/xkbtext.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 46 insertions(+), 2 deletions(-)
> 
> diff --git a/xkb/xkbtext.c b/xkb/xkbtext.c
> index fdf1d17..5d5f842 100644
> --- a/xkb/xkbtext.c
> +++ b/xkb/xkbtext.c
> @@ -749,8 +749,22 @@ CopyModActionArgs(XkbDescPtr xkb, XkbAction *action, char *buf, int *sz)
>      }
>      else
>          TryCopyStr(buf, "none", sz);
> -    if (act->type == XkbSA_LockMods)
> +    if (act->type == XkbSA_LockMods) {
> +        switch (act->flags & (XkbSA_LockNoUnlock | XkbSA_LockNoLock)) {
> +        case XkbSA_LockNoLock:
> +            TryCopyStr(buf, ",affect=unlock", sz);
> +            break;
> +        case XkbSA_LockNoUnlock:
> +            TryCopyStr(buf, ",affect=lock", sz);
> +            break;
> +        case XkbSA_LockNoUnlock|XkbSA_LockNoLock:
> +            TryCopyStr(buf, ",affect=neither", sz);
> +            break;
> +        default:
> +            break;
> +        }
>          return TRUE;
> +    }
>      if (act->flags & XkbSA_ClearLocks)
>          TryCopyStr(buf, ",clearLocks", sz);
>      if (act->flags & XkbSA_LatchToLock)
> @@ -901,8 +915,12 @@ CopyISOLockArgs(XkbDescPtr xkb, XkbAction *action, char *buf, int *sz)
>              TryCopyStr(buf, "none", sz);
>      }
>      TryCopyStr(buf, ",affect=", sz);
> -    if ((act->affect & XkbSA_ISOAffectMask) == 0)
> +    if ((act->affect & XkbSA_ISOAffectMask) == 0) {
>          TryCopyStr(buf, "all", sz);
> +    }
> +    else if ((act->affect & XkbSA_ISOAffectMask) == XkbSA_ISOAffectMask) {
> +        TryCopyStr(buf, "none", sz);
> +    }
>      else {
>          int nOut = 0;
>  
> @@ -926,6 +944,18 @@ CopyISOLockArgs(XkbDescPtr xkb, XkbAction *action, char *buf, int *sz)
>              nOut++;
>          }
>      }
> +    switch (act->flags & (XkbSA_LockNoUnlock | XkbSA_LockNoLock)) {
> +    case XkbSA_LockNoLock:
> +        TryCopyStr(buf, "+unlock", sz);
> +        break;
> +    case XkbSA_LockNoUnlock:
> +        TryCopyStr(buf, "+lock", sz);
> +        break;
> +    case XkbSA_LockNoUnlock | XkbSA_LockNoLock:
> +        TryCopyStr(buf, "+neither", sz);
> +        break;
> +    default: ;
> +    }
>      return TRUE;
>  }
>  
> @@ -1037,6 +1067,20 @@ CopySetLockControlsArgs(XkbDescPtr xkb, XkbAction *action, char *buf, int *sz)
>              nOut++;
>          }
>      }
> +    if (action->type == XkbSA_LockControls) {
> +        switch (act->flags & (XkbSA_LockNoUnlock | XkbSA_LockNoLock)) {
> +        case XkbSA_LockNoLock:
> +            TryCopyStr(buf, ",affect=unlock", sz);
> +            break;
> +        case XkbSA_LockNoUnlock:
> +            TryCopyStr(buf, ",affect=lock", sz);
> +            break;
> +        case XkbSA_LockNoUnlock | XkbSA_LockNoLock:
> +            TryCopyStr(buf, ",affect=neither", sz);
> +            break;
> +        default: ;
> +        }
> +   }
>      return TRUE;
>  }
>  
> -- 
> 1.8.3.1
> 


More information about the xorg-devel mailing list