diff options
author | Tiago Vignatti <tiago.vignatti@nokia.com> | 2010-07-16 20:19:50 +0300 |
---|---|---|
committer | Tiago Vignatti <tiago.vignatti@nokia.com> | 2010-09-28 16:45:05 +0300 |
commit | cbd4d5dbb70db62ba1cb79c7b904e6fa11f62d7e (patch) | |
tree | d949b9d89a19e5d07a81583c0b3a3d1d6ebb2ce2 /Xext | |
parent | 58bd317e29f4abf7f950891339d2a6a78ddf7903 (diff) |
xserver: delete pervasively use of DISPATCH_PROC
Some functions had to be moved around due some missing static definitions.
Another minor clean up like inexistent function declarations and etc were made
also.
Part of this patch was cooked using:
sed -i -e '/static DISPATCH_PROC*.*;/d' `git ls-files`
Signed-off-by: Tiago Vignatti <tiago.vignatti@nokia.com>
Reviewed-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Diffstat (limited to 'Xext')
-rw-r--r-- | Xext/bigreq.c | 18 | ||||
-rw-r--r-- | Xext/saver.c | 88 | ||||
-rw-r--r-- | Xext/shape.c | 54 | ||||
-rw-r--r-- | Xext/shm.c | 557 | ||||
-rw-r--r-- | Xext/sync.c | 30 | ||||
-rw-r--r-- | Xext/xcmisc.c | 26 | ||||
-rw-r--r-- | Xext/xf86bigfont.c | 6 | ||||
-rw-r--r-- | Xext/xtest.c | 29 |
8 files changed, 345 insertions, 463 deletions
diff --git a/Xext/bigreq.c b/Xext/bigreq.c index ce3734e8d..a540bcbcb 100644 --- a/Xext/bigreq.c +++ b/Xext/bigreq.c @@ -40,18 +40,8 @@ from The Open Group. #include "opaque.h" #include "modinit.h" -static DISPATCH_PROC(ProcBigReqDispatch); - void BigReqExtensionInit(INITARGS); -void -BigReqExtensionInit(INITARGS) -{ - AddExtension(XBigReqExtensionName, 0, 0, - ProcBigReqDispatch, ProcBigReqDispatch, - NULL, StandardMinorOpcode); -} - static int ProcBigReqDispatch (ClientPtr client) { @@ -78,3 +68,11 @@ ProcBigReqDispatch (ClientPtr client) WriteToClient(client, sizeof(xBigReqEnableReply), (char *)&rep); return Success; } + +void +BigReqExtensionInit(INITARGS) +{ + AddExtension(XBigReqExtensionName, 0, 0, + ProcBigReqDispatch, ProcBigReqDispatch, + NULL, StandardMinorOpcode); +} diff --git a/Xext/saver.c b/Xext/saver.c index 6d91ddf5e..18886038a 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -62,20 +62,6 @@ in this Software without prior written authorization from the X Consortium. static int ScreenSaverEventBase = 0; -static DISPATCH_PROC(ProcScreenSaverQueryInfo); -static DISPATCH_PROC(ProcScreenSaverDispatch); -static DISPATCH_PROC(ProcScreenSaverQueryVersion); -static DISPATCH_PROC(ProcScreenSaverSelectInput); -static DISPATCH_PROC(ProcScreenSaverSetAttributes); -static DISPATCH_PROC(ProcScreenSaverUnsetAttributes); -static DISPATCH_PROC(ProcScreenSaverSuspend); -static DISPATCH_PROC(SProcScreenSaverDispatch); -static DISPATCH_PROC(SProcScreenSaverQueryInfo); -static DISPATCH_PROC(SProcScreenSaverQueryVersion); -static DISPATCH_PROC(SProcScreenSaverSelectInput); -static DISPATCH_PROC(SProcScreenSaverSetAttributes); -static DISPATCH_PROC(SProcScreenSaverUnsetAttributes); -static DISPATCH_PROC(SProcScreenSaverSuspend); static Bool ScreenSaverHandle ( ScreenPtr /* pScreen */, @@ -237,45 +223,6 @@ static DevPrivateKeyRec ScreenPrivateKeyRec; #define New(t) (malloc(sizeof (t))) -/**************** - * ScreenSaverExtensionInit - * - * Called from InitExtensions in main() or from QueryExtension() if the - * extension is dynamically loaded. - * - ****************/ - -void -ScreenSaverExtensionInit(INITARGS) -{ - ExtensionEntry *extEntry; - int i; - ScreenPtr pScreen; - - if (!dixRegisterPrivateKey(&ScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) - return; - - AttrType = CreateNewResourceType(ScreenSaverFreeAttr, "SaverAttr"); - SaverEventType = CreateNewResourceType(ScreenSaverFreeEvents, - "SaverEvent"); - SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend, - "SaverSuspend"); - - for (i = 0; i < screenInfo.numScreens; i++) - { - pScreen = screenInfo.screens[i]; - SetScreenPrivate (pScreen, NULL); - } - if (AttrType && SaverEventType && SuspendType && - (extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0, - ProcScreenSaverDispatch, SProcScreenSaverDispatch, - NULL, StandardMinorOpcode))) - { - ScreenSaverEventBase = extEntry->eventBase; - EventSwapVector[ScreenSaverEventBase] = (EventSwapPtr) SScreenSaverNotifyEvent; - } -} - static void CheckScreenPrivate (ScreenPtr pScreen) { @@ -1412,7 +1359,7 @@ ProcScreenSaverSuspend (ClientPtr client) return Success; } -static DISPATCH_PROC((*NormalVector[])) = { +static int (*NormalVector[]) (ClientPtr /* client */) = { ProcScreenSaverQueryVersion, ProcScreenSaverQueryInfo, ProcScreenSaverSelectInput, @@ -1513,7 +1460,7 @@ SProcScreenSaverSuspend (ClientPtr client) return ProcScreenSaverSuspend (client); } -static DISPATCH_PROC((*SwappedVector[])) = { +static int (*SwappedVector[]) (ClientPtr /* client */) = { SProcScreenSaverQueryVersion, SProcScreenSaverQueryInfo, SProcScreenSaverSelectInput, @@ -1531,3 +1478,34 @@ SProcScreenSaverDispatch (ClientPtr client) return (*SwappedVector[stuff->data])(client); return BadRequest; } + +void +ScreenSaverExtensionInit(INITARGS) +{ + ExtensionEntry *extEntry; + int i; + ScreenPtr pScreen; + + if (!dixRegisterPrivateKey(&ScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) + return; + + AttrType = CreateNewResourceType(ScreenSaverFreeAttr, "SaverAttr"); + SaverEventType = CreateNewResourceType(ScreenSaverFreeEvents, + "SaverEvent"); + SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend, + "SaverSuspend"); + + for (i = 0; i < screenInfo.numScreens; i++) + { + pScreen = screenInfo.screens[i]; + SetScreenPrivate (pScreen, NULL); + } + if (AttrType && SaverEventType && SuspendType && + (extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0, + ProcScreenSaverDispatch, SProcScreenSaverDispatch, + NULL, StandardMinorOpcode))) + { + ScreenSaverEventBase = extEntry->eventBase; + EventSwapVector[ScreenSaverEventBase] = (EventSwapPtr) SScreenSaverNotifyEvent; + } +} diff --git a/Xext/shape.c b/Xext/shape.c index ac95328b8..115fc07ed 100644 --- a/Xext/shape.c +++ b/Xext/shape.c @@ -68,26 +68,6 @@ static void SShapeNotifyEvent( * externally by the Xfixes extension and are now defined in window.h */ -static DISPATCH_PROC(ProcShapeCombine); -static DISPATCH_PROC(ProcShapeDispatch); -static DISPATCH_PROC(ProcShapeGetRectangles); -static DISPATCH_PROC(ProcShapeInputSelected); -static DISPATCH_PROC(ProcShapeMask); -static DISPATCH_PROC(ProcShapeOffset); -static DISPATCH_PROC(ProcShapeQueryExtents); -static DISPATCH_PROC(ProcShapeQueryVersion); -static DISPATCH_PROC(ProcShapeRectangles); -static DISPATCH_PROC(ProcShapeSelectInput); -static DISPATCH_PROC(SProcShapeCombine); -static DISPATCH_PROC(SProcShapeDispatch); -static DISPATCH_PROC(SProcShapeGetRectangles); -static DISPATCH_PROC(SProcShapeInputSelected); -static DISPATCH_PROC(SProcShapeMask); -static DISPATCH_PROC(SProcShapeOffset); -static DISPATCH_PROC(SProcShapeQueryExtents); -static DISPATCH_PROC(SProcShapeQueryVersion); -static DISPATCH_PROC(SProcShapeRectangles); -static DISPATCH_PROC(SProcShapeSelectInput); #ifdef PANORAMIX #include "panoramiX.h" @@ -122,23 +102,6 @@ typedef struct _ShapeEvent { * ****************/ -void -ShapeExtensionInit(void) -{ - ExtensionEntry *extEntry; - - ClientType = CreateNewResourceType(ShapeFreeClient, "ShapeClient"); - ShapeEventType = CreateNewResourceType(ShapeFreeEvents, "ShapeEvent"); - if (ClientType && ShapeEventType && - (extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0, - ProcShapeDispatch, SProcShapeDispatch, - NULL, StandardMinorOpcode))) - { - ShapeEventBase = extEntry->eventBase; - EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent; - } -} - static int RegionOperate ( ClientPtr client, @@ -1278,3 +1241,20 @@ SProcShapeDispatch (ClientPtr client) return BadRequest; } } + +void +ShapeExtensionInit(void) +{ + ExtensionEntry *extEntry; + + ClientType = CreateNewResourceType(ShapeFreeClient, "ShapeClient"); + ShapeEventType = CreateNewResourceType(ShapeFreeEvents, "ShapeEvent"); + if (ClientType && ShapeEventType && + (extEntry = AddExtension(SHAPENAME, ShapeNumberEvents, 0, + ProcShapeDispatch, SProcShapeDispatch, + NULL, StandardMinorOpcode))) + { + ShapeEventBase = extEntry->eventBase; + EventSwapVector[ShapeEventBase] = (EventSwapPtr) SShapeNotifyEvent; + } +} diff --git a/Xext/shm.c b/Xext/shm.c index 3230d83c6..23afe6b1f 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -120,20 +120,6 @@ static void SShmCompletionEvent( static Bool ShmDestroyPixmap (PixmapPtr pPixmap); -static DISPATCH_PROC(ProcShmAttach); -static DISPATCH_PROC(ProcShmCreatePixmap); -static DISPATCH_PROC(ProcShmDetach); -static DISPATCH_PROC(ProcShmDispatch); -static DISPATCH_PROC(ProcShmGetImage); -static DISPATCH_PROC(ProcShmPutImage); -static DISPATCH_PROC(ProcShmQueryVersion); -static DISPATCH_PROC(SProcShmAttach); -static DISPATCH_PROC(SProcShmCreatePixmap); -static DISPATCH_PROC(SProcShmDetach); -static DISPATCH_PROC(SProcShmDispatch); -static DISPATCH_PROC(SProcShmGetImage); -static DISPATCH_PROC(SProcShmPutImage); -static DISPATCH_PROC(SProcShmQueryVersion); static unsigned char ShmReqCode; int ShmCompletionCode; @@ -254,56 +240,6 @@ ShmRegisterPrivates(void) return TRUE; } -void -ShmExtensionInit(INITARGS) -{ - ExtensionEntry *extEntry; - int i; - -#ifdef MUST_CHECK_FOR_SHM_SYSCALL - if (!CheckForShmSyscall()) - { - ErrorF("MIT-SHM extension disabled due to lack of kernel support\n"); - return; - } -#endif - - if (!ShmRegisterPrivates()) - return; - - sharedPixmaps = xFalse; - { - sharedPixmaps = xTrue; - for (i = 0; i < screenInfo.numScreens; i++) - { - ShmScrPrivateRec *screen_priv = ShmInitScreenPriv(screenInfo.screens[i]); - if (!screen_priv->shmFuncs) - screen_priv->shmFuncs = &miFuncs; - if (!screen_priv->shmFuncs->CreatePixmap) - sharedPixmaps = xFalse; - } - if (sharedPixmaps) - for (i = 0; i < screenInfo.numScreens; i++) - { - ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(screenInfo.screens[i]); - screen_priv->destroyPixmap = screenInfo.screens[i]->DestroyPixmap; - screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap; - } - } - ShmSegType = CreateNewResourceType(ShmDetachSegment, "ShmSeg"); - if (ShmSegType && - (extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors, - ProcShmDispatch, SProcShmDispatch, - ShmResetProc, StandardMinorOpcode))) - { - ShmReqCode = (unsigned char)extEntry->base; - ShmCompletionCode = extEntry->eventBase; - BadShmSegCode = extEntry->errorBase; - SetResourceTypeErrorValue(ShmSegType, BadShmSegCode); - EventSwapVector[ShmCompletionCode] = (EventSwapPtr) SShmCompletionEvent; - } -} - /*ARGSUSED*/ static void ShmResetProc(ExtensionEntry *extEntry) @@ -581,6 +517,226 @@ doShmPutImage(DrawablePtr dst, GCPtr pGC, } } +static int +ProcShmPutImage(ClientPtr client) +{ + GCPtr pGC; + DrawablePtr pDraw; + long length; + ShmDescPtr shmdesc; + REQUEST(xShmPutImageReq); + + REQUEST_SIZE_MATCH(xShmPutImageReq); + VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); + VERIFY_SHMPTR(stuff->shmseg, stuff->offset, FALSE, shmdesc, client); + if ((stuff->sendEvent != xTrue) && (stuff->sendEvent != xFalse)) + return BadValue; + if (stuff->format == XYBitmap) + { + if (stuff->depth != 1) + return BadMatch; + length = PixmapBytePad(stuff->totalWidth, 1); + } + else if (stuff->format == XYPixmap) + { + if (pDraw->depth != stuff->depth) + return BadMatch; + length = PixmapBytePad(stuff->totalWidth, 1); + length *= stuff->depth; + } + else if (stuff->format == ZPixmap) + { + if (pDraw->depth != stuff->depth) + return BadMatch; + length = PixmapBytePad(stuff->totalWidth, stuff->depth); + } + else + { + client->errorValue = stuff->format; + return BadValue; + } + + /* + * There's a potential integer overflow in this check: + * VERIFY_SHMSIZE(shmdesc, stuff->offset, length * stuff->totalHeight, + * client); + * the version below ought to avoid it + */ + if (stuff->totalHeight != 0 && + length > (shmdesc->size - stuff->offset)/stuff->totalHeight) { + client->errorValue = stuff->totalWidth; + return BadValue; + } + if (stuff->srcX > stuff->totalWidth) + { + client->errorValue = stuff->srcX; + return BadValue; + } + if (stuff->srcY > stuff->totalHeight) + { + client->errorValue = stuff->srcY; + return BadValue; + } + if ((stuff->srcX + stuff->srcWidth) > stuff->totalWidth) + { + client->errorValue = stuff->srcWidth; + return BadValue; + } + if ((stuff->srcY + stuff->srcHeight) > stuff->totalHeight) + { + client->errorValue = stuff->srcHeight; + return BadValue; + } + + if ((((stuff->format == ZPixmap) && (stuff->srcX == 0)) || + ((stuff->format != ZPixmap) && + (stuff->srcX < screenInfo.bitmapScanlinePad) && + ((stuff->format == XYBitmap) || + ((stuff->srcY == 0) && + (stuff->srcHeight == stuff->totalHeight))))) && + ((stuff->srcX + stuff->srcWidth) == stuff->totalWidth)) + (*pGC->ops->PutImage) (pDraw, pGC, stuff->depth, + stuff->dstX, stuff->dstY, + stuff->totalWidth, stuff->srcHeight, + stuff->srcX, stuff->format, + shmdesc->addr + stuff->offset + + (stuff->srcY * length)); + else + doShmPutImage(pDraw, pGC, stuff->depth, stuff->format, + stuff->totalWidth, stuff->totalHeight, + stuff->srcX, stuff->srcY, + stuff->srcWidth, stuff->srcHeight, + stuff->dstX, stuff->dstY, + shmdesc->addr + stuff->offset); + + if (stuff->sendEvent) + { + xShmCompletionEvent ev; + + ev.type = ShmCompletionCode; + ev.drawable = stuff->drawable; + ev.minorEvent = X_ShmPutImage; + ev.majorEvent = ShmReqCode; + ev.shmseg = stuff->shmseg; + ev.offset = stuff->offset; + WriteEventsToClient(client, 1, (xEvent *) &ev); + } + + return Success; +} + +static int +ProcShmGetImage(ClientPtr client) +{ + DrawablePtr pDraw; + long lenPer = 0, length; + Mask plane = 0; + xShmGetImageReply xgi; + ShmDescPtr shmdesc; + int n, rc; + + REQUEST(xShmGetImageReq); + + REQUEST_SIZE_MATCH(xShmGetImageReq); + if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) + { + client->errorValue = stuff->format; + return BadValue; + } + rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, + DixReadAccess); + if (rc != Success) + return rc; + VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); + if (pDraw->type == DRAWABLE_WINDOW) + { + if( /* check for being viewable */ + !((WindowPtr) pDraw)->realized || + /* check for being on screen */ + pDraw->x + stuff->x < 0 || + pDraw->x + stuff->x + (int)stuff->width > pDraw->pScreen->width || + pDraw->y + stuff->y < 0 || + pDraw->y + stuff->y + (int)stuff->height > pDraw->pScreen->height || + /* check for being inside of border */ + stuff->x < - wBorderWidth((WindowPtr)pDraw) || + stuff->x + (int)stuff->width > + wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width || + stuff->y < -wBorderWidth((WindowPtr)pDraw) || + stuff->y + (int)stuff->height > + wBorderWidth((WindowPtr)pDraw) + (int)pDraw->height + ) + return BadMatch; + xgi.visual = wVisual(((WindowPtr)pDraw)); + } + else + { + if (stuff->x < 0 || + stuff->x+(int)stuff->width > pDraw->width || + stuff->y < 0 || + stuff->y+(int)stuff->height > pDraw->height + ) + return BadMatch; + xgi.visual = None; + } + xgi.type = X_Reply; + xgi.length = 0; + xgi.sequenceNumber = client->sequence; + xgi.depth = pDraw->depth; + if(stuff->format == ZPixmap) + { + length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height; + } + else + { + lenPer = PixmapBytePad(stuff->width, 1) * stuff->height; + plane = ((Mask)1) << (pDraw->depth - 1); + /* only planes asked for */ + length = lenPer * Ones(stuff->planeMask & (plane | (plane - 1))); + } + + VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client); + xgi.size = length; + + if (length == 0) + { + /* nothing to do */ + } + else if (stuff->format == ZPixmap) + { + (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y, + stuff->width, stuff->height, + stuff->format, stuff->planeMask, + shmdesc->addr + stuff->offset); + } + else + { + + length = stuff->offset; + for (; plane; plane >>= 1) + { + if (stuff->planeMask & plane) + { + (*pDraw->pScreen->GetImage)(pDraw, + stuff->x, stuff->y, + stuff->width, stuff->height, + stuff->format, plane, + shmdesc->addr + length); + length += lenPer; + } + } + } + + if (client->swapped) { + swaps(&xgi.sequenceNumber, n); + swapl(&xgi.length, n); + swapl(&xgi.visual, n); + swapl(&xgi.size, n); + } + WriteToClient(client, sizeof(xShmGetImageReply), (char *)&xgi); + + return Success; +} + #ifdef PANORAMIX static int ProcPanoramiXShmPutImage(ClientPtr client) @@ -858,231 +1014,8 @@ CreatePmap: return result; } - #endif -static int -ProcShmPutImage(ClientPtr client) -{ - GCPtr pGC; - DrawablePtr pDraw; - long length; - ShmDescPtr shmdesc; - REQUEST(xShmPutImageReq); - - REQUEST_SIZE_MATCH(xShmPutImageReq); - VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); - VERIFY_SHMPTR(stuff->shmseg, stuff->offset, FALSE, shmdesc, client); - if ((stuff->sendEvent != xTrue) && (stuff->sendEvent != xFalse)) - return BadValue; - if (stuff->format == XYBitmap) - { - if (stuff->depth != 1) - return BadMatch; - length = PixmapBytePad(stuff->totalWidth, 1); - } - else if (stuff->format == XYPixmap) - { - if (pDraw->depth != stuff->depth) - return BadMatch; - length = PixmapBytePad(stuff->totalWidth, 1); - length *= stuff->depth; - } - else if (stuff->format == ZPixmap) - { - if (pDraw->depth != stuff->depth) - return BadMatch; - length = PixmapBytePad(stuff->totalWidth, stuff->depth); - } - else - { - client->errorValue = stuff->format; - return BadValue; - } - - /* - * There's a potential integer overflow in this check: - * VERIFY_SHMSIZE(shmdesc, stuff->offset, length * stuff->totalHeight, - * client); - * the version below ought to avoid it - */ - if (stuff->totalHeight != 0 && - length > (shmdesc->size - stuff->offset)/stuff->totalHeight) { - client->errorValue = stuff->totalWidth; - return BadValue; - } - if (stuff->srcX > stuff->totalWidth) - { - client->errorValue = stuff->srcX; - return BadValue; - } - if (stuff->srcY > stuff->totalHeight) - { - client->errorValue = stuff->srcY; - return BadValue; - } - if ((stuff->srcX + stuff->srcWidth) > stuff->totalWidth) - { - client->errorValue = stuff->srcWidth; - return BadValue; - } - if ((stuff->srcY + stuff->srcHeight) > stuff->totalHeight) - { - client->errorValue = stuff->srcHeight; - return BadValue; - } - - if ((((stuff->format == ZPixmap) && (stuff->srcX == 0)) || - ((stuff->format != ZPixmap) && - (stuff->srcX < screenInfo.bitmapScanlinePad) && - ((stuff->format == XYBitmap) || - ((stuff->srcY == 0) && - (stuff->srcHeight == stuff->totalHeight))))) && - ((stuff->srcX + stuff->srcWidth) == stuff->totalWidth)) - (*pGC->ops->PutImage) (pDraw, pGC, stuff->depth, - stuff->dstX, stuff->dstY, - stuff->totalWidth, stuff->srcHeight, - stuff->srcX, stuff->format, - shmdesc->addr + stuff->offset + - (stuff->srcY * length)); - else - doShmPutImage(pDraw, pGC, stuff->depth, stuff->format, - stuff->totalWidth, stuff->totalHeight, - stuff->srcX, stuff->srcY, - stuff->srcWidth, stuff->srcHeight, - stuff->dstX, stuff->dstY, - shmdesc->addr + stuff->offset); - - if (stuff->sendEvent) - { - xShmCompletionEvent ev; - - ev.type = ShmCompletionCode; - ev.drawable = stuff->drawable; - ev.minorEvent = X_ShmPutImage; - ev.majorEvent = ShmReqCode; - ev.shmseg = stuff->shmseg; - ev.offset = stuff->offset; - WriteEventsToClient(client, 1, (xEvent *) &ev); - } - - return Success; -} - - - -static int -ProcShmGetImage(ClientPtr client) -{ - DrawablePtr pDraw; - long lenPer = 0, length; - Mask plane = 0; - xShmGetImageReply xgi; - ShmDescPtr shmdesc; - int n, rc; - - REQUEST(xShmGetImageReq); - - REQUEST_SIZE_MATCH(xShmGetImageReq); - if ((stuff->format != XYPixmap) && (stuff->format != ZPixmap)) - { - client->errorValue = stuff->format; - return BadValue; - } - rc = dixLookupDrawable(&pDraw, stuff->drawable, client, 0, - DixReadAccess); - if (rc != Success) - return rc; - VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); - if (pDraw->type == DRAWABLE_WINDOW) - { - if( /* check for being viewable */ - !((WindowPtr) pDraw)->realized || - /* check for being on screen */ - pDraw->x + stuff->x < 0 || - pDraw->x + stuff->x + (int)stuff->width > pDraw->pScreen->width || - pDraw->y + stuff->y < 0 || - pDraw->y + stuff->y + (int)stuff->height > pDraw->pScreen->height || - /* check for being inside of border */ - stuff->x < - wBorderWidth((WindowPtr)pDraw) || - stuff->x + (int)stuff->width > - wBorderWidth((WindowPtr)pDraw) + (int)pDraw->width || - stuff->y < -wBorderWidth((WindowPtr)pDraw) || - stuff->y + (int)stuff->height > - wBorderWidth((WindowPtr)pDraw) + (int)pDraw->height - ) - return BadMatch; - xgi.visual = wVisual(((WindowPtr)pDraw)); - } - else - { - if (stuff->x < 0 || - stuff->x+(int)stuff->width > pDraw->width || - stuff->y < 0 || - stuff->y+(int)stuff->height > pDraw->height - ) - return BadMatch; - xgi.visual = None; - } - xgi.type = X_Reply; - xgi.length = 0; - xgi.sequenceNumber = client->sequence; - xgi.depth = pDraw->depth; - if(stuff->format == ZPixmap) - { - length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height; - } - else - { - lenPer = PixmapBytePad(stuff->width, 1) * stuff->height; - plane = ((Mask)1) << (pDraw->depth - 1); - /* only planes asked for */ - length = lenPer * Ones(stuff->planeMask & (plane | (plane - 1))); - } - - VERIFY_SHMSIZE(shmdesc, stuff->offset, length, client); - xgi.size = length; - - if (length == 0) - { - /* nothing to do */ - } - else if (stuff->format == ZPixmap) - { - (*pDraw->pScreen->GetImage)(pDraw, stuff->x, stuff->y, - stuff->width, stuff->height, - stuff->format, stuff->planeMask, - shmdesc->addr + stuff->offset); - } - else - { - - length = stuff->offset; - for (; plane; plane >>= 1) - { - if (stuff->planeMask & plane) - { - (*pDraw->pScreen->GetImage)(pDraw, - stuff->x, stuff->y, - stuff->width, stuff->height, - stuff->format, plane, - shmdesc->addr + length); - length += lenPer; - } - } - } - - if (client->swapped) { - swaps(&xgi.sequenceNumber, n); - swapl(&xgi.length, n); - swapl(&xgi.visual, n); - swapl(&xgi.size, n); - } - WriteToClient(client, sizeof(xShmGetImageReply), (char *)&xgi); - - return Success; -} - static PixmapPtr fbShmCreatePixmap (ScreenPtr pScreen, int width, int height, int depth, char *addr) @@ -1342,3 +1275,53 @@ SProcShmDispatch (ClientPtr client) return BadRequest; } } + +void +ShmExtensionInit(INITARGS) +{ + ExtensionEntry *extEntry; + int i; + +#ifdef MUST_CHECK_FOR_SHM_SYSCALL + if (!CheckForShmSyscall()) + { + ErrorF("MIT-SHM extension disabled due to lack of kernel support\n"); + return; + } +#endif + + if (!ShmRegisterPrivates()) + return; + + sharedPixmaps = xFalse; + { + sharedPixmaps = xTrue; + for (i = 0; i < screenInfo.numScreens; i++) + { + ShmScrPrivateRec *screen_priv = ShmInitScreenPriv(screenInfo.screens[i]); + if (!screen_priv->shmFuncs) + screen_priv->shmFuncs = &miFuncs; + if (!screen_priv->shmFuncs->CreatePixmap) + sharedPixmaps = xFalse; + } + if (sharedPixmaps) + for (i = 0; i < screenInfo.numScreens; i++) + { + ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(screenInfo.screens[i]); + screen_priv->destroyPixmap = screenInfo.screens[i]->DestroyPixmap; + screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap; + } + } + ShmSegType = CreateNewResourceType(ShmDetachSegment, "ShmSeg"); + if (ShmSegType && + (extEntry = AddExtension(SHMNAME, ShmNumberEvents, ShmNumberErrors, + ProcShmDispatch, SProcShmDispatch, + ShmResetProc, StandardMinorOpcode))) + { + ShmReqCode = (unsigned char)extEntry->base; + ShmCompletionCode = extEntry->eventBase; + BadShmSegCode = extEntry->errorBase; + SetResourceTypeErrorValue(ShmSegType, BadShmSegCode); + EventSwapVector[ShmCompletionCode] = (EventSwapPtr) SShmCompletionEvent; + } +} diff --git a/Xext/sync.c b/Xext/sync.c index a51262a99..f23df6cb9 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -100,36 +100,6 @@ static void SyncInitServerTime(void); static void SyncInitIdleTime(void); -static DISPATCH_PROC(ProcSyncAwait); -static DISPATCH_PROC(ProcSyncChangeAlarm); -static DISPATCH_PROC(ProcSyncChangeCounter); -static DISPATCH_PROC(ProcSyncCreateAlarm); -static DISPATCH_PROC(ProcSyncCreateCounter); -static DISPATCH_PROC(ProcSyncDestroyAlarm); -static DISPATCH_PROC(ProcSyncDestroyCounter); -static DISPATCH_PROC(ProcSyncDispatch); -static DISPATCH_PROC(ProcSyncGetPriority); -static DISPATCH_PROC(ProcSyncInitialize); -static DISPATCH_PROC(ProcSyncListSystemCounters); -static DISPATCH_PROC(ProcSyncQueryAlarm); -static DISPATCH_PROC(ProcSyncQueryCounter); -static DISPATCH_PROC(ProcSyncSetCounter); -static DISPATCH_PROC(ProcSyncSetPriority); -static DISPATCH_PROC(SProcSyncAwait); -static DISPATCH_PROC(SProcSyncChangeAlarm); -static DISPATCH_PROC(SProcSyncChangeCounter); -static DISPATCH_PROC(SProcSyncCreateAlarm); -static DISPATCH_PROC(SProcSyncCreateCounter); -static DISPATCH_PROC(SProcSyncDestroyAlarm); -static DISPATCH_PROC(SProcSyncDestroyCounter); -static DISPATCH_PROC(SProcSyncDispatch); -static DISPATCH_PROC(SProcSyncGetPriority); -static DISPATCH_PROC(SProcSyncInitialize); -static DISPATCH_PROC(SProcSyncListSystemCounters); -static DISPATCH_PROC(SProcSyncQueryAlarm); -static DISPATCH_PROC(SProcSyncQueryCounter); -static DISPATCH_PROC(SProcSyncSetCounter); -static DISPATCH_PROC(SProcSyncSetPriority); /* Each counter maintains a simple linked list of triggers that are * interested in the counter. The two functions below are used to diff --git a/Xext/xcmisc.c b/Xext/xcmisc.c index 986c870a5..378afccca 100644 --- a/Xext/xcmisc.c +++ b/Xext/xcmisc.c @@ -46,24 +46,6 @@ from The Open Group. #define UINT32_MAX 0xffffffffU #endif -static DISPATCH_PROC(ProcXCMiscDispatch); -static DISPATCH_PROC(ProcXCMiscGetVersion); -static DISPATCH_PROC(ProcXCMiscGetXIDList); -static DISPATCH_PROC(ProcXCMiscGetXIDRange); -static DISPATCH_PROC(SProcXCMiscDispatch); -static DISPATCH_PROC(SProcXCMiscGetVersion); -static DISPATCH_PROC(SProcXCMiscGetXIDList); -static DISPATCH_PROC(SProcXCMiscGetXIDRange); - -void XCMiscExtensionInit(INITARGS); - -void -XCMiscExtensionInit(INITARGS) -{ - AddExtension(XCMiscExtensionName, 0, 0, - ProcXCMiscDispatch, SProcXCMiscDispatch, - NULL, StandardMinorOpcode); -} static int ProcXCMiscGetVersion(ClientPtr client) @@ -215,3 +197,11 @@ SProcXCMiscDispatch (ClientPtr client) return BadRequest; } } + +void +XCMiscExtensionInit(INITARGS) +{ + AddExtension(XCMiscExtensionName, 0, 0, + ProcXCMiscDispatch, SProcXCMiscDispatch, + NULL, StandardMinorOpcode); +} diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c index 8f0ddd93d..f7dde6e17 100644 --- a/Xext/xf86bigfont.c +++ b/Xext/xf86bigfont.c @@ -80,12 +80,6 @@ static void XF86BigfontResetProc( ExtensionEntry * /* extEntry */ ); -static DISPATCH_PROC(ProcXF86BigfontDispatch); -static DISPATCH_PROC(ProcXF86BigfontQueryVersion); -static DISPATCH_PROC(ProcXF86BigfontQueryFont); -static DISPATCH_PROC(SProcXF86BigfontDispatch); -static DISPATCH_PROC(SProcXF86BigfontQueryVersion); -static DISPATCH_PROC(SProcXF86BigfontQueryFont); #ifdef HAS_SHM diff --git a/Xext/xtest.c b/Xext/xtest.c index 7268768b0..d7d254c18 100644 --- a/Xext/xtest.c +++ b/Xext/xtest.c @@ -84,26 +84,6 @@ static int XTestSwapFakeInput( xReq * /* req */ ); -static DISPATCH_PROC(ProcXTestCompareCursor); -static DISPATCH_PROC(ProcXTestDispatch); -static DISPATCH_PROC(ProcXTestFakeInput); -static DISPATCH_PROC(ProcXTestGetVersion); -static DISPATCH_PROC(ProcXTestGrabControl); -static DISPATCH_PROC(SProcXTestCompareCursor); -static DISPATCH_PROC(SProcXTestDispatch); -static DISPATCH_PROC(SProcXTestFakeInput); -static DISPATCH_PROC(SProcXTestGetVersion); -static DISPATCH_PROC(SProcXTestGrabControl); - -void -XTestExtensionInit(INITARGS) -{ - AddExtension(XTestExtensionName, 0, 0, - ProcXTestDispatch, SProcXTestDispatch, - NULL, StandardMinorOpcode); - - xtest_evlist = InitEventList(GetMaximumEventsNum()); -} static int ProcXTestGetVersion(ClientPtr client) @@ -699,3 +679,12 @@ GetXTestDevice(DeviceIntPtr master) return NULL; } +void +XTestExtensionInit(INITARGS) +{ + AddExtension(XTestExtensionName, 0, 0, + ProcXTestDispatch, SProcXTestDispatch, + NULL, StandardMinorOpcode); + + xtest_evlist = InitEventList(GetMaximumEventsNum()); +} |