dix: replace CLIENT_ID() macro by dixClientIdForXID() inline function

Make it type-safe and a bit more obvious what it really does,
also adding some inline documentation. Since it's just some
bit shifting magic, it's qualified for inlining.

The CLIENT_ID() macro isn't used by any external modules, so the
new function doesn't need to be in a public header.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-03-05 12:43:10 +01:00
parent d80866e764
commit 0a315e45dd
23 changed files with 88 additions and 61 deletions

View File

@@ -43,6 +43,7 @@
#include <dix-config.h>
#include "dix/resource_priv.h"
#include "os/bug_priv.h"
#include "compint.h"
@@ -332,7 +333,7 @@ compUnredirectWindow(ClientPtr pClient, WindowPtr pWin, int update)
return BadValue;
for (ccw = cw->clients; ccw; ccw = ccw->next)
if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index) {
if (ccw->update == update && dixClientIdForXID(ccw->id) == pClient->index) {
FreeResource(ccw->id, X11_RESTYPE_NONE);
return Success;
}
@@ -430,7 +431,7 @@ compFreeClientSubwindows(WindowPtr pWin, XID id)
return;
for (prev = &csw->clients; (ccw = *prev); prev = &ccw->next) {
if (ccw->id == id) {
ClientPtr pClient = clients[CLIENT_ID(id)];
ClientPtr pClient = clients[dixClientIdForXID(id)];
*prev = ccw->next;
if (ccw->update == CompositeRedirectManual) {
@@ -479,7 +480,7 @@ compUnredirectSubwindows(ClientPtr pClient, WindowPtr pWin, int update)
if (!csw)
return BadValue;
for (ccw = csw->clients; ccw; ccw = ccw->next)
if (ccw->update == update && CLIENT_ID(ccw->id) == pClient->index) {
if (ccw->update == update && dixClientIdForXID(ccw->id) == pClient->index) {
FreeResource(ccw->id, X11_RESTYPE_NONE);
return Success;
}
@@ -499,7 +500,7 @@ compRedirectOneSubwindow(WindowPtr pParent, WindowPtr pWin)
if (!csw)
return Success;
for (ccw = csw->clients; ccw; ccw = ccw->next) {
int ret = compRedirectWindow(clients[CLIENT_ID(ccw->id)],
int ret = compRedirectWindow(clients[dixClientIdForXID(ccw->id)],
pWin, ccw->update);
if (ret != Success)
@@ -521,7 +522,7 @@ compUnredirectOneSubwindow(WindowPtr pParent, WindowPtr pWin)
if (!csw)
return Success;
for (ccw = csw->clients; ccw; ccw = ccw->next) {
int ret = compUnredirectWindow(clients[CLIENT_ID(ccw->id)],
int ret = compUnredirectWindow(clients[dixClientIdForXID(ccw->id)],
pWin, ccw->update);
if (ret != Success)