aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/Xi/xiquerypointer.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-05-03 13:38:22 +0200
committermarha <marha@users.sourceforge.net>2012-05-03 13:38:22 +0200
commit62068b3bc534d504e40df34847b4436f1a496f35 (patch)
tree7f67aa0910acff5830585e699be4098088244a85 /xorg-server/Xi/xiquerypointer.c
parente67b35e7a899da5805fcce3d390cb10ebcaffe91 (diff)
downloadvcxsrv-62068b3bc534d504e40df34847b4436f1a496f35.tar.gz
vcxsrv-62068b3bc534d504e40df34847b4436f1a496f35.tar.bz2
vcxsrv-62068b3bc534d504e40df34847b4436f1a496f35.zip
xserver mesa git update 3 May 2012
Diffstat (limited to 'xorg-server/Xi/xiquerypointer.c')
-rw-r--r--xorg-server/Xi/xiquerypointer.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/xorg-server/Xi/xiquerypointer.c b/xorg-server/Xi/xiquerypointer.c
index a2e7442e0..169436e14 100644
--- a/xorg-server/Xi/xiquerypointer.c
+++ b/xorg-server/Xi/xiquerypointer.c
@@ -79,10 +79,21 @@ ProcXIQueryPointer(ClientPtr client)
XkbStatePtr state;
char *buttons = NULL;
int buttons_size = 0; /* size of buttons array */
+ XIClientPtr xi_client;
+ Bool have_xi22 = FALSE;
REQUEST(xXIQueryPointerReq);
REQUEST_SIZE_MATCH(xXIQueryPointerReq);
+ /* Check if client is compliant with XInput 2.2 or later. Earlier clients
+ * do not know about touches, so we must report emulated button presses. 2.2
+ * and later clients are aware of touches, so we don't include emulated
+ * button presses in the reply. */
+ xi_client = dixLookupPrivate(&client->devPrivates, XIClientPrivateKey);
+ if (version_compare(xi_client->major_version,
+ xi_client->minor_version, 2, 2) >= 0)
+ have_xi22 = TRUE;
+
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixReadAccess);
if (rc != Success) {
client->errorValue = stuff->deviceid;
@@ -132,7 +143,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 +153,12 @@ ProcXIQueryPointer(ClientPtr client)
if (!buttons)
return BadAlloc;
- down = pDev->button->buttonsDown;
+ for (i = 1; i < pDev->button->numButtons; i++)
+ if (BitIsOn(pDev->button->down, i))
+ SetBit(buttons, pDev->button->map[i]);
- for (i = 0; i < pDev->button->numButtons && down; i++) {
- if (BitIsOn(pDev->button->down, i)) {
- SetBit(buttons, i);
- down--;
- }
- }
+ if (!have_xi22 && pDev->touch && pDev->touch->buttonsDown > 0)
+ SetBit(buttons, pDev->button->map[1]);
}
else
rep.buttons_len = 0;