summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-06-11 15:40:56 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-06-12 12:37:16 +1000
commite6a18762ef113296c6a09833be70cb4b45aa3940 (patch)
treedda026a560452fe319dd6792abcb80e0d8ce52cd
parentae7dab2a136d15b976b956f68feec53886951dd6 (diff)
Xi: fix XISetClientPointer return values.
If SetClientPointer fails, the only reason may be that the device is not a pointer or that the device is an SD. Return BadDevice instead of BadAccess. (BadAccess is a leftover from the early times of the ClientPointer implementation when only one client was allowed to set it). If the window parameter doesn't name a valid window or client, return BadWindow. Finally, allow both master keyboards and master pointers as deviceid. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--Xi/setcptr.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/Xi/setcptr.c b/Xi/setcptr.c
index 9d1a54cd4..05893815e 100644
--- a/Xi/setcptr.c
+++ b/Xi/setcptr.c
@@ -79,29 +79,34 @@ ProcXISetClientPointer(ClientPtr client)
rc = dixLookupDevice(&pDev, stuff->deviceid, client, DixWriteAccess);
if (rc != Success)
+ {
+ client->errorValue = stuff->deviceid;
return rc;
+ }
- if (!IsPointerDevice(pDev) || !IsMaster(pDev))
+ if (!IsMaster(pDev))
{
client->errorValue = stuff->deviceid;
return BadDevice;
}
+ pDev = GetMaster(pDev, MASTER_POINTER);
+
if (stuff->win != None)
{
rc = dixLookupClient(&targetClient, stuff->win, client,
DixWriteAccess);
if (rc != Success)
- return rc;
+ return BadWindow;
} else
targetClient = client;
if (!SetClientPointer(targetClient, client, pDev))
{
- client->errorValue = stuff->win;
- return BadAccess;
+ client->errorValue = stuff->deviceid;
+ return BadDevice;
}
return Success;