[PATCH REVISED] xkb: Support NoLock and NoUnlock for LockControls

Ran Benita ran234 at gmail.com
Fri Feb 21 10:45:07 PST 2014


On Thu, Feb 20, 2014 at 08:38:14PM +0100, Andreas Wettstein wrote:
> The XKB protocol specification demands support for these flags.
> 
> Signed-off-by: Andreas Wettstein <wettstein509 at solnet.ch>
> ---
>  xkb/xkbActions.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
> index 382cf7e..21955b6 100644
> --- a/xkb/xkbActions.c
> +++ b/xkb/xkbActions.c
> @@ -759,7 +759,7 @@ _XkbFilterControls(XkbSrvInfoPtr xkbi,
>          filter->active = 1;
>          filter->filterOthers = 0;
>          change = XkbActionCtrls(&pAction->ctrls);
> -        filter->priv = change;
> +        filter->priv = change & ~ctrls->enabled_ctrls;

OK, I had to look a bit at this. I got confused, but then I saw
LockControls isn't really supposed to behave like LockMods, it doesn't
lock the ctrls, it actually *toggles* them (I don't really understand
why though).
Anyway, though a bit hard to see, this change covers all bases
correctly according to the spec, and the below hunks are good as well,
so:

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

Thanks,
Ran

>          filter->filter = _XkbFilterControls;
>          filter->upAction = *pAction;
>  
> @@ -772,7 +772,10 @@ _XkbFilterControls(XkbSrvInfoPtr xkbi,
>              xkbControlsNotify cn;
>              XkbSrvLedInfoPtr sli;
>  
> -            ctrls->enabled_ctrls |= change;
> +            if (pAction->type != XkbSA_LockControls ||
> +                !(pAction->ctrls.flags & XkbSA_LockNoLock))
> +                ctrls->enabled_ctrls |= change;
> +
>              if (XkbComputeControlsNotify(kbd, &old, ctrls, &cn, FALSE)) {
>                  cn.keycode = keycode;
>                  /* XXX: what about DeviceKeyPress? */
> @@ -801,7 +804,10 @@ _XkbFilterControls(XkbSrvInfoPtr xkbi,
>              xkbControlsNotify cn;
>              XkbSrvLedInfoPtr sli;
>  
> -            ctrls->enabled_ctrls &= ~change;
> +            if (filter->upAction.type != XkbSA_LockControls ||
> +                !(filter->upAction.ctrls.flags & XkbSA_LockNoUnlock))
> +                ctrls->enabled_ctrls &= ~change;
> +
>              if (XkbComputeControlsNotify(kbd, &old, ctrls, &cn, FALSE)) {
>                  cn.keycode = keycode;
>                  cn.eventType = KeyRelease;
> -- 
> 1.8.3.1
> 


More information about the xorg-devel mailing list