dix: add dixAllocServerXID()
Adding a separate function for allocating server-client's XIDs. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
4919a089df
commit
e6467895f9
|
@ -588,7 +588,7 @@ DPMSExtensionInit(void)
|
||||||
|
|
||||||
ClientType = CreateNewResourceType(DPMSFreeClient, "DPMSClient");
|
ClientType = CreateNewResourceType(DPMSFreeClient, "DPMSClient");
|
||||||
DPMSEventType = CreateNewResourceType(DPMSFreeEvents, "DPMSEvent");
|
DPMSEventType = CreateNewResourceType(DPMSFreeEvents, "DPMSEvent");
|
||||||
eventResource = FakeClientID(0);
|
eventResource = dixAllocServerXID();
|
||||||
|
|
||||||
if (DPMSEnabled && ClientType && DPMSEventType &&
|
if (DPMSEnabled && ClientType && DPMSEventType &&
|
||||||
(extEntry = AddExtension(DPMSExtensionName, 0, 0,
|
(extEntry = AddExtension(DPMSExtensionName, 0, 0,
|
||||||
|
|
|
@ -1025,7 +1025,7 @@ SyncCreateSystemCounter(const char *name,
|
||||||
SyncSystemCounterBracketValues BracketValues
|
SyncSystemCounterBracketValues BracketValues
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
SyncCounter *pCounter = SyncCreateCounter(NULL, FakeClientID(0), initial);
|
SyncCounter *pCounter = SyncCreateCounter(NULL, dixAllocServerXID(), initial);
|
||||||
|
|
||||||
if (pCounter) {
|
if (pCounter) {
|
||||||
SysCounterInfo *psci = calloc(1, sizeof(SysCounterInfo));
|
SysCounterInfo *psci = calloc(1, sizeof(SysCounterInfo));
|
||||||
|
|
|
@ -2860,7 +2860,7 @@ InputClientGone(WindowPtr pWin, XID id)
|
||||||
FreeInputClient(&other);
|
FreeInputClient(&other);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
other->resource = FakeClientID(0);
|
other->resource = dixAllocServerXID();
|
||||||
if (!AddResource(other->resource, RT_INPUTCLIENT,
|
if (!AddResource(other->resource, RT_INPUTCLIENT,
|
||||||
(void *) pWin))
|
(void *) pWin))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
|
@ -323,7 +323,7 @@ compScreenInit(ScreenPtr pScreen)
|
||||||
if (!cs)
|
if (!cs)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
cs->overlayWid = FakeClientID(0);
|
cs->overlayWid = dixAllocServerXID();
|
||||||
cs->pOverlayWin = NULL;
|
cs->pOverlayWin = NULL;
|
||||||
cs->pOverlayClients = NULL;
|
cs->pOverlayClients = NULL;
|
||||||
|
|
||||||
|
|
|
@ -2555,7 +2555,7 @@ ResizeVisualArray(ScreenPtr pScreen, int new_visual_count, DepthPtr depth)
|
||||||
pScreen->visuals = visuals;
|
pScreen->visuals = visuals;
|
||||||
|
|
||||||
for (i = 0; i < new_visual_count; i++) {
|
for (i = 0; i < new_visual_count; i++) {
|
||||||
vid = FakeClientID(0);
|
vid = dixAllocServerXID();
|
||||||
pScreen->visuals[first_new_visual + i].vid = vid;
|
pScreen->visuals[first_new_visual + i].vid = vid;
|
||||||
vids[first_new_vid + i] = vid;
|
vids[first_new_vid + i] = vid;
|
||||||
}
|
}
|
||||||
|
|
|
@ -497,7 +497,7 @@ CreateRootCursor(void)
|
||||||
XID fontID;
|
XID fontID;
|
||||||
const char defaultCursorFont[] = "cursor";
|
const char defaultCursorFont[] = "cursor";
|
||||||
|
|
||||||
fontID = FakeClientID(0);
|
fontID = dixAllocServerXID();
|
||||||
err = OpenFont(serverClient, fontID, FontLoadAll | FontOpenSync,
|
err = OpenFont(serverClient, fontID, FontLoadAll | FontOpenSync,
|
||||||
(unsigned) strlen(defaultCursorFont), defaultCursorFont);
|
(unsigned) strlen(defaultCursorFont), defaultCursorFont);
|
||||||
if (err != Success)
|
if (err != Success)
|
||||||
|
@ -511,7 +511,7 @@ CreateRootCursor(void)
|
||||||
&curs, serverClient, (XID) 0) != Success)
|
&curs, serverClient, (XID) 0) != Success)
|
||||||
return NullCursor;
|
return NullCursor;
|
||||||
|
|
||||||
if (!AddResource(FakeClientID(0), X11_RESTYPE_CURSOR, (void *) curs))
|
if (!AddResource(dixAllocServerXID(), X11_RESTYPE_CURSOR, (void *) curs))
|
||||||
return NullCursor;
|
return NullCursor;
|
||||||
|
|
||||||
return curs;
|
return curs;
|
||||||
|
|
|
@ -142,7 +142,7 @@ SetDefaultFont(const char *defaultfontname)
|
||||||
FontPtr pf;
|
FontPtr pf;
|
||||||
XID fid;
|
XID fid;
|
||||||
|
|
||||||
fid = FakeClientID(0);
|
fid = dixAllocServerXID();
|
||||||
err = OpenFont(serverClient, fid, FontLoadAll | FontOpenSync,
|
err = OpenFont(serverClient, fid, FontLoadAll | FontOpenSync,
|
||||||
(unsigned) strlen(defaultfontname), defaultfontname);
|
(unsigned) strlen(defaultfontname), defaultfontname);
|
||||||
if (err != Success)
|
if (err != Success)
|
||||||
|
@ -1914,7 +1914,7 @@ find_old_font(XID id)
|
||||||
static Font
|
static Font
|
||||||
get_new_font_client_id(void)
|
get_new_font_client_id(void)
|
||||||
{
|
{
|
||||||
return FakeClientID(0);
|
return dixAllocServerXID();
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
@ -1276,3 +1276,9 @@ dixLookupResourceByClass(void **result, XID id, RESTYPE rclass,
|
||||||
*result = res->value;
|
*result = res->value;
|
||||||
return Success;
|
return Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* new API - try not to call FakeClientID() directly anymore */
|
||||||
|
XID dixAllocServerXID(void)
|
||||||
|
{
|
||||||
|
return FakeClientID(0);
|
||||||
|
}
|
||||||
|
|
|
@ -562,7 +562,7 @@ CreateRootWindow(ScreenPtr pScreen)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
pScreen->screensaver.pWindow = NULL;
|
pScreen->screensaver.pWindow = NULL;
|
||||||
pScreen->screensaver.wid = FakeClientID(0);
|
pScreen->screensaver.wid = dixAllocServerXID();
|
||||||
pScreen->screensaver.ExternalScreenSaver = NULL;
|
pScreen->screensaver.ExternalScreenSaver = NULL;
|
||||||
screenIsSaved = SCREEN_SAVER_OFF;
|
screenIsSaved = SCREEN_SAVER_OFF;
|
||||||
|
|
||||||
|
@ -601,7 +601,7 @@ CreateRootWindow(ScreenPtr pScreen)
|
||||||
|
|
||||||
pWin->nextSib = NullWindow;
|
pWin->nextSib = NullWindow;
|
||||||
|
|
||||||
pWin->drawable.id = FakeClientID(0);
|
pWin->drawable.id = dixAllocServerXID();
|
||||||
|
|
||||||
pWin->origin.x = pWin->origin.y = 0;
|
pWin->origin.x = pWin->origin.y = 0;
|
||||||
pWin->drawable.height = pScreen->height;
|
pWin->drawable.height = pScreen->height;
|
||||||
|
@ -3249,7 +3249,7 @@ TileScreenSaver(ScreenPtr pScreen, int kind)
|
||||||
result = AllocARGBCursor(srcbits, mskbits, NULL, &cm, 0, 0, 0, 0, 0, 0,
|
result = AllocARGBCursor(srcbits, mskbits, NULL, &cm, 0, 0, 0, 0, 0, 0,
|
||||||
&cursor, serverClient, (XID) 0);
|
&cursor, serverClient, (XID) 0);
|
||||||
if (cursor) {
|
if (cursor) {
|
||||||
cursorID = FakeClientID(0);
|
cursorID = dixAllocServerXID();
|
||||||
if (AddResource(cursorID, X11_RESTYPE_CURSOR, (void *) cursor)) {
|
if (AddResource(cursorID, X11_RESTYPE_CURSOR, (void *) cursor)) {
|
||||||
attributes[attri] = cursorID;
|
attributes[attri] = cursorID;
|
||||||
mask |= CWCursor;
|
mask |= CWCursor;
|
||||||
|
|
|
@ -100,7 +100,7 @@ fbSetupScreen(ScreenPtr pScreen, void *pbits, /* pointer to screen bitmap */
|
||||||
{ /* bits per pixel for screen */
|
{ /* bits per pixel for screen */
|
||||||
if (!fbAllocatePrivates(pScreen))
|
if (!fbAllocatePrivates(pScreen))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
pScreen->defColormap = FakeClientID(0);
|
pScreen->defColormap = dixAllocServerXID();
|
||||||
if (bpp > 1) {
|
if (bpp > 1) {
|
||||||
/* let CreateDefColormap do whatever it wants for pixels */
|
/* let CreateDefColormap do whatever it wants for pixels */
|
||||||
pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
|
pScreen->blackPixel = pScreen->whitePixel = (Pixel) 0;
|
||||||
|
|
|
@ -324,7 +324,7 @@ __glXScreenInit(__GLXscreen * pGlxScreen, ScreenPtr pScreen)
|
||||||
|
|
||||||
i = 0;
|
i = 0;
|
||||||
for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next) {
|
for (m = pGlxScreen->fbconfigs; m != NULL; m = m->next) {
|
||||||
m->fbconfigID = FakeClientID(0);
|
m->fbconfigID = dixAllocServerXID();
|
||||||
m->visualID = 0;
|
m->visualID = 0;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -366,7 +366,7 @@ KdXVInitAdaptors(ScreenPtr pScreen, KdVideoAdaptorPtr infoPtr, int number)
|
||||||
}
|
}
|
||||||
for (pp = pPort, i = 0, numPort = 0; i < adaptorPtr->nPorts; i++) {
|
for (pp = pPort, i = 0, numPort = 0; i < adaptorPtr->nPorts; i++) {
|
||||||
|
|
||||||
if (!(pp->id = FakeClientID(0)))
|
if (!(pp->id = dixAllocServerXID()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!(portPriv = calloc(1, sizeof(XvPortRecPrivate))))
|
if (!(portPriv = calloc(1, sizeof(XvPortRecPrivate))))
|
||||||
|
|
|
@ -665,7 +665,7 @@ DGACreateColormap(int index, ClientPtr client, int id, int mode, int alloc)
|
||||||
if (!(pVisual = calloc(1, sizeof(VisualRec))))
|
if (!(pVisual = calloc(1, sizeof(VisualRec))))
|
||||||
return BadAlloc;
|
return BadAlloc;
|
||||||
|
|
||||||
pVisual->vid = FakeClientID(0);
|
pVisual->vid = dixAllocServerXID();
|
||||||
pVisual->class = pMode->visualClass;
|
pVisual->class = pMode->visualClass;
|
||||||
pVisual->nplanes = pMode->depth;
|
pVisual->nplanes = pMode->depth;
|
||||||
pVisual->ColormapEntries = 1 << pMode->depth;
|
pVisual->ColormapEntries = 1 << pMode->depth;
|
||||||
|
|
|
@ -486,7 +486,7 @@ xf86XVInitAdaptors(ScreenPtr pScreen, XF86VideoAdaptorPtr * infoPtr, int number)
|
||||||
}
|
}
|
||||||
for (pp = pPort, i = 0, numPort = 0; i < adaptorPtr->nPorts; i++) {
|
for (pp = pPort, i = 0, numPort = 0; i < adaptorPtr->nPorts; i++) {
|
||||||
|
|
||||||
if (!(pp->id = FakeClientID(0)))
|
if (!(pp->id = dixAllocServerXID()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!(portPriv = calloc(1, sizeof(XvPortRecPrivate))))
|
if (!(portPriv = calloc(1, sizeof(XvPortRecPrivate))))
|
||||||
|
|
|
@ -243,7 +243,7 @@ xnestOpenScreen(ScreenPtr pScreen, int argc, char *argv[])
|
||||||
.offsetRed = offset(vts[x].red_mask),
|
.offsetRed = offset(vts[x].red_mask),
|
||||||
.offsetGreen = offset(vts[x].green_mask),
|
.offsetGreen = offset(vts[x].green_mask),
|
||||||
.offsetBlue = offset(vts[x].blue_mask),
|
.offsetBlue = offset(vts[x].blue_mask),
|
||||||
.vid = FakeClientID(0),
|
.vid = dixAllocServerXID(),
|
||||||
};
|
};
|
||||||
|
|
||||||
xnestVisualMap[xnestNumVisualMap] = (xnest_visual_t) {
|
xnestVisualMap[xnestNumVisualMap] = (xnest_visual_t) {
|
||||||
|
@ -310,7 +310,7 @@ breakout:
|
||||||
numVisuals, visuals))
|
numVisuals, visuals))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
pScreen->defColormap = (Colormap) FakeClientID(0);
|
pScreen->defColormap = (Colormap) dixAllocServerXID();
|
||||||
pScreen->minInstalledCmaps = MINCMAPS;
|
pScreen->minInstalledCmaps = MINCMAPS;
|
||||||
pScreen->maxInstalledCmaps = MAXCMAPS;
|
pScreen->maxInstalledCmaps = MAXCMAPS;
|
||||||
pScreen->backingStoreSupport = XCB_BACKING_STORE_NOT_USEFUL;
|
pScreen->backingStoreSupport = XCB_BACKING_STORE_NOT_USEFUL;
|
||||||
|
|
|
@ -720,7 +720,7 @@ AppleWMExtensionInit(AppleWMProcsPtr procsPtr)
|
||||||
|
|
||||||
ClientType = CreateNewResourceType(WMFreeClient, "WMClient");
|
ClientType = CreateNewResourceType(WMFreeClient, "WMClient");
|
||||||
EventType = CreateNewResourceType(WMFreeEvents, "WMEvent");
|
EventType = CreateNewResourceType(WMFreeEvents, "WMEvent");
|
||||||
eventResource = FakeClientID(0);
|
eventResource = dixAllocServerXID();
|
||||||
|
|
||||||
if (ClientType && EventType &&
|
if (ClientType && EventType &&
|
||||||
(extEntry = AddExtension(APPLEWMNAME,
|
(extEntry = AddExtension(APPLEWMNAME,
|
||||||
|
|
|
@ -254,7 +254,7 @@ xwl_glamor_xv_add_ports(XvAdaptorPtr pa)
|
||||||
|
|
||||||
PortResource = XvGetRTPort();
|
PortResource = XvGetRTPort();
|
||||||
for (pp = pPorts, i = 0, nPorts = 0; i < NUM_PORTS; i++) {
|
for (pp = pPorts, i = 0, nPorts = 0; i < NUM_PORTS; i++) {
|
||||||
if (!(pp->id = FakeClientID(0)))
|
if (!(pp->id = dixAllocServerXID()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pp->pAdaptor = pa;
|
pp->pAdaptor = pa;
|
||||||
|
|
|
@ -243,4 +243,16 @@ extern _X_EXPORT int dixLookupResourceByClass(void **result,
|
||||||
extern _X_EXPORT RESTYPE lastResourceType;
|
extern _X_EXPORT RESTYPE lastResourceType;
|
||||||
extern _X_EXPORT RESTYPE TypeMask;
|
extern _X_EXPORT RESTYPE TypeMask;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @brief allocate a XID (resource ID) for the server itself
|
||||||
|
*
|
||||||
|
* This is mostly for resource types that don't have their own API yet
|
||||||
|
* The XID is allocated within server's ID space and then can be used
|
||||||
|
* for registering a resource with it (@see AddResource())
|
||||||
|
*
|
||||||
|
* @obsoletes FakeClientID
|
||||||
|
* @return XID the newly allocated XID
|
||||||
|
*/
|
||||||
|
_X_EXPORT XID dixAllocServerXID(void);
|
||||||
|
|
||||||
#endif /* RESOURCE_H */
|
#endif /* RESOURCE_H */
|
||||||
|
|
|
@ -500,7 +500,7 @@ miInitVisuals(VisualPtr * visualp, DepthPtr * depthp, int *nvisualp,
|
||||||
visual->bitsPerRGBValue = visuals->bitsPerRGB;
|
visual->bitsPerRGBValue = visuals->bitsPerRGB;
|
||||||
visual->ColormapEntries = 1 << d;
|
visual->ColormapEntries = 1 << d;
|
||||||
visual->nplanes = d;
|
visual->nplanes = d;
|
||||||
visual->vid = FakeClientID(0);
|
visual->vid = dixAllocServerXID();
|
||||||
if (vid)
|
if (vid)
|
||||||
*vid = visual->vid;
|
*vid = visual->vid;
|
||||||
else
|
else
|
||||||
|
|
|
@ -70,7 +70,7 @@ MitAddCookie(unsigned short data_length, const char *data)
|
||||||
mit_auth = new;
|
mit_auth = new;
|
||||||
memcpy(new->data, data, (size_t) data_length);
|
memcpy(new->data, data, (size_t) data_length);
|
||||||
new->len = data_length;
|
new->len = data_length;
|
||||||
new->id = FakeClientID(0);
|
new->id = dixAllocServerXID();
|
||||||
return new->id;
|
return new->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -368,7 +368,7 @@ XdmAddCookie(unsigned short data_length, const char *data)
|
||||||
xdmAuth = new;
|
xdmAuth = new;
|
||||||
memcpy(new->key.data, key_bits, 8);
|
memcpy(new->key.data, key_bits, 8);
|
||||||
memcpy(new->rho.data, rho_bits, 8);
|
memcpy(new->rho.data, rho_bits, 8);
|
||||||
new->id = FakeClientID(0);
|
new->id = dixAllocServerXID();
|
||||||
return new->id;
|
return new->id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ RRCrtcCreate(ScreenPtr pScreen, void *devPrivate)
|
||||||
crtc = calloc(1, sizeof(RRCrtcRec));
|
crtc = calloc(1, sizeof(RRCrtcRec));
|
||||||
if (!crtc)
|
if (!crtc)
|
||||||
return NULL;
|
return NULL;
|
||||||
crtc->id = FakeClientID(0);
|
crtc->id = dixAllocServerXID();
|
||||||
crtc->pScreen = pScreen;
|
crtc->pScreen = pScreen;
|
||||||
crtc->rotation = RR_Rotate_0;
|
crtc->rotation = RR_Rotate_0;
|
||||||
crtc->rotations = RR_Rotate_0;
|
crtc->rotations = RR_Rotate_0;
|
||||||
|
|
|
@ -91,7 +91,7 @@ RRModeCreate(xRRModeInfo * modeInfo, const char *name, ScreenPtr userScreen)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
mode->mode.id = FakeClientID(0);
|
mode->mode.id = dixAllocServerXID();
|
||||||
if (!AddResource(mode->mode.id, RRModeType, (void *) mode)) {
|
if (!AddResource(mode->mode.id, RRModeType, (void *) mode)) {
|
||||||
free(newModes);
|
free(newModes);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -87,7 +87,7 @@ RROutputCreate(ScreenPtr pScreen,
|
||||||
output = calloc(1, sizeof(RROutputRec) + nameLength + 1);
|
output = calloc(1, sizeof(RROutputRec) + nameLength + 1);
|
||||||
if (!output)
|
if (!output)
|
||||||
return NULL;
|
return NULL;
|
||||||
output->id = FakeClientID(0);
|
output->id = dixAllocServerXID();
|
||||||
output->pScreen = pScreen;
|
output->pScreen = pScreen;
|
||||||
output->name = (char *) (output + 1);
|
output->name = (char *) (output + 1);
|
||||||
output->nameLength = nameLength;
|
output->nameLength = nameLength;
|
||||||
|
|
|
@ -402,7 +402,7 @@ RRProviderCreate(ScreenPtr pScreen, const char *name,
|
||||||
if (!provider)
|
if (!provider)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
provider->id = FakeClientID(0);
|
provider->id = dixAllocServerXID();
|
||||||
provider->pScreen = pScreen;
|
provider->pScreen = pScreen;
|
||||||
provider->name = (char *) (provider + 1);
|
provider->name = (char *) (provider + 1);
|
||||||
provider->nameLength = nameLength;
|
provider->nameLength = nameLength;
|
||||||
|
|
|
@ -288,7 +288,7 @@ PictureCreateDefaultFormats(ScreenPtr pScreen, int *nformatp)
|
||||||
if (!pFormats)
|
if (!pFormats)
|
||||||
return 0;
|
return 0;
|
||||||
for (f = 0; f < nformats; f++) {
|
for (f = 0; f < nformats; f++) {
|
||||||
pFormats[f].id = FakeClientID(0);
|
pFormats[f].id = dixAllocServerXID();
|
||||||
pFormats[f].depth = formats[f].depth;
|
pFormats[f].depth = formats[f].depth;
|
||||||
format = formats[f].format;
|
format = formats[f].format;
|
||||||
pFormats[f].format = format;
|
pFormats[f].format = format;
|
||||||
|
@ -420,8 +420,8 @@ PictureInitIndexedFormat(ScreenPtr pScreen, PictFormatPtr format)
|
||||||
if (pVisual == NULL)
|
if (pVisual == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (dixCreateColormap(FakeClientID(0), pScreen, pVisual,
|
if (dixCreateColormap(dixAllocServerXID(), pScreen, pVisual,
|
||||||
&format->index.pColormap, AllocNone, serverClient)
|
&format->index.pColormap, AllocNone, 0)
|
||||||
!= Success)
|
!= Success)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue