[PATCH xserver] xkb: XkbSetMap on the lastSlave needs to change the master

Peter Hutterer peter.hutterer at who-t.net
Tue Mar 6 04:50:00 UTC 2018


On Sat, Mar 03, 2018 at 01:41:12AM +0000, Samir Benmendil wrote:
> The layout needs to be set on the master too if the layout is changed on
> the device that was last used by the master.
> 
> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=85256
> Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=91571
> 
> Signed-off-by: Samir Benmendil <me at rmz.io>
> ---
>  xkb/xkb.c | 26 +++++++++++++++++++++++++-
>  1 file changed, 25 insertions(+), 1 deletion(-)
> 
> diff --git a/xkb/xkb.c b/xkb/xkb.c
> index 678f82368..12460034b 100644
> --- a/xkb/xkb.c
> +++ b/xkb/xkb.c
> @@ -2626,6 +2626,8 @@ ProcXkbSetMap(ClientPtr client)
>      if (rc != Success)
>          return rc;
>  
> +    DeviceIntPtr master = GetMaster(dev, MASTER_KEYBOARD);
> +
>      if (stuff->deviceSpec == XkbUseCoreKbd) {
>          DeviceIntPtr other;
>  
> @@ -2641,9 +2643,21 @@ ProcXkbSetMap(ClientPtr client)
>                  }
>              }
>          }
> +    } else {
> +        DeviceIntPtr other;
> +
> +        for (other = inputInfo.devices; other; other = other->next) {
> +            if (other != dev && GetMaster(other, MASTER_KEYBOARD) != dev &&
> +                (other != master || dev != master->lastSlave))
> +                continue;

wouldn't this be sufficient here:
        if (master && master->lastSlave == dev) {
                rc = _XkbSetMapChecks(client, other, stuff, tmp);
                ...
        }

there can only be one master keyboard per slave and it can only have one
lastSlave.

> +
> +            rc = _XkbSetMapChecks(client, other, stuff, tmp);
> +            if (rc != Success)
> +                return rc;
> +        }
>      }
>  
> -    /* We know now that we will succed with the SetMap. In theory anyway. */
> +    /* We know now that we will succeed with the SetMap. In theory anyway. */
>      rc = _XkbSetMap(client, dev, stuff, tmp);
>      if (rc != Success)
>          return rc;
> @@ -2664,6 +2678,16 @@ ProcXkbSetMap(ClientPtr client)
>                     sync. */
>              }
>          }
> +    } else {
> +        DeviceIntPtr other;
> +
> +        for (other = inputInfo.devices; other; other = other->next) {
> +            if (other != dev && GetMaster(other, MASTER_KEYBOARD) != dev &&
> +                (other != master || dev != master->lastSlave))
> +                continue;
> +
> +            _XkbSetMap(client, other, stuff, tmp); //ignore rc

same as above

Cheers,
   Peter
 
> +        }
>      }
>  
>      return Success;
> -- 
> 2.14.2
> 
> _______________________________________________
> xorg-devel at lists.x.org: X.Org development
> Archives: http://lists.x.org/archives/xorg-devel
> Info: https://lists.x.org/mailman/listinfo/xorg-devel
> 


More information about the xorg-devel mailing list