From e6a18762ef113296c6a09833be70cb4b45aa3940 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 11 Jun 2009 15:40:56 +1000 Subject: [PATCH] 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 --- Xi/setcptr.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Xi/setcptr.c b/Xi/setcptr.c index 9d1a54cd45..05893815ed 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;