From 950cfb2bdcb7b9fef838e989b8977d429fcabaac 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 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dix/dix_priv.h b/dix/dix_priv.h index 6e1e92b00..3e2a90af8 100644 --- a/dix/dix_priv.h +++ b/dix/dix_priv.h @@ -18,6 +18,7 @@ #include #include "dix/input_priv.h" +#include "dix/resource_priv.h" #include "include/callback.h" #include "include/cursor.h" @@ -672,4 +673,17 @@ void WakeupHandler(int result); */ void InitBlockAndWakeupHandlers(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 = dixClientIdForXID(xid); + if (clientId < currentMaxClients) + return clients[clientId]; + return NullClient; +} + #endif /* _XSERVER_DIX_PRIV_H */