From 9cc41b88dfebb3f1e0a7cb5c224146e651a2cda4 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Thu, 3 Jan 2008 18:47:28 +1030 Subject: [PATCH] Xi: ProcXSetClientPointer should directly check for the client from the id. The window ID includes the client ID anyway, so we might as well just look up the client directly instead of trying to get the window first and the client from the window. This also fixes a possible issue with XACE. If the client had permission to write on the client but not on the window, the previous approach would have failed. --- Xi/setcptr.c | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/Xi/setcptr.c b/Xi/setcptr.c index 968e5cd5c..7313a9d92 100644 --- a/Xi/setcptr.c +++ b/Xi/setcptr.c @@ -68,7 +68,6 @@ int ProcXSetClientPointer(ClientPtr client) { DeviceIntPtr pDev; - WindowPtr pWin; ClientPtr targetClient; int rc; @@ -88,21 +87,12 @@ ProcXSetClientPointer(ClientPtr client) if (stuff->win != None) { - rc = dixLookupWindow(&pWin, stuff->win, client, DixWriteAccess); + rc = dixLookupClient(&targetClient, stuff->win, client, + DixWriteAccess); + if (rc != Success) - { - /* window could not be found. maybe the window ID given was a pure - client id? */ - /* XXX: Needs to be fixed for XACE */ - rc = dixLookupClient(&targetClient, stuff->win, - client, DixWriteAccess); - if (rc != Success) - { - client->errorValue = stuff->win; - return rc; - } - } else - targetClient= wClient(pWin); + return rc; + } else targetClient = client;