[PATCH v2 1/2] Report logical button state in ProcXIQueryPointer

Peter Hutterer peter.hutterer at who-t.net
Tue May 1 16:38:20 PDT 2012


On Tue, May 01, 2012 at 10:21:11AM -0700, Chase Douglas wrote:
> Physical button state is usually meaningless to an X client.
> 
> Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
> ---
> Changes since v1:
> * Copy loop from event_set_state() for setting button mask
> 
>  Xi/xiquerypointer.c |   13 ++++---------
>  1 file changed, 4 insertions(+), 9 deletions(-)
> 
> diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c
> index a2e7442..ba99752 100644
> --- a/Xi/xiquerypointer.c
> +++ b/Xi/xiquerypointer.c
> @@ -132,7 +132,7 @@ ProcXIQueryPointer(ClientPtr client)
>      }
>  
>      if (pDev->button) {
> -        int i, down;
> +        int i;
>  
>          rep.buttons_len =
>              bytes_to_int32(bits_to_bytes(pDev->button->numButtons));
> @@ -142,14 +142,9 @@ ProcXIQueryPointer(ClientPtr client)
>          if (!buttons)
>              return BadAlloc;
>  
> -        down = pDev->button->buttonsDown;
> -
> -        for (i = 0; i < pDev->button->numButtons && down; i++) {
> -            if (BitIsOn(pDev->button->down, i)) {
> -                SetBit(buttons, i);
> -                down--;
> -            }
> -        }
> +        for (i = 1; i < pDev->button->numButtons; i++)
> +            if (BitIsOn(pDev->button->down, i))
> +                SetBit(buttons, pDev->button->map[i]);
>      }
>      else
>          rep.buttons_len = 0;
> -- 
> 1.7.9.5

both merged, thanks.

Cheers,
  Peter


More information about the xorg-devel mailing list