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 5df102a8f6
commit 7b3ff4a0e4

View File

@ -18,6 +18,7 @@
#include <X11/extensions/XI.h>
#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 */