dix: helper for retrieving client owning a XID

Add a little helper that's looking up the ClientPtr to the client
of the owner of given XID. The lookup is solely done on the ID space,
the actual resource doesn't even need to exist.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-03-17 18:26:21 +01:00
parent 8a3401c94c
commit be465abc36

View File

@ -278,4 +278,17 @@ void dixFreeScreen(ScreenPtr pScreen);
void dixFreeAllScreens(void); void dixFreeAllScreens(void);
/*
* @brief retrieve owning client for given XID
*
* just lookup by ID space, the resource doens't need to actually exist
*/
static inline ClientPtr dixLookupXIDOwner(XID xid)
{
int clientId = CLIENT_ID(xid);
if (clientId < currentMaxClients)
return clients[clientId];
return NullClient;
}
#endif /* _XSERVER_DIX_PRIV_H */ #endif /* _XSERVER_DIX_PRIV_H */