[PATCH 1/2] Report logical button state in ProcXIQueryPointer
Chase Douglas
chase.douglas at canonical.com
Fri Apr 20 11:07:17 PDT 2012
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
More information about the xorg-devel
mailing list