Xi: check cursor and grab_window before attempting the passive grab.

Both values need to fail the request, so we need to check them before
looping through the modifier masks. Otherwise, a wrong grab_window will
show up in each failed modifier return but not actually cause an error.
This commit is contained in:
Peter Hutterer 2009-05-14 15:29:20 +10:00
parent 5c3e728980
commit 0e089f9ceb

View File

@ -85,6 +85,7 @@ ProcXIPassiveGrabDevice(ClientPtr client)
xXIGrabModifierInfo *modifiers_failed;
GrabMask mask;
GrabParameters param;
void *tmp;
REQUEST(xXIPassiveGrabDeviceReq);
REQUEST_AT_LEAST_SIZE(xXIPassiveGrabDeviceReq);
@ -134,6 +135,23 @@ ProcXIPassiveGrabDevice(ClientPtr client)
param.grabWindow = stuff->grab_window;
param.cursor = stuff->cursor;
if (stuff->cursor != None)
{
status = dixLookupResourceByType(&tmp, stuff->cursor,
RT_CURSOR, client, DixUseAccess);
if (status != Success)
{
client->errorValue = stuff->cursor;
return (status == BadValue) ? BadCursor : status;
}
}
status = dixLookupWindow((WindowPtr*)&tmp, stuff->grab_window, client, DixSetAttrAccess);
if (status != Success)
return status;
status = CheckGrabValues(client, &param);
modifiers = (uint32_t*)&stuff[1] + stuff->mask_len;
modifiers_failed = xcalloc(stuff->num_modifiers, sizeof(xXIGrabModifierInfo));
if (!modifiers_failed)