diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2013-06-07 17:28:57 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2013-06-07 17:28:57 +0000 |
commit | c0190187060808fe0ad2a09b31f4244757572ff9 (patch) | |
tree | b028697436476ae3ff34218b0b233a233d8a7818 /xserver/Xext/shm.c | |
parent | 33eda071f5846d332b428de759c5b1649e9cf1ba (diff) |
Update to X server 1.14.1. Tested by many during t2k13. Thanks.
Diffstat (limited to 'xserver/Xext/shm.c')
-rw-r--r-- | xserver/Xext/shm.c | 93 |
1 files changed, 50 insertions, 43 deletions
diff --git a/xserver/Xext/shm.c b/xserver/Xext/shm.c index de480207d..55960907b 100644 --- a/xserver/Xext/shm.c +++ b/xserver/Xext/shm.c @@ -87,7 +87,7 @@ in this Software without prior written authorization from The Open Group. #include "panoramiXsrv.h" #endif -#include "modinit.h" +#include "extinit.h" typedef struct _ShmDesc { struct _ShmDesc *next; @@ -135,11 +135,11 @@ static ShmFuncs fbFuncs = { fbShmCreatePixmap, NULL }; #define VERIFY_SHMSEG(shmseg,shmdesc,client) \ { \ - int rc; \ - rc = dixLookupResourceByType((pointer *)&(shmdesc), shmseg, ShmSegType, \ - client, DixReadAccess); \ - if (rc != Success) \ - return rc; \ + int tmprc; \ + tmprc = dixLookupResourceByType((pointer *)&(shmdesc), shmseg, ShmSegType, \ + client, DixReadAccess); \ + if (tmprc != Success) \ + return tmprc; \ } #define VERIFY_SHMPTR(shmseg,offset,needwrite,shmdesc,client) \ @@ -202,14 +202,14 @@ CheckForShmSyscall(void) #endif static Bool -ShmCloseScreen(int i, ScreenPtr pScreen) +ShmCloseScreen(ScreenPtr pScreen) { ShmScrPrivateRec *screen_priv = ShmGetScreenPriv(pScreen); pScreen->CloseScreen = screen_priv->CloseScreen; dixSetPrivate(&pScreen->devPrivates, shmScrPrivateKey, NULL); free(screen_priv); - return (*pScreen->CloseScreen) (i, pScreen); + return (*pScreen->CloseScreen) (pScreen); } static ShmScrPrivateRec * @@ -285,19 +285,20 @@ ShmRegisterFbFuncs(ScreenPtr pScreen) static int ProcShmQueryVersion(ClientPtr client) { - xShmQueryVersionReply rep; + xShmQueryVersionReply rep = { + .type = X_Reply, + .sharedPixmaps = sharedPixmaps, + .sequenceNumber = client->sequence, + .length = 0, + .majorVersion = SERVER_SHM_MAJOR_VERSION, + .minorVersion = SERVER_SHM_MINOR_VERSION, + .uid = geteuid(), + .gid = getegid(), + .pixmapFormat = sharedPixmaps ? ZPixmap : 0 + }; REQUEST_SIZE_MATCH(xShmQueryVersionReq); - memset(&rep, 0, sizeof(xShmQueryVersionReply)); - rep.type = X_Reply; - rep.length = 0; - rep.sequenceNumber = client->sequence; - rep.sharedPixmaps = sharedPixmaps; - rep.pixmapFormat = sharedPixmaps ? ZPixmap : 0; - rep.majorVersion = SERVER_SHM_MAJOR_VERSION; - rep.minorVersion = SERVER_SHM_MINOR_VERSION; - rep.uid = geteuid(); - rep.gid = getegid(); + if (client->swapped) { swaps(&rep.sequenceNumber); swapl(&rep.length); @@ -306,7 +307,7 @@ ProcShmQueryVersion(ClientPtr client) swaps(&rep.uid); swaps(&rep.gid); } - WriteToClient(client, sizeof(xShmQueryVersionReply), (char *) &rep); + WriteToClient(client, sizeof(xShmQueryVersionReply), &rep); return Success; } @@ -594,14 +595,14 @@ ProcShmPutImage(ClientPtr client) 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; + xShmCompletionEvent ev = { + .type = ShmCompletionCode, + .drawable = stuff->drawable, + .minorEvent = X_ShmPutImage, + .majorEvent = ShmReqCode, + .shmseg = stuff->shmseg, + .offset = stuff->offset + }; WriteEventsToClient(client, 1, (xEvent *) &ev); } @@ -616,6 +617,7 @@ ProcShmGetImage(ClientPtr client) Mask plane = 0; xShmGetImageReply xgi; ShmDescPtr shmdesc; + VisualID visual = None; int rc; REQUEST(xShmGetImageReq); @@ -630,7 +632,7 @@ ProcShmGetImage(ClientPtr client) return rc; VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); if (pDraw->type == DRAWABLE_WINDOW) { - if ( /* check for being viewable */ + if ( /* check for being viewable */ !((WindowPtr) pDraw)->realized || /* check for being on screen */ pDraw->x + stuff->x < 0 || @@ -646,19 +648,22 @@ ProcShmGetImage(ClientPtr client) stuff->y + (int) stuff->height > wBorderWidth((WindowPtr) pDraw) + (int) pDraw->height) return BadMatch; - xgi.visual = wVisual(((WindowPtr) pDraw)); + 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; + visual = None; } - xgi.type = X_Reply; - xgi.length = 0; - xgi.sequenceNumber = client->sequence; - xgi.depth = pDraw->depth; + xgi = (xShmGetImageReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .visual = visual, + .depth = pDraw->depth + }; if (stuff->format == ZPixmap) { length = PixmapBytePad(stuff->width, pDraw->depth) * stuff->height; } @@ -702,7 +707,7 @@ ProcShmGetImage(ClientPtr client) swapl(&xgi.visual); swapl(&xgi.size); } - WriteToClient(client, sizeof(xShmGetImageReply), (char *) &xgi); + WriteToClient(client, sizeof(xShmGetImageReply), &xgi); return Success; } @@ -830,11 +835,13 @@ ProcPanoramiXShmGetImage(ClientPtr client) } } - xgi.visual = wVisual(((WindowPtr) pDraw)); - xgi.type = X_Reply; - xgi.length = 0; - xgi.sequenceNumber = client->sequence; - xgi.depth = pDraw->depth; + xgi = (xShmGetImageReply) { + .type = X_Reply, + .sequenceNumber = client->sequence, + .length = 0, + .visual = wVisual(((WindowPtr) pDraw)), + .depth = pDraw->depth + }; if (format == ZPixmap) { widthBytesLine = PixmapBytePad(w, pDraw->depth); @@ -877,7 +884,7 @@ ProcPanoramiXShmGetImage(ClientPtr client) swapl(&xgi.visual); swapl(&xgi.size); } - WriteToClient(client, sizeof(xShmGetImageReply), (char *) &xgi); + WriteToClient(client, sizeof(xShmGetImageReply), &xgi); return Success; } @@ -1241,7 +1248,7 @@ SProcShmDispatch(ClientPtr client) } void -ShmExtensionInit(INITARGS) +ShmExtensionInit(void) { ExtensionEntry *extEntry; int i; |