(!1899) dix: let CreateGrab operate on ClientPtr instead of array index

Almost all callers have ClientPtr anyways, so we're just doing duplicate
array lookups. Just using ClientPtr directly is easier anyways.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2024-05-17 20:29:03 +02:00
parent 9f4b1c608c
commit 3ddf21e8b7
4 changed files with 11 additions and 11 deletions

View File

@ -2532,7 +2532,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
else if (grabtype == XI2)
type = XI_ButtonPress;
grab = CreateGrab(client->index, dev, modifier_device, pWin, grabtype,
grab = CreateGrab(client, dev, modifier_device, pWin, grabtype,
mask, param, type, button, confineTo, cursor);
if (!grab)
return BadAlloc;
@ -2580,7 +2580,7 @@ GrabKey(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device,
if (rc != Success)
return rc;
grab = CreateGrab(client->index, dev, modifier_device, pWin, grabtype,
grab = CreateGrab(client, dev, modifier_device, pWin, grabtype,
mask, param, type, key, NULL, NULL);
if (!grab)
return BadAlloc;
@ -2623,7 +2623,7 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type,
if (rc != Success)
return rc;
grab = CreateGrab(client->index, dev, dev, pWin, XI2,
grab = CreateGrab(client, dev, dev, pWin, XI2,
mask, param,
(type == XIGrabtypeEnter) ? XI_Enter : XI_FocusIn, 0,
NULL, cursor);
@ -2654,7 +2654,7 @@ GrabTouchOrGesture(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr mod_dev,
if (rc != Success)
return rc;
grab = CreateGrab(client->index, dev, mod_dev, pWin, XI2,
grab = CreateGrab(client, dev, mod_dev, pWin, XI2,
mask, param, type, 0, NullWindow, NullCursor);
if (!grab)
return BadAlloc;

View File

@ -64,7 +64,7 @@ void FreeGrab(GrabPtr grab);
* Create a new grab for given client, with given parameters.
* Returns NULL on OOM.
*
* @param client _Index_ of the client who will hold the grab
* @param pClient ClientPtr to the client who will hold the grab
* @param device Device that's being grabbed
* @param modDevice Device whose modifiers are used (NULL = use core keyboard)
* @param window the window getting the events
@ -77,7 +77,7 @@ void FreeGrab(GrabPtr grab);
* @param cursor cursor to be used while grabbed (may be NULL)
* @return newly created grab. Must be freed by ::FreeGrab()
*/
GrabPtr CreateGrab(int client,
GrabPtr CreateGrab(ClientPtr pClient,
DeviceIntPtr device,
DeviceIntPtr modDevice,
WindowPtr window,

View File

@ -5671,7 +5671,7 @@ ProcGrabKey(ClientPtr client)
mask.core = (KeyPressMask | KeyReleaseMask);
grab = CreateGrab(client->index, keybd, keybd, pWin, CORE, &mask,
grab = CreateGrab(client, keybd, keybd, pWin, CORE, &mask,
&param, KeyPress, stuff->key, NullWindow, NullCursor);
if (!grab)
return BadAlloc;
@ -5765,7 +5765,7 @@ ProcGrabButton(ClientPtr client)
mask.core = stuff->eventMask;
grab = CreateGrab(client->index, ptr, modifierDevice, pWin,
grab = CreateGrab(client, ptr, modifierDevice, pWin,
CORE, &mask, &param, ButtonPress,
stuff->button, confineTo, cursor);
if (!grab)

View File

@ -214,7 +214,7 @@ AllocGrab(const GrabPtr src)
}
GrabPtr
CreateGrab(int client, DeviceIntPtr device, DeviceIntPtr modDevice,
CreateGrab(ClientPtr client, DeviceIntPtr device, DeviceIntPtr modDevice,
WindowPtr window, enum InputLevel grabtype, GrabMask *mask,
GrabParameters *param, int eventType,
KeyCode keybut, /* key or button */
@ -225,7 +225,7 @@ CreateGrab(int client, DeviceIntPtr device, DeviceIntPtr modDevice,
grab = AllocGrab(NULL);
if (!grab)
return (GrabPtr) NULL;
grab->resource = FakeClientID(client);
grab->resource = FakeClientID(client->index);
grab->device = device;
grab->window = window;
if (grabtype == CORE || grabtype == XI)
@ -645,7 +645,7 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
param.other_devices_mode = grab->pointerMode;
param.modifiers = any_modifier;
pNewGrab = CreateGrab(dixClientIdForXID(grab->resource), grab->device,
pNewGrab = CreateGrab(dixClientForXID(grab->resource), grab->device,
grab->modifierDevice, grab->window,
grab->grabtype,
(GrabMask *) &grab->eventMask,