From be465abc36f7e60257b8ee307813d60efcd028c9 Mon Sep 17 00:00:00 2001 From: "Enrico Weigelt, metux IT consult" Date: Mon, 17 Mar 2025 18:26:21 +0100 Subject: [PATCH] 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 --- dix/dix_priv.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dix/dix_priv.h b/dix/dix_priv.h index 81d33ad92..211de0d16 100644 --- a/dix/dix_priv.h +++ b/dix/dix_priv.h @@ -278,4 +278,17 @@ void dixFreeScreen(ScreenPtr pScreen); 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 */