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

@ -32,6 +32,7 @@ Equipment Corporation.
#include <X11/extensions/panoramiXproto.h>
#include "dix/dix_priv.h"
#include "dix/resource_priv.h"
#include "dix/screen_hooks_priv.h"
#include "misc.h"
@ -352,7 +353,7 @@ PanoramiXFindIDByScrnum(RESTYPE type, XID id, int screen)
data.screen = screen;
data.id = id;
return LookupClientResourceComplex(clients[CLIENT_ID(id)], type,
return LookupClientResourceComplex(clients[dixClientIdForXID(id)], type,
XineramaFindIDByScrnum, &data);
}

View File

@ -743,7 +743,7 @@ SecurityResource(CallbackListPtr *pcbl, void *unused, void *calldata)
{
XaceResourceAccessRec *rec = calldata;
SecurityStateRec *subj, *obj;
int cid = CLIENT_ID(rec->id);
int cid = dixClientIdForXID(rec->id);
Mask requested = rec->access_mode;
Mask allowed = SecurityResourceMask;

View File

@ -12,6 +12,7 @@
#include <X11/extensions/XResproto.h>
#include "dix/registry_priv.h"
#include "dix/resource_priv.h"
#include "os/client_priv.h"
#include "Xext/xace.h"
@ -301,12 +302,12 @@ ProcXResQueryClientResources(ClientPtr client)
{
REQUEST(xXResQueryClientResourcesReq);
xXResQueryClientResourcesReply rep;
int i, clientID, num_types;
int i, num_types;
int *counts;
REQUEST_SIZE_MATCH(xXResQueryClientResourcesReq);
clientID = CLIENT_ID(stuff->xid);
int clientID = dixClientIdForXID(stuff->xid);
if ((clientID >= currentMaxClients) || !clients[clientID] ||
(XaceHookClientAccess(client, clients[clientID], DixReadAccess)
@ -379,12 +380,11 @@ ProcXResQueryClientPixmapBytes(ClientPtr client)
{
REQUEST(xXResQueryClientPixmapBytesReq);
xXResQueryClientPixmapBytesReply rep;
int clientID;
unsigned long bytes;
REQUEST_SIZE_MATCH(xXResQueryClientPixmapBytesReq);
clientID = CLIENT_ID(stuff->xid);
int clientID = dixClientIdForXID(stuff->xid);
if ((clientID >= currentMaxClients) || !clients[clientID] ||
(XaceHookClientAccess(client, clients[clientID], DixReadAccess)
@ -555,7 +555,7 @@ ConstructClientIds(ClientPtr client,
}
}
} else {
int clientID = CLIENT_ID(specs[specIdx].client);
int clientID = dixClientIdForXID(specs[specIdx].client);
if ((clientID < currentMaxClients) && clients[clientID] &&
(XaceHookClientAccess(client, clients[clientID], DixReadAccess)
@ -897,7 +897,7 @@ ConstructResourceBytesByResource(XID aboutClient, ConstructResourceBytesCtx *ctx
for (specIdx = 0; specIdx < ctx->numSpecs; ++specIdx) {
xXResResourceIdSpec *spec = ctx->specs + specIdx;
if (spec->resource) {
int cid = CLIENT_ID(spec->resource);
int cid = dixClientIdForXID(spec->resource);
if (cid < currentMaxClients &&
(aboutClient == None || cid == aboutClient)) {
ClientPtr client = clients[cid];
@ -925,7 +925,7 @@ ConstructResourceBytes(XID aboutClient,
ConstructResourceBytesCtx *ctx)
{
if (aboutClient) {
int clientIdx = CLIENT_ID(aboutClient);
int clientIdx = dixClientIdForXID(aboutClient);
ClientPtr client = NullClient;
if ((clientIdx >= currentMaxClients) || !clients[clientIdx]) {

View File

@ -632,7 +632,7 @@ SELinuxResource(CallbackListPtr *pcbl, void *unused, void *calldata)
if (offset < 0) {
/* No: use the SID of the owning client */
class = SECCLASS_X_RESOURCE;
privatePtr = &clients[CLIENT_ID(rec->id)]->devPrivates;
privatePtr = &clients[dixClientIdForXID(rec->id)]->devPrivates;
obj = dixLookupPrivate(privatePtr, objectKey);
}
else {

View File

@ -1743,7 +1743,7 @@ ProcessBarrierEvent(InternalEvent *e, DeviceIntPtr dev)
Otherwise, deliver normally to the client.
*/
if (grab &&
CLIENT_ID(be->barrierid) == CLIENT_ID(grab->resource) &&
dixClientIdForXID(be->barrierid) == dixClientIdForXID(grab->resource) &&
grab->window->drawable.id == be->window) {
DeliverGrabbedEvent(e, dev, FALSE);
} else {

View File

@ -46,6 +46,7 @@
#include "dix/cursor_priv.h"
#include "dix/dix_priv.h"
#include "dix/input_priv.h"
#include "dix/resource_priv.h"
#include "mi/mi_priv.h"
#include "os/bug_priv.h"
@ -841,7 +842,7 @@ XIDestroyPointerBarrier(ClientPtr client,
return err;
}
if (CLIENT_ID(stuff->barrier) != client->index)
if (dixClientIdForXID(stuff->barrier) != client->index)
return BadAccess;
FreeResource(stuff->barrier, X11_RESTYPE_NONE);
@ -910,10 +911,9 @@ ProcXIBarrierReleasePointer(ClientPtr client)
return err;
}
if (CLIENT_ID(barrier_id) != client->index)
if (dixClientIdForXID(barrier_id) != client->index)
return BadAccess;
barrier = container_of(b, struct PointerBarrierClient, barrier);
pbd = GetBarrierDevice(barrier, dev->id);

View File

@ -29,6 +29,7 @@
#include "dix/dix_priv.h"
#include "dix/exevents_priv.h"
#include "dix/resource_priv.h"
#include "dixstruct.h"
#include "windowstr.h"
@ -56,7 +57,7 @@ check_for_touch_selection_conflicts(ClientPtr B, WindowPtr win, int deviceid,
for (; A; A = A->next) {
DeviceIntPtr tmp;
if (CLIENT_ID(A->resource) == B->index)
if (dixClientIdForXID(A->resource) == B->index)
continue;
if (deviceid == XIAllDevices)

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)

View File

@ -575,7 +575,7 @@ compCreateWindow(WindowPtr pWin)
(*pScreen->SetWindowPixmap) (pWin, parent_pixmap);
if (csw)
for (ccw = csw->clients; ccw; ccw = ccw->next)
compRedirectWindow(clients[CLIENT_ID(ccw->id)],
compRedirectWindow(clients[dixClientIdForXID(ccw->id)],
pWin, ccw->update);
if (compImplicitRedirect(pWin, pWin->parent))
compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);

View File

@ -54,6 +54,7 @@ SOFTWARE.
#include "dix/colormap_priv.h"
#include "dix/dix_priv.h"
#include "dix/resource_priv.h"
#include "os/osdep.h"
#include "os/bug_priv.h"
@ -417,7 +418,7 @@ FreeColormap(void *value, XID mid)
EntryPtr pent;
ColormapPtr pmap = (ColormapPtr) value;
if (CLIENT_ID(mid) != SERVER_ID) {
if (dixClientIdForXID(mid) != SERVER_ID) {
(*pmap->pScreen->UninstallColormap) (pmap);
WalkTree(pmap->pScreen, (VisitWindowProcPtr) TellNoMap, (void *) &mid);
}
@ -548,7 +549,7 @@ CopyColormapAndFree(Colormap mid, ColormapPtr pSrc, int client)
pScreen = pSrc->pScreen;
pVisual = pSrc->pVisual;
midSrc = pSrc->mid;
alloc = ((pSrc->flags & CM_AllAllocated) && CLIENT_ID(midSrc) == client) ?
alloc = ((pSrc->flags & CM_AllAllocated) && dixClientIdForXID(midSrc) == client) ?
AllocAll : AllocNone;
size = pVisual->ColormapEntries;
@ -1088,7 +1089,8 @@ AllocColor(ColormapPtr pmap,
* resource manager that the client has pixels in this colormap which
* should be freed when the client dies */
if ((pmap->numPixelsRed[client] == 1) &&
(CLIENT_ID(pmap->mid) != client) && !(pmap->flags & CM_BeingCreated)) {
(dixClientIdForXID(pmap->mid) != client) && !(pmap->flags & CM_BeingCreated)) {
colorResource *pcr = calloc(1, sizeof(colorResource));
if (!pcr) {
(void) FreeColors(pmap, client, 1, pPix, (Pixel) 0);
@ -1507,7 +1509,7 @@ AllocColorCells(ClientPtr pClient, ColormapPtr pmap, int colors, int planes,
oldcount = pmap->numPixelsRed[client];
if (pmap->class == DirectColor)
oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client];
if (!oldcount && (CLIENT_ID(pmap->mid) != client)) {
if (!oldcount && (dixClientIdForXID(pmap->mid) != client)) {
pcr = calloc(1, sizeof(colorResource));
if (!pcr)
return BadAlloc;
@ -1574,7 +1576,7 @@ AllocColorPlanes(int client, ColormapPtr pmap, int colors,
oldcount = pmap->numPixelsRed[client];
if (class == DirectColor)
oldcount += pmap->numPixelsGreen[client] + pmap->numPixelsBlue[client];
if (!oldcount && (CLIENT_ID(pmap->mid) != client)) {
if (!oldcount && (dixClientIdForXID(pmap->mid) != client)) {
pcr = calloc(1, sizeof(colorResource));
if (!pcr)
return BadAlloc;

View File

@ -26,6 +26,7 @@
#include "include/gc.h"
#include "include/input.h"
#include "include/os.h"
#include "include/resource.h"
#include "include/window.h"
/* server setting: maximum size for big requests */

View File

@ -87,6 +87,7 @@ Author: Adobe Systems Incorporated
#include "dix/callback_priv.h"
#include "dix/dix_priv.h"
#include "dix/resource_priv.h"
#include "misc.h"
#include "windowstr.h"
@ -221,7 +222,7 @@ int
dixLookupResourceOwner(ClientPtr *result, XID id, ClientPtr client, Mask access_mode)
{
void *pRes;
int rc = BadValue, clientIndex = CLIENT_ID(id);
int rc = BadValue, clientIndex = dixClientIdForXID(id);
if (!clientIndex || !clients[clientIndex] || (id & SERVER_BIT))
goto bad;

View File

@ -1426,8 +1426,8 @@ CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
else { /* free both if same client owns both */
thisDev->deviceGrab.sync.state = GRAB_STATE_THAWED;
if (thisDev->deviceGrab.sync.other &&
(CLIENT_BITS(thisDev->deviceGrab.sync.other->resource) ==
CLIENT_BITS(grab->resource)))
(dixClientIdForXID(thisDev->deviceGrab.sync.other->resource) ==
dixClientIdForXID(grab->resource)))
thisDev->deviceGrab.sync.other = NullGrab;
}
@ -1437,8 +1437,8 @@ CheckGrabForSyncs(DeviceIntPtr thisDev, Bool thisMode, Bool otherMode)
dev->deviceGrab.sync.other = grab;
else { /* free both if same client owns both */
if (dev->deviceGrab.sync.other &&
(CLIENT_BITS(dev->deviceGrab.sync.other->resource) ==
CLIENT_BITS(grab->resource)))
(dixClientIdForXID(dev->deviceGrab.sync.other->resource) ==
dixClientIdForXID(grab->resource)))
dev->deviceGrab.sync.other = NullGrab;
}
}
@ -4424,8 +4424,8 @@ FreezeThisEventIfNeededForSyncGrab(DeviceIntPtr thisDev, InternalEvent *event)
if (dev) {
FreezeThaw(dev, TRUE);
if ((dev->deviceGrab.sync.state == GRAB_STATE_FREEZE_BOTH_NEXT_EVENT) &&
(CLIENT_BITS(grab->resource) ==
CLIENT_BITS(dev->deviceGrab.grab->resource)))
(dixClientIdForXID(grab->resource) ==
dixClientIdForXID(dev->deviceGrab.grab->resource)))
dev->deviceGrab.sync.state = GRAB_STATE_FROZEN_NO_EVENT;
else
dev->deviceGrab.sync.other = grab;
@ -6286,5 +6286,5 @@ IsWrongPointerBarrierClient(ClientPtr client, DeviceIntPtr dev, xEvent *event)
if (ev->evtype != XI_BarrierHit && ev->evtype != XI_BarrierLeave)
return FALSE;
return client->index != CLIENT_ID(ev->barrier);
return client->index != dixClientIdForXID(ev->barrier);
}

View File

@ -55,6 +55,7 @@ SOFTWARE.
#include "dix/dix_priv.h"
#include "dix/dixgrabs_priv.h"
#include "dix/exevents_priv.h"
#include "dix/resource_priv.h"
#include "os/auth.h"
#include "os/client_priv.h"
@ -88,7 +89,7 @@ PrintDeviceGrabInfo(DeviceIntPtr dev)
(grab->grabtype == XI2) ? "xi2" :
((grab->grabtype == CORE) ? "core" : "xi1"), dev->name, dev->id);
client = clients[CLIENT_ID(grab->resource)];
client = clients[dixClientIdForXID(grab->resource)];
if (client) {
pid_t clientpid = GetClientPid(client);
const char *cmdname = GetClientCmdName(client);
@ -110,7 +111,7 @@ PrintDeviceGrabInfo(DeviceIntPtr dev)
}
if (!clientIdPrinted) {
ErrorF(" (no client information available for client %d)\n",
CLIENT_ID(grab->resource));
dixClientIdForXID(grab->resource));
}
/* XXX is this even correct? */
@ -181,7 +182,7 @@ UngrabAllDevices(Bool kill_client)
if (!dev->deviceGrab.grab)
continue;
PrintDeviceGrabInfo(dev);
client = clients[CLIENT_ID(dev->deviceGrab.grab->resource)];
client = clients[dixClientIdForXID(dev->deviceGrab.grab->resource)];
if (!kill_client || !client || client->clientGone)
dev->deviceGrab.DeactivateGrab(dev);
if (kill_client)
@ -538,7 +539,7 @@ AddPassiveGrabToList(ClientPtr client, GrabPtr pGrab)
for (grab = wPassiveGrabs(pGrab->window); grab; grab = grab->next) {
if (GrabMatchesSecond(pGrab, grab, (pGrab->grabtype == CORE))) {
if (CLIENT_BITS(pGrab->resource) != CLIENT_BITS(grab->resource)) {
if (dixClientIdForXID(pGrab->resource) != dixClientIdForXID(grab->resource)) {
FreeGrab(pGrab);
return BadAccess;
}
@ -618,7 +619,7 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
ok = TRUE;
for (grab = wPassiveGrabs(pMinuendGrab->window);
grab && ok; grab = grab->next) {
if ((CLIENT_BITS(grab->resource) != CLIENT_BITS(pMinuendGrab->resource))
if ((dixClientIdForXID(grab->resource) != dixClientIdForXID(pMinuendGrab->resource))
|| !GrabMatchesSecond(grab, pMinuendGrab, (grab->grabtype == CORE)))
continue;
if (GrabSupersedesSecond(pMinuendGrab, grab)) {
@ -646,7 +647,7 @@ DeletePassiveGrabFromList(GrabPtr pMinuendGrab)
param.other_devices_mode = grab->pointerMode;
param.modifiers = any_modifier;
pNewGrab = CreateGrab(CLIENT_ID(grab->resource), grab->device,
pNewGrab = CreateGrab(dixClientIdForXID(grab->resource), grab->device,
grab->modifierDevice, grab->window,
grab->grabtype,
(GrabMask *) &grab->eventMask,

View File

@ -16,26 +16,26 @@ ClientPtr dixClientForWindow(WindowPtr pWin) {
if (!pWin)
return NullClient;
return clients[CLIENT_ID(pWin->drawable.id)];
return clients[dixClientIdForXID(pWin->drawable.id)];
}
ClientPtr dixClientForGrab(GrabPtr pGrab) {
if (!pGrab)
return NullClient;
return clients[CLIENT_ID(pGrab->resource)];
return clients[dixClientIdForXID(pGrab->resource)];
}
ClientPtr dixClientForInputClients(InputClientsPtr pInputClients) {
if (!pInputClients)
return NullClient;
return clients[CLIENT_ID(pInputClients->resource)];
return clients[dixClientIdForXID(pInputClients->resource)];
}
ClientPtr dixClientForOtherClients(OtherClientsPtr pOtherClients) {
if (!pOtherClients)
return NullClient;
return clients[CLIENT_ID(pOtherClients->resource)];
return clients[dixClientIdForXID(pOtherClients->resource)];
}

View File

@ -112,7 +112,7 @@ Equipment Corporation.
* like it belongs to a client. This ID, however, must not be one
* the client actually can create, or we have the potential for conflict.
* The 31st bit of the ID is reserved for the server's use for this
* purpose. By setting CLIENT_ID(id) to the client, the SERVER_BIT to
* purpose. By setting dixClientIdForXID(id) to the client, the SERVER_BIT to
* 1, and an otherwise arbitrary ID in the low 22 bits, we can create a
* resource "owned" by the client.
*/
@ -126,6 +126,7 @@ Equipment Corporation.
#include "dix/dixgrabs_priv.h"
#include "dix/gc_priv.h"
#include "dix/registry_priv.h"
#include "dix/resource_priv.h"
#include "os/osdep.h"
#include "misc.h"
@ -824,7 +825,7 @@ AddResource(XID id, RESTYPE type, void *value)
#ifdef XSERVER_DTRACE
XSERVER_RESOURCE_ALLOC(id, type, value, TypeNameString(type));
#endif
client = CLIENT_ID(id);
client = dixClientIdForXID(id);
rrec = &clientTable[client];
if (!rrec->buckets) {
ErrorF("[dix] AddResource(%lx, %x, %lx), client=%d \n",
@ -912,7 +913,7 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType)
int *eltptr;
int elements;
if (((cid = CLIENT_ID(id)) < LimitClients) && clientTable[cid].buckets) {
if (((cid = dixClientIdForXID(id)) < LimitClients) && clientTable[cid].buckets) {
head = &clientTable[cid].resources[HashResourceID(id, clientTable[cid].hashsize)];
eltptr = &clientTable[cid].elements;
@ -946,7 +947,7 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree)
ResourcePtr res;
ResourcePtr *prev, *head;
if (((cid = CLIENT_ID(id)) < LimitClients) && clientTable[cid].buckets) {
if (((cid = dixClientIdForXID(id)) < LimitClients) && clientTable[cid].buckets) {
head = &clientTable[cid].resources[HashResourceID(id, clientTable[cid].hashsize)];
prev = head;
@ -981,7 +982,7 @@ ChangeResourceValue(XID id, RESTYPE rtype, void *value)
int cid;
ResourcePtr res;
if (((cid = CLIENT_ID(id)) < LimitClients) && clientTable[cid].buckets) {
if (((cid = dixClientIdForXID(id)) < LimitClients) && clientTable[cid].buckets) {
res = clientTable[cid].resources[HashResourceID(id, clientTable[cid].hashsize)];
for (; res; res = res->next)
@ -1212,7 +1213,7 @@ int
dixLookupResourceByType(void **result, XID id, RESTYPE rtype,
ClientPtr client, Mask mode)
{
int cid = CLIENT_ID(id);
int cid = dixClientIdForXID(id);
ResourcePtr res = NULL;
*result = NULL;
@ -1249,7 +1250,7 @@ int
dixLookupResourceByClass(void **result, XID id, RESTYPE rclass,
ClientPtr client, Mask mode)
{
int cid = CLIENT_ID(id);
int cid = dixClientIdForXID(id);
ResourcePtr res = NULL;
*result = NULL;

View File

@ -51,4 +51,19 @@ ClientPtr dixClientForInputClients(InputClientsPtr pInputClients);
*/
ClientPtr dixClientForOtherClients(OtherClientsPtr pOtherClients);
/*
* @brief extract client ID from XID
*
* XIDs carry the ID of the client who created/owns the resource in upper bits.
* (every client so is assigned a range of XIDs it may use for resource creation)
*
* This ID is frequently used as table index, eg. for client or resource lookup.
*
* @param XID the ID of the resource whose client is retrieved
* @return index of the client (within client or resource table)
*/
static inline int dixClientIdForXID(XID xid) {
return ((int)(CLIENT_BITS(xid) >> CLIENTOFFSET));
}
#endif /* _XSERVER_DIX_RESOURCE_PRIV_H */

View File

@ -31,6 +31,7 @@
#include "dix/eventconvert.h"
#include "dix/exevents_priv.h"
#include "dix/input_priv.h"
#include "dix/resource_priv.h"
#include "mi/mi_priv.h"
#include "os/bug_priv.h"
@ -994,7 +995,7 @@ TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode,
}
for (i = 0; i < ti->num_listeners; i++) {
if (CLIENT_ID(ti->listeners[i].listener) == client->index &&
if (dixClientIdForXID(ti->listeners[i].listener) == client->index &&
ti->listeners[i].window->drawable.id == grab_window)
break;
}

View File

@ -36,6 +36,7 @@
#include <X11/extensions/presenttokens.h>
#include "dix/dix_priv.h"
#include "dix/resource_priv.h"
#include "os/bug_priv.h"
#include "glxserver.h"
@ -2504,7 +2505,7 @@ void
__glXsendSwapEvent(__GLXdrawable *drawable, int type, CARD64 ust,
CARD64 msc, CARD32 sbc)
{
ClientPtr client = clients[CLIENT_ID(drawable->drawId)];
ClientPtr client = clients[dixClientIdForXID(drawable->drawId)];
xGLXBufferSwapComplete2 wire = {
.type = __glXEventBase + GLX_BufferSwapComplete

View File

@ -29,6 +29,8 @@
#include <xwayland-config.h>
#include <wayland-client.h>
#include "dix/resource_priv.h"
#include "pixmapstr.h"
/* This is an opaque structure implemented in the different backends */
@ -48,7 +50,7 @@ Bool xwl_pixmap_init(void);
static inline Bool
xwl_is_client_pixmap(PixmapPtr pixmap)
{
return clients[CLIENT_ID(pixmap->drawable.id)] != serverClient;
return clients[dixClientIdForXID(pixmap->drawable.id)] != serverClient;
}
#endif /* XWAYLAND_PIXMAP_H */

View File

@ -471,7 +471,7 @@ window_is_wm_window(WindowPtr window)
{
struct xwl_screen *xwl_screen = xwl_screen_get(window->drawable.pScreen);
return CLIENT_ID(window->drawable.id) == xwl_screen->wm_client_id;
return dixClientIdForXID(window->drawable.id) == xwl_screen->wm_client_id;
}
static WindowPtr
@ -1787,7 +1787,7 @@ xwl_change_window_attributes(WindowPtr window, unsigned long mask)
for (others = wOtherClients(window); others; others = others->next) {
if (others->mask & (SubstructureRedirectMask | ResizeRedirectMask))
xwl_screen->wm_client_id = CLIENT_ID(others->resource);
xwl_screen->wm_client_id = dixClientIdForXID(others->resource);
}
return ret;

View File

@ -110,8 +110,6 @@ extern _X_EXPORT unsigned int ResourceClientBits(void);
#define RESOURCE_CLIENT_MASK (((1 << RESOURCE_CLIENT_BITS) - 1) << CLIENTOFFSET)
/* extract the client mask from an XID */
#define CLIENT_BITS(id) ((id) & RESOURCE_CLIENT_MASK)
/* extract the client id from an XID */
#define CLIENT_ID(id) ((int)(CLIENT_BITS(id) >> CLIENTOFFSET))
/*
* Resource IDs having that bit set still belonging to some client,

View File

@ -37,6 +37,7 @@ and Jim Haggerty of Metheus.
#include "dix/cursor_priv.h"
#include "dix/eventconvert.h"
#include "dix/input_priv.h"
#include "dix/resource_priv.h"
#include "os/client_priv.h"
#include "dixstruct.h"
@ -865,7 +866,7 @@ RecordInstallHooks(RecordClientsAndProtocolPtr pRCAP, XID oneclient)
if (pRCAP->pRequestMajorOpSet) {
RecordSetIteratePtr pIter = NULL;
RecordSetInterval interval;
ClientPtr pClient = clients[CLIENT_ID(client)];
ClientPtr pClient = clients[dixClientIdForXID(client)];
if (pClient && !RecordClientPrivate(pClient)) {
RecordClientPrivatePtr pClientPriv;
@ -948,7 +949,7 @@ RecordUninstallHooks(RecordClientsAndProtocolPtr pRCAP, XID oneclient)
while (client) {
if (client != XRecordFutureClients) {
if (pRCAP->pRequestMajorOpSet) {
ClientPtr pClient = clients[CLIENT_ID(client)];
ClientPtr pClient = clients[dixClientIdForXID(client)];
int c;
Bool otherRCAPwantsProcVector = FALSE;
RecordClientPrivatePtr pClientPriv = NULL;
@ -1153,7 +1154,7 @@ RecordSanityCheckClientSpecifiers(ClientPtr client, XID *clientspecs,
continue;
if (errorspec && (CLIENT_BITS(clientspecs[i]) == errorspec))
return BadMatch;
clientIndex = CLIENT_ID(clientspecs[i]);
clientIndex = dixClientIdForXID(clientspecs[i]);
if (clientIndex && clients[clientIndex] &&
clients[clientIndex]->clientState == ClientStateRunning) {
if (clientspecs[i] == clients[clientIndex]->clientAsMask)