[PATCH xserver 2/2] Xi: Fix passive key grabs on XIAll[Master]Devices

Peter Hutterer peter.hutterer at who-t.net
Thu Sep 1 21:43:50 PDT 2011


On Wed, Aug 31, 2011 at 12:46:53AM +0200, carlosg at gnome.org wrote:
> From: Carlos Garnacho <carlosg at gnome.org>
> 
> The KeyClass is not set for these DeviceIntRec, but it's only used
> for XI1 grabs in order to check the XKB keycode range, and
> XIAll[Master]Devices doesn't apply there. So only spare the NULL
> check for XI grabs.
> 
> Signed-off-by: Carlos Garnacho <carlosg at gnome.org>
> ---
>  Xi/exevents.c |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/Xi/exevents.c b/Xi/exevents.c
> index 3e3c67b..b279972 100644
> --- a/Xi/exevents.c
> +++ b/Xi/exevents.c
> @@ -1441,10 +1441,11 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
>      rc = CheckGrabValues(client, param);
>      if (rc != Success)
>          return rc;
> -    if (k == NULL)
> -	return BadMatch;
>      if (grabtype == GRABTYPE_XI)
>      {
> +        if (k == NULL)
> +            return BadMatch;
> +

this should have an additional check for the device ID, otherwise we'll
allow key grabs on slave pointers too.

Cheers,
  Peter

>          if ((key > k->xkbInfo->desc->max_key_code ||
>                      key < k->xkbInfo->desc->min_key_code)
>                  && (key != AnyKey)) {
> -- 
> 1.7.6
> 


More information about the xorg-devel mailing list