aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/dix/dispatch.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/dix/dispatch.c')
-rw-r--r--xorg-server/dix/dispatch.c166
1 files changed, 83 insertions, 83 deletions
diff --git a/xorg-server/dix/dispatch.c b/xorg-server/dix/dispatch.c
index fd4f9c330..38666a422 100644
--- a/xorg-server/dix/dispatch.c
+++ b/xorg-server/dix/dispatch.c
@@ -590,7 +590,7 @@ CreateConnectionBlock(void)
VisualPtr pVisual;
pScreen = screenInfo.screens[i];
- root.windowId = WindowTable[i]->drawable.id;
+ root.windowId = pScreen->root->drawable.id;
root.defaultColormap = pScreen->defColormap;
root.whitePixel = pScreen->whitePixel;
root.blackPixel = pScreen->blackPixel;
@@ -659,7 +659,7 @@ CreateConnectionBlock(void)
int
ProcBadRequest(ClientPtr client)
{
- return (BadRequest);
+ return BadRequest;
}
int
@@ -940,7 +940,7 @@ GetGeometry(ClientPtr client, xGetGeometryReply *rep)
rep->type = X_Reply;
rep->length = 0;
rep->sequenceNumber = client->sequence;
- rep->root = WindowTable[pDraw->pScreen->myNum]->drawable.id;
+ rep->root = pDraw->pScreen->root->drawable.id;
rep->depth = pDraw->depth;
rep->width = pDraw->width;
rep->height = pDraw->height;
@@ -1007,7 +1007,7 @@ ProcQueryTree(ClientPtr client)
return rc;
memset(&reply, 0, sizeof(xQueryTreeReply));
reply.type = X_Reply;
- reply.root = WindowTable[pWin->drawable.pScreen->myNum]->drawable.id;
+ reply.root = pWin->drawable.pScreen->root->drawable.id;
reply.sequenceNumber = client->sequence;
if (pWin->parent)
reply.parent = pWin->parent->drawable.id;
@@ -1058,7 +1058,7 @@ ProcInternAtom(ClientPtr client)
if ((stuff->onlyIfExists != xTrue) && (stuff->onlyIfExists != xFalse))
{
client->errorValue = stuff->onlyIfExists;
- return(BadValue);
+ return BadValue;
}
tchar = (char *) &stuff[1];
atom = MakeAtom(tchar, stuff->nbytes, !stuff->onlyIfExists);
@@ -1074,7 +1074,7 @@ ProcInternAtom(ClientPtr client)
return Success;
}
else
- return (BadAlloc);
+ return BadAlloc;
}
int
@@ -1101,7 +1101,7 @@ ProcGetAtomName(ClientPtr client)
else
{
client->errorValue = stuff->id;
- return (BadAtom);
+ return BadAtom;
}
}
@@ -1220,14 +1220,12 @@ ProcTranslateCoords(ClientPtr client)
* borderSize
*/
&& (!wBoundingShape(pWin) ||
- POINT_IN_REGION(pWin->drawable.pScreen,
- &pWin->borderSize, x, y, &box))
+ RegionContainsPoint(&pWin->borderSize, x, y, &box))
&& (!wInputShape(pWin) ||
- POINT_IN_REGION(pWin->drawable.pScreen,
- wInputShape(pWin),
- x - pWin->drawable.x,
- y - pWin->drawable.y, &box))
+ RegionContainsPoint(wInputShape(pWin),
+ x - pWin->drawable.x,
+ y - pWin->drawable.y, &box))
)
{
rep.child = pWin->drawable.id;
@@ -1318,7 +1316,7 @@ ProcQueryFont(ClientPtr client)
reply = calloc(1, rlength);
if(!reply)
{
- return(BadAlloc);
+ return BadAlloc;
}
reply->type = X_Reply;
@@ -1352,11 +1350,11 @@ ProcQueryTextExtents(ClientPtr client)
if (stuff->oddLength)
{
if (length == 0)
- return(BadLength);
+ return BadLength;
length--;
}
if (!QueryTextExtents(pFont, length, (unsigned char *)&stuff[1], &info))
- return(BadAlloc);
+ return BadAlloc;
reply.type = X_Reply;
reply.length = 0;
reply.sequenceNumber = client->sequence;
@@ -1473,7 +1471,7 @@ CreatePmap:
return Success;
(*pDraw->pScreen->DestroyPixmap)(pMap);
}
- return (BadAlloc);
+ return BadAlloc;
}
int
@@ -1523,7 +1521,7 @@ ProcCreateGC(ClientPtr client)
if (error != Success)
return error;
if (!AddResource(stuff->gc, RT_GC, (pointer)pGC))
- return (BadAlloc);
+ return BadAlloc;
return Success;
}
@@ -1563,7 +1561,7 @@ ProcCopyGC(ClientPtr client)
if (result != Success)
return result;
if ((dstGC->pScreen != pGC->pScreen) || (dstGC->depth != pGC->depth))
- return (BadMatch);
+ return BadMatch;
if (stuff->mask & ~GCAllBits)
{
client->errorValue = stuff->mask;
@@ -1617,7 +1615,7 @@ ProcSetClipRectangles(ClientPtr client)
nr = (client->req_len << 2) - sizeof(xSetClipRectanglesReq);
if (nr & 4)
- return(BadLength);
+ return BadLength;
nr >>= 3;
return SetClipRects(pGC, stuff->xOrigin, stuff->yOrigin,
nr, (xRectangle *)&stuff[1], (int)stuff->ordering);
@@ -1653,12 +1651,12 @@ ProcClearToBackground(ClientPtr client)
if (pWin->drawable.class == InputOnly)
{
client->errorValue = stuff->window;
- return (BadMatch);
+ return BadMatch;
}
if ((stuff->exposures != xTrue) && (stuff->exposures != xFalse))
{
client->errorValue = stuff->exposures;
- return(BadValue);
+ return BadValue;
}
(*pWin->drawable.pScreen->ClearToBackground)(pWin, stuff->x, stuff->y,
stuff->width, stuff->height,
@@ -1688,7 +1686,7 @@ ProcCopyArea(ClientPtr client)
if ((pDst->pScreen != pSrc->pScreen) || (pDst->depth != pSrc->depth))
{
client->errorValue = stuff->dstDrawable;
- return (BadMatch);
+ return BadMatch;
}
}
else
@@ -1702,7 +1700,7 @@ ProcCopyArea(ClientPtr client)
(*pDst->pScreen->SendGraphicsExpose)
(client, pRgn, stuff->dstDrawable, X_CopyArea, 0);
if (pRgn)
- REGION_DESTROY(pDst->pScreen, pRgn);
+ RegionDestroy(pRgn);
}
return Success;
@@ -1730,7 +1728,7 @@ ProcCopyPlane(ClientPtr client)
if (pdstDraw->pScreen != psrcDraw->pScreen)
{
client->errorValue = stuff->dstDrawable;
- return (BadMatch);
+ return BadMatch;
}
}
else
@@ -1741,7 +1739,7 @@ ProcCopyPlane(ClientPtr client)
(stuff->bitPlane > (1L << (psrcDraw->depth - 1))))
{
client->errorValue = stuff->bitPlane;
- return(BadValue);
+ return BadValue;
}
pRgn = (*pGC->ops->CopyPlane)(psrcDraw, pdstDraw, pGC, stuff->srcX, stuff->srcY,
@@ -1752,7 +1750,7 @@ ProcCopyPlane(ClientPtr client)
(*pdstDraw->pScreen->SendGraphicsExpose)
(client, pRgn, stuff->dstDrawable, X_CopyPlane, 0);
if (pRgn)
- REGION_DESTROY(pdstDraw->pScreen, pRgn);
+ RegionDestroy(pRgn);
}
return Success;
}
@@ -1815,7 +1813,7 @@ ProcPolySegment(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
nsegs = (client->req_len << 2) - sizeof(xPolySegmentReq);
if (nsegs & 4)
- return(BadLength);
+ return BadLength;
nsegs >>= 3;
if (nsegs)
(*pGC->ops->PolySegment)(pDraw, pGC, nsegs, (xSegment *) &stuff[1]);
@@ -1834,7 +1832,7 @@ ProcPolyRectangle (ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
nrects = (client->req_len << 2) - sizeof(xPolyRectangleReq);
if (nrects & 4)
- return(BadLength);
+ return BadLength;
nrects >>= 3;
if (nrects)
(*pGC->ops->PolyRectangle)(pDraw, pGC,
@@ -1854,7 +1852,7 @@ ProcPolyArc(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
narcs = (client->req_len << 2) - sizeof(xPolyArcReq);
if (narcs % sizeof(xArc))
- return(BadLength);
+ return BadLength;
narcs /= sizeof(xArc);
if (narcs)
(*pGC->ops->PolyArc)(pDraw, pGC, narcs, (xArc *) &stuff[1]);
@@ -1904,7 +1902,7 @@ ProcPolyFillRectangle(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq);
if (things & 4)
- return(BadLength);
+ return BadLength;
things >>= 3;
if (things)
@@ -1925,7 +1923,7 @@ ProcPolyFillArc(ClientPtr client)
VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess);
narcs = (client->req_len << 2) - sizeof(xPolyFillArcReq);
if (narcs % sizeof(xArc))
- return(BadLength);
+ return BadLength;
narcs /= sizeof(xArc);
if (narcs)
(*pGC->ops->PolyFillArc) (pDraw, pGC, narcs, (xArc *) &stuff[1]);
@@ -2062,7 +2060,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
if ((format != XYPixmap) && (format != ZPixmap))
{
client->errorValue = format;
- return(BadValue);
+ return BadValue;
}
rc = dixLookupDrawable(&pDraw, drawable, client, 0, DixReadAccess);
if (rc != Success)
@@ -2096,7 +2094,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
}
else
{
- pBoundingDraw = (DrawablePtr)WindowTable[pDraw->pScreen->myNum];
+ pBoundingDraw = (DrawablePtr)pDraw->pScreen->root;
}
xgi.visual = wVisual (pWin);
@@ -2146,7 +2144,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
if (im_return) {
pBuf = calloc(1, sz_xGetImageReply + length);
if (!pBuf)
- return (BadAlloc);
+ return BadAlloc;
if (widthBytesLine == 0)
linesPerBuf = 0;
else
@@ -2183,7 +2181,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
}
}
if(!(pBuf = calloc(1, length)))
- return (BadAlloc);
+ return BadAlloc;
WriteReplyToClient(client, sizeof (xGetImageReply), &xgi);
}
@@ -2192,8 +2190,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
pVisibleRegion = NotClippedByChildren((WindowPtr)pDraw);
if (pVisibleRegion)
{
- REGION_TRANSLATE(pDraw->pScreen, pVisibleRegion,
- -pDraw->x, -pDraw->y);
+ RegionTranslate(pVisibleRegion, -pDraw->x, -pDraw->y);
}
}
@@ -2281,7 +2278,7 @@ DoGetImage(ClientPtr client, int format, Drawable drawable,
}
}
if (pVisibleRegion)
- REGION_DESTROY(pDraw->pScreen, pVisibleRegion);
+ RegionDestroy(pVisibleRegion);
if (!im_return)
free(pBuf);
return Success;
@@ -2406,7 +2403,7 @@ ProcCreateColormap(ClientPtr client)
if ((stuff->alloc != AllocNone) && (stuff->alloc != AllocAll))
{
client->errorValue = stuff->alloc;
- return(BadValue);
+ return BadValue;
}
mid = stuff->mid;
LEGAL_NEW_RESOURCE(mid, client);
@@ -2425,7 +2422,7 @@ ProcCreateColormap(ClientPtr client)
(int)stuff->alloc, client->index);
}
client->errorValue = stuff->visual;
- return(BadMatch);
+ return BadMatch;
}
int
@@ -2551,7 +2548,7 @@ ProcListInstalledColormaps(ClientPtr client)
pWin->drawable.pScreen->maxInstalledCmaps *
sizeof(Colormap));
if(!preply)
- return(BadAlloc);
+ return BadAlloc;
preply->type = X_Reply;
preply->sequenceNumber = client->sequence;
@@ -2639,7 +2636,7 @@ ProcAllocNamedColor (ClientPtr client)
return Success;
}
else
- return(BadName);
+ return BadName;
}
else
@@ -2670,18 +2667,18 @@ ProcAllocColorCells (ClientPtr client)
if (!npixels)
{
client->errorValue = npixels;
- return (BadValue);
+ return BadValue;
}
if (stuff->contiguous != xTrue && stuff->contiguous != xFalse)
{
client->errorValue = stuff->contiguous;
- return (BadValue);
+ return BadValue;
}
nmasks = stuff->planes;
length = ((long)npixels + (long)nmasks) * sizeof(Pixel);
ppixels = malloc(length);
if(!ppixels)
- return(BadAlloc);
+ return BadAlloc;
pmasks = ppixels + npixels;
if( (rc = AllocColorCells(client->index, pcmp, npixels, nmasks,
@@ -2734,12 +2731,12 @@ ProcAllocColorPlanes(ClientPtr client)
if (!npixels)
{
client->errorValue = npixels;
- return (BadValue);
+ return BadValue;
}
if (stuff->contiguous != xTrue && stuff->contiguous != xFalse)
{
client->errorValue = stuff->contiguous;
- return (BadValue);
+ return BadValue;
}
acpr.type = X_Reply;
acpr.sequenceNumber = client->sequence;
@@ -2747,7 +2744,7 @@ ProcAllocColorPlanes(ClientPtr client)
length = (long)npixels * sizeof(Pixel);
ppixels = malloc(length);
if(!ppixels)
- return(BadAlloc);
+ return BadAlloc;
if( (rc = AllocColorPlanes(client->index, pcmp, npixels,
(int)stuff->red, (int)stuff->green, (int)stuff->blue,
(Bool)stuff->contiguous, ppixels,
@@ -2790,7 +2787,7 @@ ProcFreeColors(ClientPtr client)
int count;
if(pcmp->flags & AllAllocated)
- return(BadAccess);
+ return BadAccess;
count = bytes_to_int32((client->req_len << 2) - sizeof(xFreeColorsReq));
return FreeColors(pcmp, client->index, count,
(Pixel *)&stuff[1], (Pixel)stuff->planeMask);
@@ -2818,7 +2815,7 @@ ProcStoreColors (ClientPtr client)
count = (client->req_len << 2) - sizeof(xStoreColorsReq);
if (count % sizeof(xColorItem))
- return(BadLength);
+ return BadLength;
count /= sizeof(xColorItem);
return StoreColors(pcmp, count, (xColorItem *)&stuff[1], client);
}
@@ -2850,7 +2847,7 @@ ProcStoreNamedColor (ClientPtr client)
def.pixel = stuff->pixel;
return StoreColors(pcmp, 1, &def, client);
}
- return (BadName);
+ return BadName;
}
else
{
@@ -2878,10 +2875,10 @@ ProcQueryColors(ClientPtr client)
count = bytes_to_int32((client->req_len << 2) - sizeof(xQueryColorsReq));
prgbs = calloc(1, count * sizeof(xrgb));
if(!prgbs && count)
- return(BadAlloc);
+ return BadAlloc;
if( (rc = QueryColors(pcmp, count, (Pixel *)&stuff[1], prgbs, client)) )
{
- if (prgbs) free(prgbs);
+ free(prgbs);
return rc;
}
memset(&qcr, 0, sizeof(xQueryColorsReply));
@@ -2895,7 +2892,7 @@ ProcQueryColors(ClientPtr client)
client->pSwapReplyFunc = (ReplySwapPtr) SQColorsExtend;
WriteSwappedDataToClient(client, count * sizeof(xrgb), prgbs);
}
- if (prgbs) free(prgbs);
+ free(prgbs);
return Success;
}
@@ -2936,7 +2933,7 @@ ProcLookupColor(ClientPtr client)
WriteReplyToClient(client, sizeof(xLookupColorReply), &lcr);
return Success;
}
- return (BadName);
+ return BadName;
}
else
{
@@ -2984,24 +2981,24 @@ ProcCreateCursor (ClientPtr client)
|| src->drawable.height != msk->drawable.height
|| src->drawable.depth != 1
|| msk->drawable.depth != 1)
- return (BadMatch);
+ return BadMatch;
width = src->drawable.width;
height = src->drawable.height;
if ( stuff->x > width
|| stuff->y > height )
- return (BadMatch);
+ return BadMatch;
n = BitmapBytePad(width)*height;
srcbits = calloc(1, n);
if (!srcbits)
- return (BadAlloc);
+ return BadAlloc;
mskbits = malloc(n);
if (!mskbits)
{
free(srcbits);
- return (BadAlloc);
+ return BadAlloc;
}
(* src->drawable.pScreen->GetImage)( (DrawablePtr)src, 0, 0, width, height,
@@ -3015,7 +3012,7 @@ ProcCreateCursor (ClientPtr client)
else
{
/* zeroing the (pad) bits helps some ddx cursor handling */
- bzero((char *)mskbits, n);
+ memset((char *)mskbits, 0, n);
(* msk->drawable.pScreen->GetImage)( (DrawablePtr)msk, 0, 0, width,
height, XYPixmap, 1, (pointer)mskbits);
}
@@ -3097,7 +3094,7 @@ ProcQueryBestSize (ClientPtr client)
(stuff->class != StippleShape))
{
client->errorValue = stuff->class;
- return(BadValue);
+ return BadValue;
}
rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY,
@@ -3105,7 +3102,7 @@ ProcQueryBestSize (ClientPtr client)
if (rc != Success)
return rc;
if (stuff->class != CursorShape && pDraw->type == UNDRAWABLE_WINDOW)
- return (BadMatch);
+ return BadMatch;
pScreen = pDraw->pScreen;
rc = XaceHook(XACE_SCREEN_ACCESS, client, pScreen, DixGetAttrAccess);
if (rc != Success)
@@ -3245,7 +3242,7 @@ ProcListHosts(ClientPtr client)
result = GetHosts(&pdata, &nHosts, &len, &reply.enabled);
if (result != Success)
- return(result);
+ return result;
reply.type = X_Reply;
reply.sequenceNumber = client->sequence;
reply.nHosts = nHosts;
@@ -3320,7 +3317,7 @@ ProcKillClient(ClientPtr client)
* doesn't try to touch client
*/
isItTimeToYield = TRUE;
- return (Success);
+ return Success;
}
return Success;
}
@@ -3346,12 +3343,12 @@ ProcSetFontPath(ClientPtr client)
while (--nfonts >= 0)
{
if ((total == 0) || (total < (n = (*ptr + 1))))
- return(BadLength);
+ return BadLength;
total -= n;
ptr += n;
}
if (total >= 4)
- return(BadLength);
+ return BadLength;
return SetFontPath(client, stuff->nFonts, (unsigned char *)&stuff[1]);
}
@@ -3400,7 +3397,7 @@ ProcChangeCloseDownMode(ClientPtr client)
else
{
client->errorValue = stuff->mode;
- return (BadValue);
+ return BadValue;
}
}
@@ -3539,8 +3536,7 @@ CloseDownClient(ClientPtr client)
nextFreeClientID = client->index;
clients[client->index] = NullClient;
SmartLastClient = NullClient;
- dixFreePrivates(client->devPrivates);
- free(client);
+ dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
while (!clients[currentMaxClients-1])
currentMaxClients--;
@@ -3561,7 +3557,6 @@ KillAllClients(void)
void InitClient(ClientPtr client, int i, pointer ospriv)
{
- memset(client, 0, sizeof(*client));
client->index = i;
client->clientAsMask = ((Mask)i) << CLIENTOFFSET;
client->closeDownMode = i ? DestroyAll : RetainPermanent;
@@ -3589,13 +3584,13 @@ ClientPtr NextAvailableClient(pointer ospriv)
i = nextFreeClientID;
if (i == MAXCLIENTS)
return (ClientPtr)NULL;
- clients[i] = client = malloc(sizeof(ClientRec));
+ clients[i] = client = dixAllocateObjectWithPrivates(ClientRec, PRIVATE_CLIENT);
if (!client)
return (ClientPtr)NULL;
InitClient(client, i, ospriv);
if (!InitClientResources(client))
{
- free(client);
+ dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
return (ClientPtr)NULL;
}
data.reqType = 1;
@@ -3603,7 +3598,7 @@ ClientPtr NextAvailableClient(pointer ospriv)
if (!InsertFakeRequest(client, (char *)&data, sz_xReq))
{
FreeClientResources(client);
- free(client);
+ dixFreeObjectWithPrivates(client, PRIVATE_CLIENT);
return (ClientPtr)NULL;
}
if (i == currentMaxClients)
@@ -3619,7 +3614,7 @@ ClientPtr NextAvailableClient(pointer ospriv)
clientinfo.setup = (xConnSetup *) NULL;
CallCallbacks((&ClientStateCallback), (pointer)&clientinfo);
}
- return(client);
+ return client;
}
int
@@ -3631,7 +3626,7 @@ ProcInitialConnection(ClientPtr client)
prefix = (xConnClientPrefix *)((char *)stuff + sz_xReq);
if ((prefix->byteOrder != 'l') && (prefix->byteOrder != 'B'))
- return (client->noClientException = -1);
+ return client->noClientException = -1;
if (((*(char *) &whichbyte) && (prefix->byteOrder == 'B')) ||
(!(*(char *) &whichbyte) && (prefix->byteOrder == 'l')))
{
@@ -3672,7 +3667,7 @@ SendConnSetup(ClientPtr client, char *reason)
else
(void)WriteToClient(client, sz_xConnSetupPrefix, (char *) &csp);
(void)WriteToClient(client, (int)csp.lengthReason, reason);
- return (client->noClientException = -1);
+ return client->noClientException = -1;
}
numScreens = screenInfo.numScreens;
@@ -3707,9 +3702,9 @@ SendConnSetup(ClientPtr client, char *reason)
{
unsigned int j;
xDepth *pDepth;
+ WindowPtr pRoot = screenInfo.screens[i]->root;
- root->currentInputMask = WindowTable[i]->eventMask |
- wOtherEventMasks (WindowTable[i]);
+ root->currentInputMask = pRoot->eventMask | wOtherEventMasks(pRoot);
pDepth = (xDepth *)(root + 1);
for (j = 0; j < root->nDepths; j++)
{
@@ -3909,9 +3904,12 @@ AddScreen(
if (!pScreen)
return -1;
- pScreen->devPrivates = NULL;
+ if (!dixAllocatePrivates(&pScreen->devPrivates, PRIVATE_SCREEN)) {
+ free (pScreen);
+ return -1;
+ }
pScreen->myNum = i;
- pScreen->totalPixmapSize = BitmapBytePad(sizeof(PixmapRec)*8);
+ pScreen->totalPixmapSize = 0; /* computed in CreateScratchPixmapForScreen */
pScreen->ClipNotify = 0; /* for R4 ddx compatibility */
pScreen->CreateScreenResources = 0;
@@ -3957,15 +3955,17 @@ AddScreen(
any of the strings pointed to by argv. They may be passed to
multiple screens.
*/
- WindowTable[i] = NullWindow;
screenInfo.screens[i] = pScreen;
screenInfo.numScreens++;
if (!(*pfnInit)(i, pScreen, argc, argv))
{
- dixFreePrivates(pScreen->devPrivates);
+ dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
free(pScreen);
screenInfo.numScreens--;
return -1;
}
+
+ dixRegisterPrivateKey(&cursorScreenDevPriv[i], PRIVATE_CURSOR, 0);
+
return i;
}