aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/Xi/queryst.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/Xi/queryst.c')
-rw-r--r--xorg-server/Xi/queryst.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/xorg-server/Xi/queryst.c b/xorg-server/Xi/queryst.c
index 2ba1edb63..78b97a769 100644
--- a/xorg-server/Xi/queryst.c
+++ b/xorg-server/Xi/queryst.c
@@ -96,7 +96,7 @@ ProcXQueryDeviceState(ClientPtr client)
rep.sequenceNumber = client->sequence;
rc = dixLookupDevice(&dev, stuff->deviceid, client, DixReadAccess);
- if (rc != Success)
+ if (rc != Success && rc != BadAccess)
return rc;
v = dev->valuator;
@@ -130,8 +130,9 @@ ProcXQueryDeviceState(ClientPtr client)
tk->length = sizeof(xKeyState);
tk->num_keys = k->xkbInfo->desc->max_key_code -
k->xkbInfo->desc->min_key_code + 1;
- for (i = 0; i < 32; i++)
- tk->keys[i] = k->down[i];
+ if (rc != BadAccess)
+ for (i = 0; i < 32; i++)
+ tk->keys[i] = k->down[i];
buf += sizeof(xKeyState);
}
@@ -140,7 +141,8 @@ ProcXQueryDeviceState(ClientPtr client)
tb->class = ButtonClass;
tb->length = sizeof(xButtonState);
tb->num_buttons = b->numButtons;
- memcpy(tb->buttons, b->down, sizeof(b->down));
+ if (rc != BadAccess)
+ memcpy(tb->buttons, b->down, sizeof(b->down));
buf += sizeof(xButtonState);
}
@@ -152,7 +154,9 @@ ProcXQueryDeviceState(ClientPtr client)
tv->mode = v->mode;
buf += sizeof(xValuatorState);
for (i = 0, values = v->axisVal; i < v->numAxes; i++) {
- *((int *)buf) = *values++;
+ if (rc != BadAccess)
+ *((int *)buf) = *values;
+ values++;
if (client->swapped) {
swapl((int *)buf, n); /* macro - braces needed */
}