[PATCH 1/2] Report logical button state in ProcXIQueryPointer
Peter Hutterer
peter.hutterer at who-t.net
Mon Apr 30 23:45:37 PDT 2012
On Fri, Apr 20, 2012 at 11:07:17AM -0700, Chase Douglas wrote:
> Physical button state is usually meaningless to an X client.
>
> Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
> ---
> Xi/xiquerypointer.c | 12 ++++--------
> 1 files changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/Xi/xiquerypointer.c b/Xi/xiquerypointer.c
> index a2e7442..e2a940c 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,10 @@ 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)) {
> + for (i = 0; i < pDev->button->numButtons; i++)
> + /* Logical button state is stored as core protocol mask bits */
> + if (BitIsOn(&pDev->button->state, 8 + i))
> SetBit(buttons, i);
> - down--;
> - }
> - }
> }
> else
> rep.buttons_len = 0;
> --
> 1.7.9.1
look at event_set_state() in dix/inpututils.c and re-use the loop there
please.
Cheers,
Peter
More information about the xorg-devel
mailing list