diff options
author | Keith Packard <keithp@keithp.com> | 2010-05-19 12:58:02 -0700 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-05-19 12:58:02 -0700 |
commit | 8b6c1809c09f832051327d86e1a25dc0ec5cc878 (patch) | |
tree | fe082e8244a169e4f94bdd62d1930adc204b03e6 | |
parent | d88ba7721d2d3b58cdc664fd4c23a3c5e2a5f909 (diff) | |
parent | c38552d115e3bc71ad6179a8ad0d68778e943793 (diff) |
Merge remote branch 'jamey/for-keith'
59 files changed, 397 insertions, 544 deletions
diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c index 31286d41f..edcbb49d5 100644 --- a/Xext/panoramiX.c +++ b/Xext/panoramiX.c @@ -519,6 +519,10 @@ void PanoramiXExtensionInit(int argc, char *argv[]) panoramiXGeneration = serverGeneration; success = TRUE; } + SetResourceTypeErrorValue(XRT_WINDOW, BadWindow); + SetResourceTypeErrorValue(XRT_PIXMAP, BadPixmap); + SetResourceTypeErrorValue(XRT_GC, BadGC); + SetResourceTypeErrorValue(XRT_COLORMAP, BadColor); } if (!success) { diff --git a/Xext/panoramiXprocs.c b/Xext/panoramiXprocs.c index a1816958f..8752ca519 100644 --- a/Xext/panoramiXprocs.c +++ b/Xext/panoramiXprocs.c @@ -74,7 +74,7 @@ int PanoramiXCreateWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&parent, stuff->parent, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; if(stuff->class == CopyFromParent) stuff->class = parent->u.win.class; @@ -89,7 +89,7 @@ int PanoramiXCreateWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&backPix, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } } if ((Mask)stuff->mask & CWBorderPixmap) { @@ -99,7 +99,7 @@ int PanoramiXCreateWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&bordPix, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } } if ((Mask)stuff->mask & CWColormap) { @@ -109,7 +109,7 @@ int PanoramiXCreateWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, tmp, XRT_COLORMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; } } @@ -179,7 +179,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->window, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; if((win->u.win.class == InputOnly) && (stuff->valueMask & (~INPUTONLY_LEGAL_MASK))) @@ -192,7 +192,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client) result = dixLookupResourceByType((pointer *)&backPix, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } } if ((Mask)stuff->valueMask & CWBorderPixmap) { @@ -202,7 +202,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client) result = dixLookupResourceByType((pointer *)&bordPix, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } } if ((Mask)stuff->valueMask & CWColormap) { @@ -212,7 +212,7 @@ int PanoramiXChangeWindowAttributes(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, tmp, XRT_COLORMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; } } @@ -242,7 +242,7 @@ int PanoramiXDestroyWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->id, XRT_WINDOW, client, DixDestroyAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS_BACKWARD(j) { stuff->id = win->info[j].id; @@ -268,7 +268,7 @@ int PanoramiXDestroySubwindows(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->id, XRT_WINDOW, client, DixDestroyAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS_BACKWARD(j) { stuff->id = win->info[j].id; @@ -294,7 +294,7 @@ int PanoramiXChangeSaveSet(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->window, XRT_WINDOW, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS_BACKWARD(j) { stuff->window = win->info[j].id; @@ -319,12 +319,12 @@ int PanoramiXReparentWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->window, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; result = dixLookupResourceByType((pointer *)&parent, stuff->parent, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; x = stuff->x; y = stuff->y; @@ -356,7 +356,7 @@ int PanoramiXMapWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->id, XRT_WINDOW, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS_FORWARD(j) { stuff->id = win->info[j].id; @@ -379,7 +379,7 @@ int PanoramiXMapSubwindows(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->id, XRT_WINDOW, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS_FORWARD(j) { stuff->id = win->info[j].id; @@ -402,7 +402,7 @@ int PanoramiXUnmapWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->id, XRT_WINDOW, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS_FORWARD(j) { stuff->id = win->info[j].id; @@ -425,7 +425,7 @@ int PanoramiXUnmapSubwindows(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->id, XRT_WINDOW, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS_FORWARD(j) { stuff->id = win->info[j].id; @@ -457,12 +457,12 @@ int PanoramiXConfigureWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&pWin, stuff->window, RT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; result = dixLookupResourceByType((pointer *)&win, stuff->window, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; if ((Mask)stuff->mask & CWSibling) { XID tmp; @@ -471,7 +471,7 @@ int PanoramiXConfigureWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&sib, tmp, XRT_WINDOW, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; } } @@ -517,7 +517,7 @@ int PanoramiXCirculateWindow(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->window, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS_FORWARD(j) { stuff->window = win->info[j].id; @@ -697,7 +697,7 @@ int PanoramiXFreePixmap(ClientPtr client) result = dixLookupResourceByType((pointer *)&pix, stuff->id, XRT_PIXMAP, client, DixDestroyAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; FOR_NSCREENS_BACKWARD(j) { stuff->id = pix->info[j].id; @@ -742,7 +742,7 @@ int PanoramiXCreateGC(ClientPtr client) result = dixLookupResourceByType((pointer *)&tile, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } } if ((Mask)stuff->mask & GCStipple) { @@ -751,7 +751,7 @@ int PanoramiXCreateGC(ClientPtr client) result = dixLookupResourceByType((pointer *)&stip, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } } if ((Mask)stuff->mask & GCClipMask) { @@ -760,7 +760,7 @@ int PanoramiXCreateGC(ClientPtr client) result = dixLookupResourceByType((pointer *)&clip, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } } @@ -813,7 +813,7 @@ int PanoramiXChangeGC(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; if ((Mask)stuff->mask & GCTile) { tile_offset = Ones((Mask)stuff->mask & (GCTile - 1)); @@ -821,7 +821,7 @@ int PanoramiXChangeGC(ClientPtr client) result = dixLookupResourceByType((pointer *)&tile, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } } if ((Mask)stuff->mask & GCStipple) { @@ -830,7 +830,7 @@ int PanoramiXChangeGC(ClientPtr client) result = dixLookupResourceByType((pointer *)&stip, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } } if ((Mask)stuff->mask & GCClipMask) { @@ -839,7 +839,7 @@ int PanoramiXChangeGC(ClientPtr client) result = dixLookupResourceByType((pointer *)&clip, tmp, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } } @@ -871,12 +871,12 @@ int PanoramiXCopyGC(ClientPtr client) result = dixLookupResourceByType((pointer *)&srcGC, stuff->srcGC, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; result = dixLookupResourceByType((pointer *)&dstGC, stuff->dstGC, XRT_GC, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; FOR_NSCREENS(j) { stuff->srcGC = srcGC->info[j].id; @@ -900,7 +900,7 @@ int PanoramiXSetDashes(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; FOR_NSCREENS_BACKWARD(j) { stuff->gc = gc->info[j].id; @@ -923,7 +923,7 @@ int PanoramiXSetClipRectangles(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; FOR_NSCREENS_BACKWARD(j) { stuff->gc = gc->info[j].id; @@ -946,7 +946,7 @@ int PanoramiXFreeGC(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->id, XRT_GC, client, DixDestroyAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; FOR_NSCREENS_BACKWARD(j) { stuff->id = gc->info[j].id; @@ -973,7 +973,7 @@ int PanoramiXClearToBackground(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->window, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; x = stuff->x; y = stuff->y; @@ -1033,7 +1033,7 @@ int PanoramiXCopyArea(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; if((dst->type == XRT_WINDOW) && dst->u.win.root) dstIsRoot = TRUE; @@ -1188,7 +1188,7 @@ int PanoramiXCopyPlane(ClientPtr client) rc = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (rc != Success) - return (rc == BadValue) ? BadGC : rc; + return rc; if((dst->type == XRT_WINDOW) && dst->u.win.root) dstIsRoot = TRUE; @@ -1285,7 +1285,7 @@ int PanoramiXPolyPoint(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyPointReq)); @@ -1345,7 +1345,7 @@ int PanoramiXPolyLine(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; npoint = bytes_to_int32((client->req_len << 2) - sizeof(xPolyLineReq)); @@ -1405,7 +1405,7 @@ int PanoramiXPolySegment(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1468,7 +1468,7 @@ int PanoramiXPolyRectangle(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1530,7 +1530,7 @@ int PanoramiXPolyArc(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1590,7 +1590,7 @@ int PanoramiXFillPoly(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1651,7 +1651,7 @@ int PanoramiXPolyFillRectangle(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1712,7 +1712,7 @@ int PanoramiXPolyFillArc(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1772,7 +1772,7 @@ int PanoramiXPutImage(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1973,7 +1973,7 @@ PanoramiXPolyText8(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -2014,7 +2014,7 @@ PanoramiXPolyText16(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -2055,7 +2055,7 @@ int PanoramiXImageText8(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -2096,7 +2096,7 @@ int PanoramiXImageText16(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -2128,7 +2128,7 @@ int PanoramiXCreateColormap(ClientPtr client) result = dixLookupResourceByType((pointer *)&win, stuff->window, XRT_WINDOW, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; if(!(newCmap = malloc(sizeof(PanoramiXRes)))) return BadAlloc; @@ -2169,7 +2169,7 @@ int PanoramiXFreeColormap(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, stuff->id, XRT_COLORMAP, client, DixDestroyAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; FOR_NSCREENS_BACKWARD(j) { stuff->id = cmap->info[j].id; @@ -2199,7 +2199,7 @@ PanoramiXCopyColormapAndFree(ClientPtr client) XRT_COLORMAP, client, DixReadAccess | DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; if(!(newCmap = malloc(sizeof(PanoramiXRes)))) return BadAlloc; @@ -2238,7 +2238,7 @@ int PanoramiXInstallColormap(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, stuff->id, XRT_COLORMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; FOR_NSCREENS_BACKWARD(j){ stuff->id = cmap->info[j].id; @@ -2262,7 +2262,7 @@ int PanoramiXUninstallColormap(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, stuff->id, XRT_COLORMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; FOR_NSCREENS_BACKWARD(j) { stuff->id = cmap->info[j].id; @@ -2286,7 +2286,7 @@ int PanoramiXAllocColor(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; FOR_NSCREENS_BACKWARD(j){ stuff->cmap = cmap->info[j].id; @@ -2310,7 +2310,7 @@ int PanoramiXAllocNamedColor(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; FOR_NSCREENS_BACKWARD(j){ stuff->cmap = cmap->info[j].id; @@ -2334,7 +2334,7 @@ int PanoramiXAllocColorCells(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; FOR_NSCREENS_BACKWARD(j){ stuff->cmap = cmap->info[j].id; @@ -2358,7 +2358,7 @@ int PanoramiXAllocColorPlanes(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; FOR_NSCREENS_BACKWARD(j){ stuff->cmap = cmap->info[j].id; @@ -2383,7 +2383,7 @@ int PanoramiXFreeColors(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; FOR_NSCREENS_BACKWARD(j) { stuff->cmap = cmap->info[j].id; @@ -2406,7 +2406,7 @@ int PanoramiXStoreColors(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; FOR_NSCREENS_BACKWARD(j){ stuff->cmap = cmap->info[j].id; @@ -2430,7 +2430,7 @@ int PanoramiXStoreNamedColor(ClientPtr client) result = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, XRT_COLORMAP, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadColor : result; + return result; FOR_NSCREENS_BACKWARD(j){ stuff->cmap = cmap->info[j].id; diff --git a/Xext/saver.c b/Xext/saver.c index 4b43a305a..fdcbac567 100644 --- a/Xext/saver.c +++ b/Xext/saver.c @@ -480,7 +480,6 @@ SendScreenSaverNotify (ScreenPtr pScreen, int state, Bool forced) ScreenSaverEventPtr pEv; unsigned long mask; xScreenSaverNotifyEvent ev; - ClientPtr client; int kind; UpdateCurrentTimeIf (); @@ -499,20 +498,16 @@ SendScreenSaverNotify (ScreenPtr pScreen, int state, Bool forced) kind = ScreenSaverInternal; for (pEv = pPriv->events; pEv; pEv = pEv->next) { - client = pEv->client; - if (client->clientGone) - continue; if (!(pEv->mask & mask)) continue; ev.type = ScreenSaverNotify + ScreenSaverEventBase; ev.state = state; - ev.sequenceNumber = client->sequence; ev.timestamp = currentTime.milliseconds; ev.root = WindowTable[pScreen->myNum]->drawable.id; ev.window = savedScreenInfo[pScreen->myNum].wid; ev.kind = kind; ev.forced = forced; - WriteEventsToClient (client, 1, (xEvent *) &ev); + WriteEventsToClient (pEv->client, 1, (xEvent *) &ev); } } @@ -1048,7 +1043,6 @@ ScreenSaverSetAttributes (ClientPtr client) } else { - ret = (ret == BadValue) ? BadPixmap : ret; client->errorValue = pixID; goto PatchUp; } @@ -1086,7 +1080,6 @@ ScreenSaverSetAttributes (ClientPtr client) } else { - ret = (ret == BadValue) ? BadPixmap : ret; client->errorValue = pixID; goto PatchUp; } @@ -1168,7 +1161,6 @@ ScreenSaverSetAttributes (ClientPtr client) client, DixUseAccess); if (ret != Success) { - ret = (ret == BadValue) ? BadColor : ret; client->errorValue = cmap; goto PatchUp; } @@ -1192,7 +1184,6 @@ ScreenSaverSetAttributes (ClientPtr client) RT_CURSOR, client, DixUseAccess); if (ret != Success) { - ret = (ret == BadValue) ? BadCursor : ret; client->errorValue = cursorID; goto PatchUp; } @@ -1281,7 +1272,7 @@ ProcScreenSaverSetAttributes (ClientPtr client) XRT_PIXMAP, client, DixReadAccess); if (status != Success) - return (status == BadValue) ? BadPixmap : status; + return status; } } @@ -1293,7 +1284,7 @@ ProcScreenSaverSetAttributes (ClientPtr client) XRT_PIXMAP, client, DixReadAccess); if (status != Success) - return (status == BadValue) ? BadPixmap : status; + return status; } } @@ -1305,7 +1296,7 @@ ProcScreenSaverSetAttributes (ClientPtr client) XRT_COLORMAP, client, DixReadAccess); if (status != Success) - return (status == BadValue) ? BadColor : status; + return status; } } diff --git a/Xext/security.c b/Xext/security.c index 7995ff2f3..e58ba10f8 100644 --- a/Xext/security.c +++ b/Xext/security.c @@ -198,16 +198,10 @@ SecurityDeleteAuthorization( while ((pEventClient = pAuth->eventClients)) { /* send revocation event event */ - ClientPtr client = rClient(pEventClient); - - if (!client->clientGone) - { - xSecurityAuthorizationRevokedEvent are; - are.type = SecurityEventBase + XSecurityAuthorizationRevoked; - are.sequenceNumber = client->sequence; - are.authId = pAuth->id; - WriteEventsToClient(client, 1, (xEvent *)&are); - } + xSecurityAuthorizationRevokedEvent are; + are.type = SecurityEventBase + XSecurityAuthorizationRevoked; + are.authId = pAuth->id; + WriteEventsToClient(rClient(pEventClient), 1, (xEvent *)&are); FreeResource(pEventClient->resource, RT_NONE); } @@ -629,8 +623,7 @@ ProcSecurityRevokeAuthorization( SecurityAuthorizationResType, client, DixDestroyAccess); if (rc != Success) - return (rc == BadValue) ? - SecurityErrorBase + XSecurityBadAuthorization : rc; + return rc; FreeResource(stuff->authId, RT_NONE); return Success; @@ -1146,6 +1139,8 @@ SecurityExtensionInit(INITARGS) EventSwapVector[SecurityEventBase + XSecurityAuthorizationRevoked] = (EventSwapPtr)SwapSecurityAuthorizationRevokedEvent; + SetResourceTypeErrorValue(SecurityAuthorizationResType, SecurityErrorBase + XSecurityBadAuthorization); + /* Label objects that were created before we could register ourself */ SecurityLabelInitial(); } diff --git a/Xext/shape.c b/Xext/shape.c index cd756583c..93e4703e9 100644 --- a/Xext/shape.c +++ b/Xext/shape.c @@ -360,7 +360,7 @@ ProcPanoramiXShapeRectangles( result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS(j) { stuff->dest = win->info[j].id; @@ -415,7 +415,7 @@ ProcShapeMask (ClientPtr client) rc = dixLookupResourceByType((pointer *)&pPixmap, stuff->src, RT_PIXMAP, client, DixReadAccess); if (rc != Success) - return (rc == BadValue) ? BadPixmap : rc; + return rc; if (pPixmap->drawable.pScreen != pScreen || pPixmap->drawable.depth != 1) return BadMatch; @@ -459,13 +459,13 @@ ProcPanoramiXShapeMask( result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; if(stuff->src != None) { result = dixLookupResourceByType((pointer *)&pmap, stuff->src, XRT_PIXMAP, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadPixmap : result; + return result; } else pmap = NULL; @@ -589,12 +589,12 @@ ProcPanoramiXShapeCombine( result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; result = dixLookupResourceByType((pointer *)&win2, stuff->src, XRT_WINDOW, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS(j) { stuff->dest = win->info[j].id; @@ -663,7 +663,7 @@ ProcPanoramiXShapeOffset( result = dixLookupResourceByType((pointer *)&win, stuff->dest, XRT_WINDOW, client, DixWriteAccess); if (result != Success) - return (result == BadValue) ? BadWindow : result; + return result; FOR_NSCREENS(j) { stuff->dest = win->info[j].id; @@ -885,7 +885,6 @@ void SendShapeNotify (WindowPtr pWin, int which) { ShapeEventPtr *pHead, pShapeEvent; - ClientPtr client; xShapeNotifyEvent se; BoxRec extents; RegionPtr region; @@ -940,20 +939,16 @@ SendShapeNotify (WindowPtr pWin, int which) return; } for (pShapeEvent = *pHead; pShapeEvent; pShapeEvent = pShapeEvent->next) { - client = pShapeEvent->client; - if (client == serverClient || client->clientGone) - continue; se.type = ShapeNotify + ShapeEventBase; se.kind = which; se.window = pWin->drawable.id; - se.sequenceNumber = client->sequence; se.x = extents.x1; se.y = extents.y1; se.width = extents.x2 - extents.x1; se.height = extents.y2 - extents.y1; se.time = currentTime.milliseconds; se.shaped = shaped; - WriteEventsToClient (client, 1, (xEvent *) &se); + WriteEventsToClient (pShapeEvent->client, 1, (xEvent *) &se); } } diff --git a/Xext/shm.c b/Xext/shm.c index 25043fadc..3d9c63352 100644 --- a/Xext/shm.c +++ b/Xext/shm.c @@ -156,7 +156,7 @@ static ShmFuncs fbFuncs = {fbShmCreatePixmap, NULL}; rc = dixLookupResourceByType((pointer *)&(shmdesc), shmseg, ShmSegType, \ client, DixReadAccess); \ if (rc != Success) \ - return (rc == BadValue) ? BadShmSegCode : rc; \ + return rc; \ } #define VERIFY_SHMPTR(shmseg,offset,needwrite,shmdesc,client) \ @@ -286,6 +286,7 @@ ShmExtensionInit(INITARGS) ShmReqCode = (unsigned char)extEntry->base; ShmCompletionCode = extEntry->eventBase; BadShmSegCode = extEntry->errorBase; + SetResourceTypeErrorValue(ShmSegType, BadShmSegCode); EventSwapVector[ShmCompletionCode] = (EventSwapPtr) SShmCompletionEvent; } } @@ -584,7 +585,7 @@ ProcPanoramiXShmPutImage(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -943,7 +944,6 @@ ProcShmPutImage(ClientPtr client) ev.type = ShmCompletionCode; ev.drawable = stuff->drawable; - ev.sequenceNumber = client->sequence; ev.minorEvent = X_ShmPutImage; ev.majorEvent = ShmReqCode; ev.shmseg = stuff->shmseg; diff --git a/Xext/sync.c b/Xext/sync.c index d46087a68..a51262a99 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -264,7 +264,7 @@ SyncInitTrigger(ClientPtr client, SyncTrigger *pTrigger, XSyncCounter counter, counter, RTCounter, client, DixReadAccess))) { client->errorValue = counter; - return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc; + return rc; } if (pCounter != pTrigger->pCounter) { /* new counter for trigger */ @@ -372,7 +372,6 @@ SyncSendAlarmNotifyEvents(SyncAlarm *pAlarm) ane.type = SyncEventBase + XSyncAlarmNotify; ane.kind = XSyncAlarmNotify; - ane.sequenceNumber = pAlarm->client->sequence; ane.alarm = pAlarm->alarm_id; if (pTrigger->pCounter) { @@ -390,18 +389,12 @@ SyncSendAlarmNotifyEvents(SyncAlarm *pAlarm) ane.state = pAlarm->state; /* send to owner */ - if (pAlarm->events && !pAlarm->client->clientGone) + if (pAlarm->events) WriteEventsToClient(pAlarm->client, 1, (xEvent *) &ane); /* send to other interested clients */ for (pcl = pAlarm->pEventClients; pcl; pcl = pcl->next) - { - if (!pcl->client->clientGone) - { - ane.sequenceNumber = pcl->client->sequence; - WriteEventsToClient(pcl->client, 1, (xEvent *) &ane); - } - } + WriteEventsToClient(pcl->client, 1, (xEvent *) &ane); } @@ -426,7 +419,6 @@ SyncSendCounterNotifyEvents(ClientPtr client, SyncAwait **ppAwait, SyncTrigger *pTrigger = &(*ppAwait)->trigger; pev->type = SyncEventBase + XSyncCounterNotify; pev->kind = XSyncCounterNotify; - pev->sequenceNumber = client->sequence; pev->counter = pTrigger->pCounter->id; pev->wait_value_lo = XSyncValueLow32(pTrigger->test_value); pev->wait_value_hi = XSyncValueHigh32(pTrigger->test_value); @@ -1336,7 +1328,7 @@ ProcSyncSetCounter(ClientPtr client) rc = dixLookupResourceByType((pointer *)&pCounter, stuff->cid, RTCounter, client, DixWriteAccess); if (rc != Success) - return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc; + return rc; if (IsSystemCounter(pCounter)) { @@ -1366,7 +1358,7 @@ ProcSyncChangeCounter(ClientPtr client) rc = dixLookupResourceByType((pointer *)&pCounter, stuff->cid, RTCounter, client, DixWriteAccess); if (rc != Success) - return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc; + return rc; if (IsSystemCounter(pCounter)) { @@ -1401,7 +1393,7 @@ ProcSyncDestroyCounter(ClientPtr client) rc = dixLookupResourceByType((pointer *)&pCounter, stuff->counter, RTCounter, client, DixDestroyAccess); if (rc != Success) - return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc; + return rc; if (IsSystemCounter(pCounter)) { @@ -1544,7 +1536,7 @@ ProcSyncQueryCounter(ClientPtr client) rc = dixLookupResourceByType((pointer *)&pCounter, stuff->counter, RTCounter, client, DixReadAccess); if (rc != Success) - return (rc == BadValue) ? SyncErrorBase + XSyncBadCounter : rc; + return rc; rep.type = X_Reply; rep.length = 0; @@ -1668,7 +1660,7 @@ ProcSyncChangeAlarm(ClientPtr client) status = dixLookupResourceByType((pointer *)&pAlarm, stuff->alarm, RTAlarm, client, DixWriteAccess); if (status != Success) - return (status == BadValue) ? SyncErrorBase + XSyncBadAlarm : status; + return status; vmask = stuff->valueMask; len = client->req_len - bytes_to_int32(sizeof(xSyncChangeAlarmReq)); @@ -1707,7 +1699,7 @@ ProcSyncQueryAlarm(ClientPtr client) rc = dixLookupResourceByType((pointer *)&pAlarm, stuff->alarm, RTAlarm, client, DixReadAccess); if (rc != Success) - return (rc == BadValue) ? SyncErrorBase + XSyncBadAlarm : rc; + return rc; rep.type = X_Reply; rep.length = bytes_to_int32(sizeof(xSyncQueryAlarmReply) - sizeof(xGenericReply)); @@ -1764,7 +1756,7 @@ ProcSyncDestroyAlarm(ClientPtr client) rc = dixLookupResourceByType((pointer *)&pAlarm, stuff->alarm, RTAlarm, client, DixDestroyAccess); if (rc != Success) - return (rc == BadValue) ? SyncErrorBase + XSyncBadAlarm : rc; + return rc; FreeResource(stuff->alarm, RT_NONE); return Success; @@ -2135,6 +2127,9 @@ SyncExtensionInit(void) EventSwapVector[SyncEventBase + XSyncCounterNotify] = (EventSwapPtr) SCounterNotifyEvent; EventSwapVector[SyncEventBase + XSyncAlarmNotify] = (EventSwapPtr) SAlarmNotifyEvent; + SetResourceTypeErrorValue(RTCounter, SyncErrorBase + XSyncBadCounter); + SetResourceTypeErrorValue(RTAlarm, SyncErrorBase + XSyncBadAlarm); + /* * Although SERVERTIME is implemented by the OS layer, we initialise it * here because doing it in OsInit() is too early. The resource database diff --git a/Xext/xcalibrate.c b/Xext/xcalibrate.c index 364b92ac4..bff1c3168 100644 --- a/Xext/xcalibrate.c +++ b/Xext/xcalibrate.c @@ -54,13 +54,11 @@ xcalibrate_event_hook (int x, int y, int pressure, void *closure) xXCalibrateRawTouchscreenEvent ev; ev.type = XCalibrateEventBase + X_XCalibrateRawTouchscreen; - ev.sequenceNumber = pClient->sequence; ev.x = x; ev.y = y; ev.pressure = pressure; - if (!pClient->clientGone) - WriteEventsToClient (pClient, 1, (xEvent *) &ev); + WriteEventsToClient (pClient, 1, (xEvent *) &ev); } static int diff --git a/Xext/xtest.c b/Xext/xtest.c index 09c4677a2..263d0c16a 100644 --- a/Xext/xtest.c +++ b/Xext/xtest.c @@ -153,7 +153,7 @@ ProcXTestCompareCursor(ClientPtr client) if (rc != Success) { client->errorValue = stuff->cursor; - return (rc == BadValue) ? BadCursor : rc; + return rc; } } rep.type = X_Reply; diff --git a/Xext/xvdisp.c b/Xext/xvdisp.c index fd633f1f9..d7338ad87 100644 --- a/Xext/xvdisp.c +++ b/Xext/xvdisp.c @@ -1025,7 +1025,6 @@ typedef struct _ShmDesc { } ShmDescRec, *ShmDescPtr; extern RESTYPE ShmSegType; -extern int BadShmSegCode; extern int ShmCompletionCode; static int @@ -1077,7 +1076,7 @@ ProcXvShmPutImage(ClientPtr client) status = dixLookupResourceByType((pointer *)&shmdesc, stuff->shmseg, ShmSegType, serverClient, DixReadAccess); if (status != Success) - return (status == BadValue) ? BadShmSegCode : status; + return status; width = stuff->width; height = stuff->height; @@ -1100,7 +1099,6 @@ ProcXvShmPutImage(ClientPtr client) ev.type = ShmCompletionCode; ev.drawable = stuff->drawable; - ev.sequenceNumber = client->sequence; ev.minorEvent = xv_ShmPutImage; ev.majorEvent = XvReqCode; ev.shmseg = stuff->shmseg; @@ -1616,7 +1614,7 @@ XineramaXvStopVideo(ClientPtr client) result = dixLookupResourceByType((pointer *)&port, stuff->port, XvXRTPort, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? _XvBadPort : result; + return result; FOR_NSCREENS_BACKWARD(i) { if(port->info[i].id) { @@ -1641,7 +1639,7 @@ XineramaXvSetPortAttribute(ClientPtr client) result = dixLookupResourceByType((pointer *)&port, stuff->port, XvXRTPort, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? _XvBadPort : result; + return result; FOR_NSCREENS_BACKWARD(i) { if(port->info[i].id) { @@ -1672,12 +1670,12 @@ XineramaXvShmPutImage(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; result = dixLookupResourceByType((pointer *)&port, stuff->port, XvXRTPort, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? _XvBadPort : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1724,12 +1722,12 @@ XineramaXvPutImage(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; result = dixLookupResourceByType((pointer *)&port, stuff->port, XvXRTPort, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? _XvBadPort : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1772,12 +1770,12 @@ XineramaXvPutVideo(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; result = dixLookupResourceByType((pointer *)&port, stuff->port, XvXRTPort, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? _XvBadPort : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1820,12 +1818,12 @@ XineramaXvPutStill(ClientPtr client) result = dixLookupResourceByType((pointer *)&gc, stuff->gc, XRT_GC, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? BadGC : result; + return result; result = dixLookupResourceByType((pointer *)&port, stuff->port, XvXRTPort, client, DixReadAccess); if (result != Success) - return (result == BadValue) ? _XvBadPort : result; + return result; isRoot = (draw->type == XRT_WINDOW) && draw->u.win.root; @@ -1911,6 +1909,7 @@ void XineramifyXv(void) XvXRTPort = CreateNewResourceType(XineramaDeleteResource, "XvXRTPort"); if (!xvsp0 || !XvXRTPort) return; + SetResourceTypeErrorValue(XvXRTPort, _XvBadPort); for(i = 0; i < xvsp0->nAdaptors; i++) { Bool isOverlay; diff --git a/Xext/xvdix.h b/Xext/xvdix.h index 44f8f6b18..a2106150e 100644 --- a/Xext/xvdix.h +++ b/Xext/xvdix.h @@ -206,7 +206,7 @@ typedef struct _XvPortRec { int rc = dixLookupResourceByType((pointer *)&(pPort), portID,\ XvRTPort, client, mode);\ if (rc != Success)\ - return (rc == BadValue) ? _XvBadPort : rc;\ + return rc;\ } typedef struct { diff --git a/Xext/xvmain.c b/Xext/xvmain.c index 72678f766..9a367bd4c 100644 --- a/Xext/xvmain.c +++ b/Xext/xvmain.c @@ -192,6 +192,7 @@ XvExtensionInit(void) EventSwapVector[XvEventBase+XvPortNotify] = (EventSwapPtr)WriteSwappedPortNotifyEvent; + SetResourceTypeErrorValue(XvRTPort, _XvBadPort); (void)MakeAtom(XvName, strlen(XvName), xTrue); } @@ -530,17 +531,12 @@ XvdiSendVideoNotify(XvPortPtr pPort, DrawablePtr pDraw, int reason) while (pn) { - if (pn->client) - { - event.u.u.type = XvEventBase + XvVideoNotify; - event.u.u.sequenceNumber = pn->client->sequence; - event.u.videoNotify.time = currentTime.milliseconds; - event.u.videoNotify.drawable = pDraw->id; - event.u.videoNotify.port = pPort->id; - event.u.videoNotify.reason = reason; - TryClientEvents(pn->client, NULL, (xEventPtr)&event, 1, - NoEventMask, NoEventMask, NullGrab); - } + event.u.u.type = XvEventBase + XvVideoNotify; + event.u.videoNotify.time = currentTime.milliseconds; + event.u.videoNotify.drawable = pDraw->id; + event.u.videoNotify.port = pPort->id; + event.u.videoNotify.reason = reason; + WriteEventsToClient(pn->client, 1, (xEventPtr)&event); pn = pn->next; } @@ -562,17 +558,12 @@ XvdiSendPortNotify( while (pn) { - if (pn->client) - { - event.u.u.type = XvEventBase + XvPortNotify; - event.u.u.sequenceNumber = pn->client->sequence; - event.u.portNotify.time = currentTime.milliseconds; - event.u.portNotify.port = pPort->id; - event.u.portNotify.attribute = attribute; - event.u.portNotify.value = value; - TryClientEvents(pn->client, NULL, (xEventPtr)&event, 1, - NoEventMask, NoEventMask, NullGrab); - } + event.u.u.type = XvEventBase + XvPortNotify; + event.u.portNotify.time = currentTime.milliseconds; + event.u.portNotify.port = pPort->id; + event.u.portNotify.attribute = attribute; + event.u.portNotify.value = value; + WriteEventsToClient(pn->client, 1, (xEventPtr)&event); pn = pn->next; } diff --git a/Xext/xvmc.c b/Xext/xvmc.c index abb8e0250..755038631 100644 --- a/Xext/xvmc.c +++ b/Xext/xvmc.c @@ -40,7 +40,6 @@ unsigned long XvMCGeneration = 0; int XvMCReqCode; int XvMCEventBase; -int XvMCErrorBase; unsigned long XvMCRTContext; unsigned long XvMCRTSurface; @@ -276,7 +275,7 @@ ProcXvMCDestroyContext(ClientPtr client) rc = dixLookupResourceByType(&val, stuff->context_id, XvMCRTContext, client, DixDestroyAccess); if (rc != Success) - return (rc == BadValue) ? XvMCBadContext + XvMCErrorBase : rc; + return rc; FreeResource(stuff->context_id, RT_NONE); @@ -299,7 +298,7 @@ ProcXvMCCreateSurface(ClientPtr client) result = dixLookupResourceByType((pointer *)&pContext, stuff->context_id, XvMCRTContext, client, DixUseAccess); if (result != Success) - return (result == BadValue) ? XvMCBadContext + XvMCErrorBase : result; + return result; pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen); @@ -346,7 +345,7 @@ ProcXvMCDestroySurface(ClientPtr client) rc = dixLookupResourceByType(&val, stuff->surface_id, XvMCRTSurface, client, DixDestroyAccess); if (rc != Success) - return (rc == BadValue) ? XvMCBadSurface + XvMCErrorBase : rc; + return rc; FreeResource(stuff->surface_id, RT_NONE); @@ -371,7 +370,7 @@ ProcXvMCCreateSubpicture(ClientPtr client) result = dixLookupResourceByType((pointer *)&pContext, stuff->context_id, XvMCRTContext, client, DixUseAccess); if (result != Success) - return (result == BadValue) ? XvMCBadContext + XvMCErrorBase : result; + return result; pScreenPriv = XVMC_GET_PRIVATE(pContext->pScreen); @@ -463,7 +462,7 @@ ProcXvMCDestroySubpicture(ClientPtr client) rc = dixLookupResourceByType(&val, stuff->subpicture_id, XvMCRTSubpicture, client, DixDestroyAccess); if (rc != Success) - return (rc == BadValue) ? XvMCBadSubpicture + XvMCErrorBase : rc; + return rc; FreeResource(stuff->subpicture_id, RT_NONE); @@ -694,7 +693,9 @@ XvMCExtensionInit(void) XvMCReqCode = extEntry->base; XvMCEventBase = extEntry->eventBase; - XvMCErrorBase = extEntry->errorBase; + SetResourceTypeErrorValue(XvMCRTContext, extEntry->errorBase + XvMCBadContext); + SetResourceTypeErrorValue(XvMCRTSurface, extEntry->errorBase + XvMCBadSurface); + SetResourceTypeErrorValue(XvMCRTSubpicture, extEntry->errorBase + XvMCBadSubpicture); } static Bool diff --git a/Xi/exevents.c b/Xi/exevents.c index b24204d82..41b396c28 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -1445,7 +1445,7 @@ GrabButton(ClientPtr client, DeviceIntPtr dev, DeviceIntPtr modifier_device, if (rc != Success) { client->errorValue = param->cursor; - return (rc == BadValue) ? BadCursor : rc; + return rc; } access_mode |= DixForceAccess; } @@ -1543,7 +1543,7 @@ GrabWindow(ClientPtr client, DeviceIntPtr dev, int type, if (rc != Success) { client->errorValue = param->cursor; - return (rc == BadValue) ? BadCursor : rc; + return rc; } access_mode |= DixForceAccess; } diff --git a/Xi/xichangecursor.c b/Xi/xichangecursor.c index f071e8406..e72cfac03 100644 --- a/Xi/xichangecursor.c +++ b/Xi/xichangecursor.c @@ -103,7 +103,7 @@ int ProcXIChangeCursor(ClientPtr client) rc = dixLookupResourceByType((pointer *)&pCursor, stuff->cursor, RT_CURSOR, client, DixUseAccess); if (rc != Success) - return (rc == BadValue) ? BadCursor : rc; + return rc; } ChangeWindowDeviceCursor(pWin, pDev, pCursor); diff --git a/Xi/xipassivegrab.c b/Xi/xipassivegrab.c index a62fe7946..296614510 100644 --- a/Xi/xipassivegrab.c +++ b/Xi/xipassivegrab.c @@ -147,7 +147,7 @@ ProcXIPassiveGrabDevice(ClientPtr client) if (status != Success) { client->errorValue = stuff->cursor; - return (status == BadValue) ? BadCursor : status; + return status; } } diff --git a/composite/compext.c b/composite/compext.c index 3bb9a3701..ed437756e 100644 --- a/composite/compext.c +++ b/composite/compext.c @@ -140,10 +140,7 @@ ProcCompositeQueryVersion (ClientPtr client) int err; \ err = dixLookupResourceByType((pointer *) &pWindow, wid, \ RT_WINDOW, client, mode); \ - if (err == BadValue) { \ - client->errorValue = wid; \ - return BadWindow; \ - } else if (err != Success) { \ + if (err != Success) { \ client->errorValue = wid; \ return err; \ } \ diff --git a/damageext/damageext.c b/damageext/damageext.c index af4fef678..e4eda5efc 100644 --- a/damageext/damageext.c +++ b/damageext/damageext.c @@ -29,7 +29,6 @@ static unsigned char DamageReqCode; static int DamageEventBase; -static int DamageErrorBase; static RESTYPE DamageExtType; static RESTYPE DamageExtWinType; @@ -50,7 +49,6 @@ DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes) UpdateCurrentTimeIf (); ev.type = DamageEventBase + XDamageNotify; ev.level = pDamageExt->level; - ev.sequenceNumber = pClient->sequence; ev.drawable = pDamageExt->drawable; ev.damage = pDamageExt->id; ev.timestamp = currentTime.milliseconds; @@ -69,8 +67,7 @@ DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes) ev.area.y = pBoxes[i].y1; ev.area.width = pBoxes[i].x2 - pBoxes[i].x1; ev.area.height = pBoxes[i].y2 - pBoxes[i].y1; - if (!pClient->clientGone) - WriteEventsToClient (pClient, 1, (xEvent *) &ev); + WriteEventsToClient (pClient, 1, (xEvent *) &ev); } } else @@ -79,8 +76,7 @@ DamageExtNotify (DamageExtPtr pDamageExt, BoxPtr pBoxes, int nBoxes) ev.area.y = 0; ev.area.width = pDrawable->width; ev.area.height = pDrawable->height; - if (!pClient->clientGone) - WriteEventsToClient (pClient, 1, (xEvent *) &ev); + WriteEventsToClient (pClient, 1, (xEvent *) &ev); } /* Composite extension marks clients with manual Subwindows as critical */ if (pDamageClient->critical > 0) @@ -518,8 +514,8 @@ DamageExtensionInit(void) { DamageReqCode = (unsigned char)extEntry->base; DamageEventBase = extEntry->eventBase; - DamageErrorBase = extEntry->errorBase; EventSwapVector[DamageEventBase + XDamageNotify] = (EventSwapPtr) SDamageNotifyEvent; + SetResourceTypeErrorValue(DamageExtType, extEntry->errorBase + BadDamage); } } diff --git a/damageext/damageextint.h b/damageext/damageextint.h index d40ba3e1c..a235cb908 100644 --- a/damageext/damageextint.h +++ b/damageext/damageextint.h @@ -62,7 +62,7 @@ typedef struct _DamageExt { int rc = dixLookupResourceByType((pointer *)&(pDamageExt), rid, \ DamageExtType, client, mode); \ if (rc != Success) \ - return (rc == BadValue) ? DamageErrorBase + BadDamage : rc; \ + return rc; \ } void @@ -422,12 +422,12 @@ ProcDbeDeallocateBackBufferName(ClientPtr client) dbeWindowPrivResType, client, DixDestroyAccess); if (rc != Success) - return (rc == BadValue) ? dbeErrorBase + DbeBadBuffer : rc; + return rc; rc = dixLookupResourceByType(&val, stuff->buffer, dbeDrawableResType, client, DixDestroyAccess); if (rc != Success) - return (rc == BadValue) ? dbeErrorBase + DbeBadBuffer : rc; + return rc; /* Make sure that the id is valid for the window. * This is paranoid code since we already looked up the ID by type @@ -1672,6 +1672,8 @@ DbeExtensionInit(void) DbeResetProc, StandardMinorOpcode); dbeErrorBase = extEntry->errorBase; + SetResourceTypeErrorValue(dbeWindowPrivResType, dbeErrorBase + DbeBadBuffer); + SetResourceTypeErrorValue(dbeDrawableResType, dbeErrorBase + DbeBadBuffer); } /* DbeExtensionInit() */ diff --git a/dix/cursor.c b/dix/cursor.c index a512309bb..7ff0a932e 100644 --- a/dix/cursor.c +++ b/dix/cursor.c @@ -316,14 +316,14 @@ AllocGlyphCursor(Font source, unsigned sourceChar, Font mask, unsigned maskChar, if (rc != Success) { client->errorValue = source; - return (rc == BadValue) ? BadFont : rc; + return rc; } rc = dixLookupResourceByType((pointer *)&maskfont, mask, RT_FONT, client, DixUseAccess); if (rc != Success && mask != None) { client->errorValue = mask; - return (rc == BadValue) ? BadFont : rc; + return rc; } if (sourcefont != maskfont) pShare = (GlyphSharePtr)NULL; diff --git a/dix/dispatch.c b/dix/dispatch.c index fe9ddb2a8..c86011a83 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -1240,7 +1240,7 @@ ProcCloseFont(ClientPtr client) else { client->errorValue = stuff->id; - return (rc == BadValue) ? BadFont : rc; + return rc; } } @@ -1453,7 +1453,7 @@ ProcFreePixmap(ClientPtr client) else { client->errorValue = stuff->id; - return (rc == BadValue) ? BadPixmap : rc; + return rc; } } @@ -2407,7 +2407,7 @@ ProcFreeColormap(ClientPtr client) else { client->errorValue = stuff->id; - return (rc == BadValue) ? BadColor : rc; + return rc; } } @@ -2428,7 +2428,7 @@ ProcCopyColormapAndFree(ClientPtr client) if (rc == Success) return CopyColormapAndFree(mid, pSrcMap, client->index); client->errorValue = stuff->srcCmap; - return (rc == BadValue) ? BadColor : rc; + return rc; } int @@ -2445,15 +2445,18 @@ ProcInstallColormap(ClientPtr client) goto out; rc = XaceHook(XACE_SCREEN_ACCESS, client, pcmp->pScreen, DixSetAttrAccess); - if (rc != Success) + if (rc != Success) { + if (rc == BadValue) + rc = BadColor; goto out; + } (*(pcmp->pScreen->InstallColormap)) (pcmp); return Success; out: client->errorValue = stuff->id; - return (rc == BadValue) ? BadColor : rc; + return rc; } int @@ -2470,8 +2473,11 @@ ProcUninstallColormap(ClientPtr client) goto out; rc = XaceHook(XACE_SCREEN_ACCESS, client, pcmp->pScreen, DixSetAttrAccess); - if (rc != Success) + if (rc != Success) { + if (rc == BadValue) + rc = BadColor; goto out; + } if(pcmp->mid != pcmp->pScreen->defColormap) (*(pcmp->pScreen->UninstallColormap)) (pcmp); @@ -2479,7 +2485,7 @@ ProcUninstallColormap(ClientPtr client) out: client->errorValue = stuff->id; - return (rc == BadValue) ? BadColor : rc; + return rc; } int @@ -2552,7 +2558,7 @@ ProcAllocColor (ClientPtr client) else { client->errorValue = stuff->cmap; - return (rc == BadValue) ? BadColor : rc; + return rc; } } @@ -2598,7 +2604,7 @@ ProcAllocNamedColor (ClientPtr client) else { client->errorValue = stuff->cmap; - return (rc == BadValue) ? BadColor : rc; + return rc; } } @@ -2662,7 +2668,7 @@ ProcAllocColorCells (ClientPtr client) else { client->errorValue = stuff->cmap; - return (rc == BadValue) ? BadColor : rc; + return rc; } } @@ -2724,7 +2730,7 @@ ProcAllocColorPlanes(ClientPtr client) else { client->errorValue = stuff->cmap; - return (rc == BadValue) ? BadColor : rc; + return rc; } } @@ -2751,7 +2757,7 @@ ProcFreeColors(ClientPtr client) else { client->errorValue = stuff->cmap; - return (rc == BadValue) ? BadColor : rc; + return rc; } } @@ -2778,7 +2784,7 @@ ProcStoreColors (ClientPtr client) else { client->errorValue = stuff->cmap; - return (rc == BadValue) ? BadColor : rc; + return rc; } } @@ -2808,7 +2814,7 @@ ProcStoreNamedColor (ClientPtr client) else { client->errorValue = stuff->cmap; - return (rc == BadValue) ? BadColor : rc; + return rc; } } @@ -2855,7 +2861,7 @@ ProcQueryColors(ClientPtr client) else { client->errorValue = stuff->cmap; - return (rc == BadValue) ? BadColor : rc; + return rc; } } @@ -2894,7 +2900,7 @@ ProcLookupColor(ClientPtr client) else { client->errorValue = stuff->cmap; - return (rc == BadValue) ? BadColor : rc; + return rc; } } @@ -2920,7 +2926,7 @@ ProcCreateCursor (ClientPtr client) DixReadAccess); if (rc != Success) { client->errorValue = stuff->source; - return (rc == BadValue) ? BadPixmap : rc; + return rc; } rc = dixLookupResourceByType((pointer *)&msk, stuff->mask, RT_PIXMAP, client, @@ -2930,7 +2936,7 @@ ProcCreateCursor (ClientPtr client) if (stuff->mask != None) { client->errorValue = stuff->mask; - return (rc == BadValue) ? BadPixmap : rc; + return rc; } } else if ( src->drawable.width != msk->drawable.width @@ -3031,7 +3037,7 @@ ProcFreeCursor (ClientPtr client) else { client->errorValue = stuff->id; - return (rc == BadValue) ? BadCursor : rc; + return rc; } } @@ -3741,7 +3747,6 @@ SendErrorToClient(ClientPtr client, unsigned majorCode, unsigned minorCode, memset(&rep, 0, sizeof(xError)); rep.type = X_Error; - rep.sequenceNumber = client->sequence; rep.errorCode = errorCode; rep.majorCode = majorCode; rep.minorCode = minorCode; diff --git a/dix/dixfonts.c b/dix/dixfonts.c index 585754b57..ba1d0e246 100644 --- a/dix/dixfonts.c +++ b/dix/dixfonts.c @@ -1238,7 +1238,6 @@ doPolyText(ClientPtr client, PTclosurePtr c) client, DixUseAccess); if (err != Success) { - err = (err == BadValue) ? BadFont : err; /* restore pFont and fid for step 4 (described below) */ pFont = oldpFont; fid = oldfid; diff --git a/dix/dixutils.c b/dix/dixutils.c index 5955eb84a..51dbd1481 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -231,9 +231,7 @@ dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access) int dixLookupGC(GCPtr *pGC, XID id, ClientPtr client, Mask access) { - int rc; - rc = dixLookupResourceByType((pointer *)pGC, id, RT_GC, client, access); - return (rc == BadValue) ? BadGC : rc; + return dixLookupResourceByType((pointer *)pGC, id, RT_GC, client, access); } int @@ -243,10 +241,10 @@ dixLookupFontable(FontPtr *pFont, XID id, ClientPtr client, Mask access) GC *pGC; client->errorValue = id; /* EITHER font or gc */ rc = dixLookupResourceByType((pointer *) pFont, id, RT_FONT, client, access); - if (rc != BadValue) + if (rc != BadFont) return rc; rc = dixLookupResourceByType((pointer *) &pGC, id, RT_GC, client, access); - if (rc == BadValue) + if (rc == BadGC) return BadFont; if (rc == Success) *pFont = pGC->font; diff --git a/dix/events.c b/dix/events.c index 3ed344d5f..9e05dc96c 100644 --- a/dix/events.c +++ b/dix/events.c @@ -1841,7 +1841,6 @@ int TryClientEvents (ClientPtr client, DeviceIntPtr dev, xEvent *pEvents, int count, Mask mask, Mask filter, GrabPtr grab) { - int i; int type; #ifdef DEBUG_EVENTS @@ -1908,7 +1907,6 @@ TryClientEvents (ClientPtr client, DeviceIntPtr dev, xEvent *pEvents, { xEvent release = *pEvents; release.u.u.type = KeyRelease; - release.u.u.sequenceNumber = client->sequence; WriteEventsToClient(client, 1, &release); #ifdef DEBUG_EVENTS ErrorF(" (plus fake core release for repeat)"); @@ -1929,7 +1927,6 @@ TryClientEvents (ClientPtr client, DeviceIntPtr dev, xEvent *pEvents, { deviceKeyButtonPointer release = *(deviceKeyButtonPointer *)pEvents; release.type = DeviceKeyRelease; - release.sequenceNumber = client->sequence; #ifdef DEBUG_EVENTS ErrorF(" (plus fake xi1 release for repeat)"); #endif @@ -1943,14 +1940,6 @@ TryClientEvents (ClientPtr client, DeviceIntPtr dev, xEvent *pEvents, } } - type &= 0177; - if (type != KeymapNotify) - { - /* all extension events must have a sequence number */ - for (i = 0; i < count; i++) - pEvents[i].u.u.sequenceNumber = client->sequence; - } - if (BitIsOn(criticalEvents, type)) { if (client->smart_priority < SMART_MAX_PRIORITY) @@ -4708,7 +4697,7 @@ ProcChangeActivePointerGrab(ClientPtr client) if (rc != Success) { client->errorValue = stuff->cursor; - return (rc == BadValue) ? BadCursor : rc; + return rc; } } @@ -4831,7 +4820,7 @@ GrabDevice(ClientPtr client, DeviceIntPtr dev, if (rc != Success) { client->errorValue = curs; - return (rc == BadValue) ? BadCursor : rc; + return rc; } access_mode |= DixForceAccess; } @@ -5356,7 +5345,7 @@ ProcGrabButton(ClientPtr client) if (rc != Success) { client->errorValue = stuff->cursor; - return (rc == BadValue) ? BadCursor : rc; + return rc; } access_mode |= DixForceAccess; } @@ -5619,7 +5608,7 @@ ProcRecolorCursor(ClientPtr client) if (rc != Success) { client->errorValue = stuff->cursor; - return (rc == BadValue) ? BadCursor : rc; + return rc; } pCursor->foreRed = stuff->foreRed; @@ -5669,6 +5658,13 @@ WriteEventsToClient(ClientPtr pClient, int count, xEvent *events) int i, eventlength = sizeof(xEvent); + if (!pClient || pClient == serverClient || pClient->clientGone) + return; + + for (i = 0; i < count; i++) + if ((events[i].u.u.type & 0x7f) != KeymapNotify) + events[i].u.u.sequenceNumber = pClient->sequence; + /* Let XKB rewrite the state, as it depends on client preferences. */ XkbFilterEvents(pClient, count, events); @@ -458,8 +458,6 @@ ChangeGCXIDs(ClientPtr client, GC *pGC, BITS32 mask, CARD32 *pC32) if (rc != Success) { client->errorValue = vals[offset].val; - if (rc == BadValue) - rc = (xidfields[i].type == RT_PIXMAP) ? BadPixmap : BadFont; return rc; } } diff --git a/dix/inpututils.c b/dix/inpututils.c index e3b44fc08..8e7537250 100644 --- a/dix/inpututils.c +++ b/dix/inpututils.c @@ -88,7 +88,6 @@ do_butmap_change(DeviceIntPtr dev, CARD8 *map, int len, ClientPtr client) if (!XIShouldNotify(clients[i], dev)) continue; - core_mn.u.u.sequenceNumber = clients[i]->sequence; WriteEventsToClient(clients[i], 1, &core_mn); } diff --git a/dix/resource.c b/dix/resource.c index 143b51a77..a6d115f65 100644 --- a/dix/resource.c +++ b/dix/resource.c @@ -183,7 +183,54 @@ RESTYPE lastResourceType; static RESTYPE lastResourceClass; RESTYPE TypeMask; -static DeleteType *DeleteFuncs = (DeleteType *)NULL; +struct ResourceType { + DeleteType deleteFunc; + int errorValue; +}; + +static struct ResourceType *resourceTypes; +static const struct ResourceType predefTypes[] = { + [RT_NONE & (RC_LASTPREDEF - 1)] = { + .deleteFunc = (DeleteType)NoopDDA, + .errorValue = BadValue, + }, + [RT_WINDOW & (RC_LASTPREDEF - 1)] = { + .deleteFunc = DeleteWindow, + .errorValue = BadWindow, + }, + [RT_PIXMAP & (RC_LASTPREDEF - 1)] = { + .deleteFunc = dixDestroyPixmap, + .errorValue = BadPixmap, + }, + [RT_GC & (RC_LASTPREDEF - 1)] = { + .deleteFunc = FreeGC, + .errorValue = BadGC, + }, + [RT_FONT & (RC_LASTPREDEF - 1)] = { + .deleteFunc = CloseFont, + .errorValue = BadFont, + }, + [RT_CURSOR & (RC_LASTPREDEF - 1)] = { + .deleteFunc = FreeCursor, + .errorValue = BadCursor, + }, + [RT_COLORMAP & (RC_LASTPREDEF - 1)] = { + .deleteFunc = FreeColormap, + .errorValue = BadColor, + }, + [RT_CMAPENTRY & (RC_LASTPREDEF - 1)] = { + .deleteFunc = FreeClientPixels, + .errorValue = BadColor, + }, + [RT_OTHERCLIENT & (RC_LASTPREDEF - 1)] = { + .deleteFunc = OtherClientGone, + .errorValue = BadValue, + }, + [RT_PASSIVEGRAB & (RC_LASTPREDEF - 1)] = { + .deleteFunc = DeletePassiveGrab, + .errorValue = BadValue, + }, +}; CallbackListPtr ResourceStateCallback; @@ -200,20 +247,20 @@ RESTYPE CreateNewResourceType(DeleteType deleteFunc, char *name) { RESTYPE next = lastResourceType + 1; - DeleteType *funcs; + struct ResourceType *types; if (next & lastResourceClass) return 0; - funcs = (DeleteType *)realloc(DeleteFuncs, - (next + 1) * sizeof(DeleteType)); - if (!funcs) + types = realloc(resourceTypes, (next + 1) * sizeof(*resourceTypes)); + if (!types) return 0; if (!dixRegisterPrivateOffset(next, -1)) return 0; lastResourceType = next; - DeleteFuncs = funcs; - DeleteFuncs[next] = deleteFunc; + resourceTypes = types; + resourceTypes[next].deleteFunc = deleteFunc; + resourceTypes[next].errorValue = BadValue; /* Called even if name is NULL, to remove any previous entry */ RegisterResourceName(next, name); @@ -221,6 +268,12 @@ CreateNewResourceType(DeleteType deleteFunc, char *name) return next; } +void +SetResourceTypeErrorValue(RESTYPE type, int errorValue) +{ + resourceTypes[type & TypeMask].errorValue = errorValue; +} + RESTYPE CreateNewResourceClass(void) { @@ -251,21 +304,11 @@ InitClientResources(ClientPtr client) lastResourceType = RT_LASTPREDEF; lastResourceClass = RC_LASTPREDEF; TypeMask = RC_LASTPREDEF - 1; - if (DeleteFuncs) - free(DeleteFuncs); - DeleteFuncs = malloc((lastResourceType + 1) * sizeof(DeleteType)); - if (!DeleteFuncs) + free(resourceTypes); + resourceTypes = malloc(sizeof(predefTypes)); + if (!resourceTypes) return FALSE; - DeleteFuncs[RT_NONE & TypeMask] = (DeleteType)NoopDDA; - DeleteFuncs[RT_WINDOW & TypeMask] = DeleteWindow; - DeleteFuncs[RT_PIXMAP & TypeMask] = dixDestroyPixmap; - DeleteFuncs[RT_GC & TypeMask] = FreeGC; - DeleteFuncs[RT_FONT & TypeMask] = CloseFont; - DeleteFuncs[RT_CURSOR & TypeMask] = FreeCursor; - DeleteFuncs[RT_COLORMAP & TypeMask] = FreeColormap; - DeleteFuncs[RT_CMAPENTRY & TypeMask] = FreeClientPixels; - DeleteFuncs[RT_OTHERCLIENT & TypeMask] = OtherClientGone; - DeleteFuncs[RT_PASSIVEGRAB & TypeMask] = DeletePassiveGrab; + memcpy(resourceTypes, predefTypes, sizeof(predefTypes)); } clientTable[i = client->index].resources = malloc(INITBUCKETS*sizeof(ResourcePtr)); @@ -462,7 +505,7 @@ AddResource(XID id, RESTYPE type, pointer value) res = malloc(sizeof(ResourceRec)); if (!res) { - (*DeleteFuncs[type & TypeMask])(value, id); + (*resourceTypes[type & TypeMask].deleteFunc)(value, id); return FALSE; } res->next = *head; @@ -557,7 +600,7 @@ FreeResource(XID id, RESTYPE skipDeleteFuncType) CallResourceStateCallback(ResourceStateFreeing, res); if (rtype != skipDeleteFuncType) - (*DeleteFuncs[rtype & TypeMask])(res->value, res->id); + (*resourceTypes[rtype & TypeMask].deleteFunc)(res->value, res->id); free(res); if (*eltptr != elements) prev = head; /* prev may no longer be valid */ @@ -594,7 +637,7 @@ FreeResourceByType(XID id, RESTYPE type, Bool skipFree) CallResourceStateCallback(ResourceStateFreeing, res); if (!skipFree) - (*DeleteFuncs[type & TypeMask])(res->value, res->id); + (*resourceTypes[type & TypeMask].deleteFunc)(res->value, res->id); free(res); break; } @@ -761,7 +804,7 @@ FreeClientNeverRetainResources(ClientPtr client) CallResourceStateCallback(ResourceStateFreeing, this); elements = *eltptr; - (*DeleteFuncs[rtype & TypeMask])(this->value, this->id); + (*resourceTypes[rtype & TypeMask].deleteFunc)(this->value, this->id); free(this); if (*eltptr != elements) prev = &resources[j]; /* prev may no longer be valid */ @@ -815,7 +858,7 @@ FreeClientResources(ClientPtr client) CallResourceStateCallback(ResourceStateFreeing, this); - (*DeleteFuncs[rtype & TypeMask])(this->value, this->id); + (*resourceTypes[rtype & TypeMask].deleteFunc)(this->value, this->id); free(this); } } @@ -873,6 +916,8 @@ dixLookupResourceByType(pointer *result, XID id, RESTYPE rtype, ResourcePtr res = NULL; *result = NULL; + if ((rtype & TypeMask) > lastResourceType) + return BadImplementation; if ((cid < MAXCLIENTS) && clientTable[cid].buckets) { res = clientTable[cid].resources[Hash(cid, id)]; @@ -882,12 +927,14 @@ dixLookupResourceByType(pointer *result, XID id, RESTYPE rtype, break; } if (!res) - return BadValue; + return resourceTypes[rtype & TypeMask].errorValue; if (client) { client->errorValue = id; cid = XaceHook(XACE_RESOURCE_ACCESS, client, id, res->type, res->value, RT_NONE, NULL, mode); + if (cid == BadValue) + return resourceTypes[rtype & TypeMask].errorValue; if (cid != Success) return cid; } diff --git a/dix/selection.c b/dix/selection.c index 4f592d123..f52638c3a 100644 --- a/dix/selection.c +++ b/dix/selection.c @@ -189,8 +189,7 @@ ProcSetSelectionOwner(ClientPtr client) event.u.selectionClear.time = time.milliseconds; event.u.selectionClear.window = pSel->window; event.u.selectionClear.atom = pSel->selection; - TryClientEvents(pSel->client, NULL, &event, 1, NoEventMask, - NoEventMask /* CantBeFiltered */, NullGrab); + WriteEventsToClient(pSel->client, 1, &event); } } else if (rc == BadMatch) @@ -296,9 +295,11 @@ ProcConvertSelection(ClientPtr client) event.u.selectionRequest.selection = stuff->selection; event.u.selectionRequest.target = stuff->target; event.u.selectionRequest.property = stuff->property; - if (TryClientEvents(pSel->client, NULL, &event, 1, NoEventMask, - NoEventMask /* CantBeFiltered */, NullGrab)) + if (pSel->client && pSel->client != serverClient && !pSel->client->clientGone) + { + WriteEventsToClient(pSel->client, 1, &event); return Success; + } } event.u.u.type = SelectionNotify; @@ -307,7 +308,6 @@ ProcConvertSelection(ClientPtr client) event.u.selectionNotify.selection = stuff->selection; event.u.selectionNotify.target = stuff->target; event.u.selectionNotify.property = None; - TryClientEvents(client, NULL, &event, 1, NoEventMask, - NoEventMask /* CantBeFiltered */, NullGrab); + WriteEventsToClient(client, 1, &event); return Success; } diff --git a/dix/window.c b/dix/window.c index 20cf45204..00854c6d5 100644 --- a/dix/window.c +++ b/dix/window.c @@ -1056,7 +1056,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) } else { - error = (rc == BadValue) ? BadPixmap : rc; + error = rc; client->errorValue = pixID; goto PatchUp; } @@ -1116,7 +1116,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) } else { - error = (rc == BadValue) ? BadPixmap : rc; + error = rc; client->errorValue = pixID; goto PatchUp; } @@ -1264,7 +1264,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) client, DixUseAccess); if (rc != Success) { - error = (rc == BadValue) ? BadColor : rc; + error = rc; client->errorValue = cmap; goto PatchUp; } @@ -1340,7 +1340,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client) RT_CURSOR, client, DixUseAccess); if (rc != Success) { - error = (rc == BadValue) ? BadCursor : rc; + error = rc; client->errorValue = cursorID; goto PatchUp; } diff --git a/glx/glxdri2.c b/glx/glxdri2.c index 9df682e71..b971102d8 100644 --- a/glx/glxdri2.c +++ b/glx/glxdri2.c @@ -187,7 +187,6 @@ __glXdriSwapEvent(ClientPtr client, void *data, int type, CARD64 ust, /* unknown swap completion type */ break; } - wire.sequenceNumber = client->sequence; wire.drawable = drawable->drawId; wire.ust_hi = ust >> 32; wire.ust_lo = ust & 0xffffffff; diff --git a/hw/xfree86/dixmods/extmod/xf86dga2.c b/hw/xfree86/dixmods/extmod/xf86dga2.c index 6587af947..906f4d5fc 100644 --- a/hw/xfree86/dixmods/extmod/xf86dga2.c +++ b/hw/xfree86/dixmods/extmod/xf86dga2.c @@ -436,7 +436,7 @@ ProcXDGAInstallColormap(ClientPtr client) rc = dixLookupResourceByType((pointer *)&cmap, stuff->cmap, RT_COLORMAP, client, DixInstallAccess); if (rc != Success) - return (rc == BadValue) ? BadColor : rc; + return rc; DGAInstallCmap(cmap); return Success; } @@ -878,7 +878,7 @@ ProcXF86DGAInstallColormap(ClientPtr client) DGAInstallCmap(pcmp); return Success; } else { - return (rc == BadValue) ? BadColor : rc; + return rc; } } diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c index 665f74396..754fe372c 100644 --- a/hw/xfree86/dixmods/extmod/xf86vmode.c +++ b/hw/xfree86/dixmods/extmod/xf86vmode.c @@ -331,7 +331,6 @@ SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced) XF86VidModeEventPtr pEv; unsigned long mask; xXF86VidModeNotifyEvent ev; - ClientPtr client; int kind; UpdateCurrentTimeIf (); @@ -343,19 +342,15 @@ SendXF86VidModeNotify(ScreenPtr pScreen, int state, Bool forced) kind = XF86VidModeModeChange; for (pEv = pPriv->events; pEv; pEv = pEv->next) { - client = pEv->client; - if (client->clientGone) - continue; if (!(pEv->mask & mask)) continue; ev.type = XF86VidModeNotify + XF86VidModeEventBase; ev.state = state; - ev.sequenceNumber = client->sequence; ev.timestamp = currentTime.milliseconds; ev.root = WindowTable[pScreen->myNum]->drawable.id; ev.kind = kind; ev.forced = forced; - WriteEventsToClient (client, 1, (xEvent *) &ev); + WriteEventsToClient (pEv->client, 1, (xEvent *) &ev); } } diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c index 44a47cceb..e6d98f53b 100644 --- a/hw/xfree86/dri2/dri2ext.c +++ b/hw/xfree86/dri2/dri2ext.c @@ -160,11 +160,7 @@ DRI2InvalidateBuffersEvent(DrawablePtr pDraw, void *priv) xDRI2InvalidateBuffers event; ClientPtr client = priv; - if (client->clientGone) - return; - event.type = DRI2EventBase + DRI2_InvalidateBuffers; - event.sequenceNumber = client->sequence; event.drawable = pDraw->id; WriteEventsToClient(client, 1, (xEvent *)&event); @@ -366,7 +362,6 @@ DRI2SwapEvent(ClientPtr client, void *data, int type, CARD64 ust, CARD64 msc, DrawablePtr pDrawable = data; event.type = DRI2EventBase + DRI2_BufferSwapComplete; - event.sequenceNumber = client->sequence; event.event_type = type; event.drawable = pDrawable->id; event.ust_hi = (CARD64)ust >> 32; diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c index 53d167e5b..0845f67f0 100644 --- a/hw/xquartz/applewm.c +++ b/hw/xquartz/applewm.c @@ -341,7 +341,6 @@ ProcAppleWMSelectInput (register ClientPtr client) void AppleWMSendEvent (int type, unsigned int mask, int which, int arg) { WMEventPtr *pHead, pEvent; - ClientPtr client; xAppleWMNotifyEvent se; int i; @@ -349,18 +348,13 @@ AppleWMSendEvent (int type, unsigned int mask, int which, int arg) { if (i != Success || !pHead) return; for (pEvent = *pHead; pEvent; pEvent = pEvent->next) { - client = pEvent->client; - if ((pEvent->mask & mask) == 0 - || client == serverClient || client->clientGone) - { + if ((pEvent->mask & mask) == 0) continue; - } se.type = type + WMEventBase; se.kind = which; se.arg = arg; - se.sequenceNumber = client->sequence; se.time = currentTime.milliseconds; - WriteEventsToClient (client, 1, (xEvent *) &se); + WriteEventsToClient (pEvent->client, 1, (xEvent *) &se); } } diff --git a/hw/xquartz/xpr/appledri.c b/hw/xquartz/xpr/appledri.c index 71cfb591b..3afe2443c 100644 --- a/hw/xquartz/xpr/appledri.c +++ b/hw/xquartz/xpr/appledri.c @@ -192,22 +192,16 @@ static void surface_notify( { DRISurfaceNotifyArg *arg = _arg; int client_index = (int) x_cvt_vptr_to_uint(data); - ClientPtr client; xAppleDRINotifyEvent se; if (client_index < 0 || client_index >= currentMaxClients) return; - client = clients[client_index]; - if (client == NULL || client == serverClient || client->clientGone) - return; - se.type = DRIEventBase + AppleDRISurfaceNotify; se.kind = arg->kind; se.arg = arg->id; - se.sequenceNumber = client->sequence; se.time = currentTime.milliseconds; - WriteEventsToClient (client, 1, (xEvent *) &se); + WriteEventsToClient (clients[client_index], 1, (xEvent *) &se); } static int diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c index d09e98352..99329c383 100755 --- a/hw/xwin/winwindowswm.c +++ b/hw/xwin/winwindowswm.c @@ -304,8 +304,7 @@ winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg, #if CYGMULTIWINDOW_DEBUG ErrorF ("winWindowsWMSendEvent - x%08x\n", (int) client); #endif - if ((pEvent->mask & mask) == 0 - || client == serverClient || client->clientGone) + if ((pEvent->mask & mask) == 0) { continue; } @@ -320,7 +319,6 @@ winWindowsWMSendEvent (int type, unsigned int mask, int which, int arg, se.y = y; se.w = w; se.h = h; - se.sequenceNumber = client->sequence; se.time = currentTime.milliseconds; WriteEventsToClient (client, 1, (xEvent *) &se); } diff --git a/include/resource.h b/include/resource.h index 96f852a8f..0c5a59dbc 100644 --- a/include/resource.h +++ b/include/resource.h @@ -157,6 +157,9 @@ typedef Bool (*FindComplexResType)( extern _X_EXPORT RESTYPE CreateNewResourceType( DeleteType /*deleteFunc*/, char * /*name*/); +extern _X_EXPORT void SetResourceTypeErrorValue( + RESTYPE /*type*/, int /*errorValue*/); + extern _X_EXPORT RESTYPE CreateNewResourceClass(void); extern _X_EXPORT Bool InitClientResources( diff --git a/mi/midispcur.c b/mi/midispcur.c index 1acc46933..61e313305 100644 --- a/mi/midispcur.c +++ b/mi/midispcur.c @@ -97,44 +97,6 @@ typedef struct { #endif } miDCCursorRec, *miDCCursorPtr; -/* - * sprite/cursor method table - */ - -static Bool miDCRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); -static Bool miDCUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); -static Bool miDCPutUpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, - CursorPtr pCursor, int x, int y, - unsigned long source, unsigned long mask); -static Bool miDCSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen, - int x, int y, - int w, int h); -static Bool miDCRestoreUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen, - int x, int y, - int w, int h); -static Bool miDCMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, - CursorPtr pCursor, int x, int y, - int w, int h, int dx, int dy, - unsigned long source, unsigned long mask); -static Bool miDCChangeSave(DeviceIntPtr pDev, ScreenPtr pScreen, - int x, int y, int w, int h, - int dx, int dy); - -static Bool miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen); -static void miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen); - -static miSpriteCursorFuncRec miDCFuncs = { - miDCRealizeCursor, - miDCUnrealizeCursor, - miDCPutUpCursor, - miDCSaveUnderCursor, - miDCRestoreUnderCursor, - miDCMoveCursor, - miDCChangeSave, - miDCDeviceInitialize, - miDCDeviceCleanup -}; - Bool miDCInitialize (ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs) { @@ -150,7 +112,7 @@ miDCInitialize (ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs) dixSetPrivate(&pScreen->devPrivates, miDCScreenKey, pScreenPriv); - if (!miSpriteInitialize (pScreen, &miDCFuncs, screenFuncs)) + if (!miSpriteInitialize (pScreen, screenFuncs)) { free((pointer) pScreenPriv); return FALSE; @@ -170,7 +132,7 @@ miDCCloseScreen (int index, ScreenPtr pScreen) return (*pScreen->CloseScreen) (index, pScreen); } -static Bool +Bool miDCRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) { if (pCursor->bits->refcnt <= 1) @@ -329,7 +291,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor) return pPriv; } -static Bool +Bool miDCUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor) { miDCCursorPtr pPriv; @@ -426,7 +388,7 @@ miDCMakeGC(WindowPtr pWin) } -static Bool +Bool miDCPutUpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y, unsigned long source, unsigned long mask) { @@ -471,7 +433,7 @@ miDCPutUpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, return TRUE; } -static Bool +Bool miDCSaveUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, int w, int h) { @@ -505,7 +467,7 @@ miDCSaveUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen, return TRUE; } -static Bool +Bool miDCRestoreUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, int w, int h) { @@ -532,7 +494,7 @@ miDCRestoreUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen, return TRUE; } -static Bool +Bool miDCChangeSave (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, int w, int h, int dx, int dy) { @@ -665,7 +627,7 @@ miDCChangeSave (DeviceIntPtr pDev, ScreenPtr pScreen, return TRUE; } -static Bool +Bool miDCMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y, int w, int h, int dx, int dy, unsigned long source, unsigned long mask) @@ -764,7 +726,7 @@ miDCMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, return TRUE; } -static Bool +Bool miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) { miDCBufferPtr pBuffer; @@ -839,7 +801,7 @@ failure: return FALSE; } -static void +void miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen) { miDCBufferPtr pBuffer; diff --git a/mi/miexpose.c b/mi/miexpose.c index a50dc5e03..57968dd2a 100644 --- a/mi/miexpose.c +++ b/mi/miexpose.c @@ -374,6 +374,8 @@ miSendGraphicsExpose (ClientPtr client, RegionPtr pRgn, XID drawable, pe->u.graphicsExposure.majorEvent = major; pe->u.graphicsExposure.minorEvent = minor; } + /* GraphicsExpose is a "critical event", which TryClientEvents + * handles specially. */ TryClientEvents(client, NULL, pEvent, numRects, (Mask)0, NoEventMask, NullGrab); free(pEvent); @@ -386,8 +388,7 @@ miSendGraphicsExpose (ClientPtr client, RegionPtr pRgn, XID drawable, event.u.noExposure.drawable = drawable; event.u.noExposure.majorEvent = major; event.u.noExposure.minorEvent = minor; - TryClientEvents(client, NULL, &event, 1, - (Mask)0, NoEventMask, NullGrab); + WriteEventsToClient(client, 1, &event); } } diff --git a/mi/misprite.c b/mi/misprite.c index 9f10a2b0d..3d10bc819 100644 --- a/mi/misprite.c +++ b/mi/misprite.c @@ -94,7 +94,6 @@ typedef struct { ColormapPtr pInstalledMap; ColormapPtr pColormap; VisualPtr pVisual; - miSpriteCursorFuncPtr funcs; DamagePtr pDamage; /* damage tracking structure */ Bool damageRegistered; } miSpriteScreenRec, *miSpriteScreenPtr; @@ -258,12 +257,9 @@ static void miSpriteReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure) { ScreenPtr pScreen = closure; - miSpriteScreenPtr pScreenPriv; miCursorInfoPtr pCursorInfo; DeviceIntPtr pDev; - pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); - for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (DevHasCursor(pDev)) @@ -289,7 +285,6 @@ miSpriteReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure) Bool miSpriteInitialize (ScreenPtr pScreen, - miSpriteCursorFuncPtr cursorFuncs, miPointerScreenFuncPtr screenFuncs) { miSpriteScreenPtr pScreenPriv; @@ -336,7 +331,6 @@ miSpriteInitialize (ScreenPtr pScreen, pScreenPriv->pInstalledMap = NULL; pScreenPriv->pColormap = NULL; - pScreenPriv->funcs = cursorFuncs; pScreenPriv->colors[SOURCE_COLOR].red = 0; pScreenPriv->colors[SOURCE_COLOR].green = 0; pScreenPriv->colors[SOURCE_COLOR].blue = 0; @@ -397,7 +391,6 @@ miSpriteGetImage (DrawablePtr pDrawable, int sx, int sy, int w, int h, char *pdstLine) { ScreenPtr pScreen = pDrawable->pScreen; - miSpriteScreenPtr pScreenPriv; DeviceIntPtr pDev; miCursorInfoPtr pCursorInfo; @@ -405,7 +398,6 @@ miSpriteGetImage (DrawablePtr pDrawable, int sx, int sy, int w, int h, if (pDrawable->type == DRAWABLE_WINDOW) { - pScreenPriv = dixLookupPrivate(&pScreen->devPrivates,miSpriteScreenKey); for(pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (DevHasCursor(pDev)) @@ -433,7 +425,6 @@ miSpriteGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart) { ScreenPtr pScreen = pDrawable->pScreen; - miSpriteScreenPtr pScreenPriv; DeviceIntPtr pDev; miCursorInfoPtr pCursorInfo; @@ -441,8 +432,6 @@ miSpriteGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, if (pDrawable->type == DRAWABLE_WINDOW) { - pScreenPriv = dixLookupPrivate(&pScreen->devPrivates,miSpriteScreenKey); - for(pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (DevHasCursor(pDev)) @@ -487,7 +476,6 @@ miSpriteSourceValidate (DrawablePtr pDrawable, int x, int y, int width, int height) { ScreenPtr pScreen = pDrawable->pScreen; - miSpriteScreenPtr pScreenPriv; DeviceIntPtr pDev; miCursorInfoPtr pCursorInfo; @@ -495,8 +483,6 @@ miSpriteSourceValidate (DrawablePtr pDrawable, int x, int y, int width, if (pDrawable->type == DRAWABLE_WINDOW) { - pScreenPriv = dixLookupPrivate(&pScreen->devPrivates,miSpriteScreenKey); - for(pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (DevHasCursor(pDev)) @@ -523,14 +509,11 @@ static void miSpriteCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { ScreenPtr pScreen = pWindow->drawable.pScreen; - miSpriteScreenPtr pScreenPriv; DeviceIntPtr pDev; miCursorInfoPtr pCursorInfo; SCREEN_PROLOGUE (pScreen, CopyWindow); - pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); - for(pDev = inputInfo.devices; pDev; pDev = pDev->next) { if (DevHasCursor(pDev)) @@ -760,10 +743,8 @@ miSpriteFindColors (miCursorInfoPtr pDevCursor, ScreenPtr pScreen) static Bool miSpriteRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { - miSpriteScreenPtr pScreenPriv; miCursorInfoPtr pCursorInfo; - pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); if (!IsMaster(pDev) && !pDev->u.master) return FALSE; @@ -772,27 +753,21 @@ miSpriteRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) if (pCursor == pCursorInfo->pCursor) pCursorInfo->checkPixels = TRUE; - return (*pScreenPriv->funcs->RealizeCursor) (pScreen, pCursor); + return miDCRealizeCursor(pScreen, pCursor); } static Bool miSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { - miSpriteScreenPtr pScreenPriv; - - pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); - return (*pScreenPriv->funcs->UnrealizeCursor) (pScreen, pCursor); + return miDCUnrealizeCursor(pScreen, pCursor); } static void miSpriteSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y) { - miSpriteScreenPtr pScreenPriv; miCursorInfoPtr pPointer; - pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); - if (!IsMaster(pDev) && !pDev->u.master) return; @@ -861,7 +836,7 @@ miSpriteSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen, pointer->saved.y1 -= dy; pointer->saved.x2 -= dx; pointer->saved.y2 -= dy; - (void) (*pScreenPriv->funcs->ChangeSave) (pScreen, + (void) miDCChangeSave(pScreen, pointer->saved.x1, pointer->saved.y1, pointer->saved.x2 - @@ -870,7 +845,7 @@ miSpriteSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen, pointer->saved.y1, dx, dy); } - (void) (*pScreenPriv->funcs->MoveCursor) (pScreen, pCursor, + (void) miDCMoveCursor(pScreen, pCursor, pointer->saved.x1, pointer->saved.y1, pointer->saved.x2 - @@ -904,10 +879,8 @@ miSpriteSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen, static void miSpriteMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) { - miSpriteScreenPtr pScreenPriv; CursorPtr pCursor; - pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); if (!IsMaster(pDev) && !pDev->u.master) return; @@ -920,12 +893,9 @@ miSpriteMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) static Bool miSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) { - miSpriteScreenPtr pScreenPriv; miCursorInfoPtr pCursorInfo; int ret = FALSE; - pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); - pCursorInfo = malloc(sizeof(miCursorInfoRec)); if (!pCursorInfo) return FALSE; @@ -940,7 +910,7 @@ miSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) pCursorInfo->checkPixels = TRUE; pCursorInfo->pScreen = FALSE; - ret = (*pScreenPriv->funcs->DeviceCursorInitialize)(pDev, pScreen); + ret = miDCDeviceInitialize(pDev, pScreen); if (!ret) { free(pCursorInfo); @@ -954,13 +924,7 @@ static void miSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen) { if (DevHasCursor(pDev)) - { - miSpriteScreenPtr pScreenPriv; - pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, - miSpriteScreenKey); - - (*pScreenPriv->funcs->DeviceCursorCleanup)(pDev, pScreen); - } + miDCDeviceCleanup(pDev, pScreen); } /* @@ -984,16 +948,16 @@ miSpriteRemoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen) miSpriteIsDown(pCursorInfo); pCursorInfo->pCacheWin = NullWindow; miSpriteDisableDamage(pScreen, pScreenPriv); - if (!(*pScreenPriv->funcs->RestoreUnderCursor) (pDev, - pScreen, - pCursorInfo->saved.x1, - pCursorInfo->saved.y1, - pCursorInfo->saved.x2 - - pCursorInfo->saved.x1, - pCursorInfo->saved.y2 - - pCursorInfo->saved.y1)) + if (!miDCRestoreUnderCursor(pDev, + pScreen, + pCursorInfo->saved.x1, + pCursorInfo->saved.y1, + pCursorInfo->saved.x2 - + pCursorInfo->saved.x1, + pCursorInfo->saved.y2 - + pCursorInfo->saved.y1)) { - miSpriteIsUp(pCursorInfo); + miSpriteIsUp(pCursorInfo); } miSpriteEnableDamage(pScreen, pScreenPriv); DamageDrawInternal (pScreen, FALSE); @@ -1026,14 +990,14 @@ miSpriteSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen) y = pCursorInfo->y - (int)pCursor->bits->yhot; miSpriteDisableDamage(pScreen, pScreenPriv); - (*pScreenPriv->funcs->SaveUnderCursor) (pDev, - pScreen, - pCursorInfo->saved.x1, - pCursorInfo->saved.y1, - pCursorInfo->saved.x2 - - pCursorInfo->saved.x1, - pCursorInfo->saved.y2 - - pCursorInfo->saved.y1); + miDCSaveUnderCursor(pDev, + pScreen, + pCursorInfo->saved.x1, + pCursorInfo->saved.y1, + pCursorInfo->saved.x2 - + pCursorInfo->saved.x1, + pCursorInfo->saved.y2 - + pCursorInfo->saved.y1); SPRITE_DEBUG(("SaveUnderCursor %d\n", pDev->id)); miSpriteEnableDamage(pScreen, pScreenPriv); DamageDrawInternal (pScreen, FALSE); @@ -1069,7 +1033,7 @@ miSpriteRestoreCursor (DeviceIntPtr pDev, ScreenPtr pScreen) SPRITE_DEBUG(("RestoreCursor %d\n", pDev->id)); if (pCursorInfo->checkPixels) miSpriteFindColors (pCursorInfo, pScreen); - if ((*pScreenPriv->funcs->PutUpCursor) (pDev, pScreen, + if (miDCPutUpCursor(pDev, pScreen, pCursor, x, y, pScreenPriv->colors[SOURCE_COLOR].pixel, pScreenPriv->colors[MASK_COLOR].pixel)) @@ -1088,7 +1052,6 @@ miSpriteRestoreCursor (DeviceIntPtr pDev, ScreenPtr pScreen) static void miSpriteComputeSaved (DeviceIntPtr pDev, ScreenPtr pScreen) { - miSpriteScreenPtr pScreenPriv; int x, y, w, h; int wpad, hpad; CursorPtr pCursor; @@ -1097,7 +1060,6 @@ miSpriteComputeSaved (DeviceIntPtr pDev, ScreenPtr pScreen) if (!IsMaster(pDev) && !pDev->u.master) return; - pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); pCursorInfo = MISPRITE(pDev); pCursor = pCursorInfo->pCursor; diff --git a/mi/misprite.h b/mi/misprite.h index 72dc06fc7..78bf52cd4 100644 --- a/mi/misprite.h +++ b/mi/misprite.h @@ -32,76 +32,26 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -typedef struct { - Bool (*RealizeCursor)( - ScreenPtr /*pScreen*/, - CursorPtr /*pCursor*/ -); - Bool (*UnrealizeCursor)( - ScreenPtr /*pScreen*/, - CursorPtr /*pCursor*/ -); - Bool (*PutUpCursor)( - DeviceIntPtr /*pDev*/, - ScreenPtr /*pScreen*/, - CursorPtr /*pCursor*/, - int /*x*/, - int /*y*/, - unsigned long /*source*/, - unsigned long /*mask*/ -); - Bool (*SaveUnderCursor)( - DeviceIntPtr /*pDev*/, - ScreenPtr /*pScreen*/, - int /*x*/, - int /*y*/, - int /*w*/, - int /*h*/ -); - Bool (*RestoreUnderCursor)( - DeviceIntPtr /*pDev*/, - ScreenPtr /*pScreen*/, - int /*x*/, - int /*y*/, - int /*w*/, - int /*h*/ -); - Bool (*MoveCursor)( - DeviceIntPtr /*pDev*/, - ScreenPtr /*pScreen*/, - CursorPtr /*pCursor*/, - int /*x*/, - int /*y*/, - int /*w*/, - int /*h*/, - int /*dx*/, - int /*dy*/, - unsigned long /*source*/, - unsigned long /*mask*/ -); - Bool (*ChangeSave)( - DeviceIntPtr /*pDev*/, - ScreenPtr /*pScreen*/, - int /*x*/, - int /*y*/, - int /*w*/, - int /*h*/, - int /*dx*/, - int /*dy*/ -); - Bool (*DeviceCursorInitialize)( - DeviceIntPtr /*pDev*/, - ScreenPtr /*pScreen*/ -); - void (*DeviceCursorCleanup)( - DeviceIntPtr /*pDev*/, - ScreenPtr /*pScreen*/ -); - -} miSpriteCursorFuncRec, *miSpriteCursorFuncPtr; - extern Bool miSpriteInitialize( ScreenPtr /*pScreen*/, - miSpriteCursorFuncPtr /*cursorFuncs*/, miPointerScreenFuncPtr /*screenFuncs*/ ); + +extern Bool miDCRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); +extern Bool miDCUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor); +extern Bool miDCPutUpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCursor, int x, int y, + unsigned long source, unsigned long mask); +extern Bool miDCSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen, + int x, int y, int w, int h); +extern Bool miDCRestoreUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen, + int x, int y, int w, int h); +extern Bool miDCMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, + CursorPtr pCursor, int x, int y, + int w, int h, int dx, int dy, + unsigned long source, unsigned long mask); +extern Bool miDCChangeSave(DeviceIntPtr pDev, ScreenPtr pScreen, + int x, int y, int w, int h, + int dx, int dy); +extern Bool miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen); +extern void miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen); @@ -698,15 +698,17 @@ SetCriticalOutputPending(void) int WriteToClient (ClientPtr who, int count, const void *__buf) { - OsCommPtr oc = (OsCommPtr)who->osPrivate; - ConnectionOutputPtr oco = oc->output; + OsCommPtr oc; + ConnectionOutputPtr oco; int padBytes; const char *buf = __buf; #ifdef DEBUG_COMMUNICATION Bool multicount = FALSE; #endif - if (!count) + if (!count || !who || who == serverClient || who->clientGone) return(0); + oc = who->osPrivate; + oco = oc->output; #ifdef DEBUG_COMMUNICATION { char info[128]; diff --git a/randr/randrstr.h b/randr/randrstr.h index b163a73da..a18c834e9 100644 --- a/randr/randrstr.h +++ b/randr/randrstr.h @@ -344,7 +344,7 @@ extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType; RROutputType, client, a);\ if (rc != Success) {\ client->errorValue = id;\ - return (rc == BadValue) ? RRErrorBase + BadRROutput : rc;\ + return rc;\ }\ } @@ -354,7 +354,7 @@ extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType; RRCrtcType, client, a);\ if (rc != Success) {\ client->errorValue = id;\ - return (rc == BadValue) ? RRErrorBase + BadRRCrtc : rc;\ + return rc;\ }\ } @@ -364,7 +364,7 @@ extern _X_EXPORT RESTYPE RRCrtcType, RRModeType, RROutputType; RRModeType, client, a);\ if (rc != Success) {\ client->errorValue = id;\ - return (rc == BadValue) ? RRErrorBase + BadRRMode : rc;\ + return rc;\ }\ } diff --git a/randr/rrcrtc.c b/randr/rrcrtc.c index 854353533..987f77233 100644 --- a/randr/rrcrtc.c +++ b/randr/rrcrtc.c @@ -254,7 +254,6 @@ RRDeliverCrtcEvent (ClientPtr client, WindowPtr pWin, RRCrtcPtr crtc) ce.type = RRNotify + RREventBase; ce.subCode = RRNotify_CrtcChange; - ce.sequenceNumber = client->sequence; ce.timestamp = pScrPriv->lastSetTime.milliseconds; ce.window = pWin->drawable.id; ce.crtc = crtc->id; @@ -635,6 +634,7 @@ RRCrtcInit (void) RRCrtcType = CreateNewResourceType (RRCrtcDestroyResource, "CRTC"); if (!RRCrtcType) return FALSE; + SetResourceTypeErrorValue(RRCrtcType, RRErrorBase + BadRRCrtc); return TRUE; } @@ -807,7 +807,7 @@ ProcRRSetCrtcConfig (ClientPtr client) { if (outputs) free(outputs); - return (rc == BadValue) ? RRErrorBase + BadRROutput : rc; + return rc; } /* validate crtc for this output */ for (j = 0; j < outputs[i]->numCrtcs; j++) diff --git a/randr/rrmode.c b/randr/rrmode.c index e73d1acd8..deddd3c0c 100644 --- a/randr/rrmode.c +++ b/randr/rrmode.c @@ -268,6 +268,7 @@ RRModeInit (void) RRModeType = CreateNewResourceType (RRModeDestroyResource, "MODE"); if (!RRModeType) return FALSE; + SetResourceTypeErrorValue(RRModeType, RRErrorBase + BadRRMode); return TRUE; } diff --git a/randr/rroutput.c b/randr/rroutput.c index e9ab2b904..7822c0dc3 100644 --- a/randr/rroutput.c +++ b/randr/rroutput.c @@ -337,7 +337,6 @@ RRDeliverOutputEvent(ClientPtr client, WindowPtr pWin, RROutputPtr output) oe.type = RRNotify + RREventBase; oe.subCode = RRNotify_OutputChange; - oe.sequenceNumber = client->sequence; oe.timestamp = pScrPriv->lastSetTime.milliseconds; oe.configTimestamp = pScrPriv->lastConfigTime.milliseconds; oe.window = pWin->drawable.id; @@ -424,6 +423,7 @@ RROutputInit (void) RROutputType = CreateNewResourceType (RROutputDestroyResource, "OUTPUT"); if (!RROutputType) return FALSE; + SetResourceTypeErrorValue(RROutputType, RRErrorBase + BadRROutput); return TRUE; } diff --git a/randr/rrproperty.c b/randr/rrproperty.c index ff0bca014..5e37577b8 100644 --- a/randr/rrproperty.c +++ b/randr/rrproperty.c @@ -29,7 +29,6 @@ DeliverPropertyEvent(WindowPtr pWin, void *value) { xRROutputPropertyNotifyEvent *event = value; RREventPtr *pHead, pRREvent; - ClientPtr client; dixLookupResourceByType((pointer *)&pHead, pWin->drawable.id, RREventType, serverClient, DixReadAccess); @@ -38,14 +37,9 @@ DeliverPropertyEvent(WindowPtr pWin, void *value) for (pRREvent = *pHead; pRREvent; pRREvent = pRREvent->next) { - client = pRREvent->client; - if (client == serverClient || client->clientGone) - continue; - if (!(pRREvent->mask & RROutputPropertyNotifyMask)) continue; - event->sequenceNumber = client->sequence; event->window = pRREvent->window->drawable.id; WriteEventsToClient(pRREvent->client, 1, (xEvent *)event); } diff --git a/randr/rrscreen.c b/randr/rrscreen.c index 051d51410..a940f8aae 100644 --- a/randr/rrscreen.c +++ b/randr/rrscreen.c @@ -102,13 +102,11 @@ RRDeliverScreenEvent (ClientPtr client, WindowPtr pWin, ScreenPtr pScreen) se.type = RRScreenChangeNotify + RREventBase; se.rotation = (CARD8) (crtc ? crtc->rotation : RR_Rotate_0); se.timestamp = pScrPriv->lastSetTime.milliseconds; - se.sequenceNumber = client->sequence; se.configTimestamp = pScrPriv->lastConfigTime.milliseconds; se.root = pRoot->drawable.id; se.window = pWin->drawable.id; se.subpixelOrder = PictureGetSubpixelOrder (pScreen); - se.sequenceNumber = client->sequence; se.sizeID = RR10CurrentSizeID (pScreen); if (se.rotation & (RR_Rotate_90 | RR_Rotate_270)) { diff --git a/record/record.c b/record/record.c index 1b55d6bf0..3724dc7a9 100644 --- a/record/record.c +++ b/record/record.c @@ -58,7 +58,6 @@ and Jim Haggerty of Metheus. #include "protocol-versions.h" static RESTYPE RTContext; /* internal resource type for Record contexts */ -static int RecordErrorBase; /* first Record error number */ /* How many bytes of protocol data to buffer in a context. Don't set to less * than 32. @@ -133,7 +132,7 @@ static int numEnabledRCAPs; int rc = dixLookupResourceByType((pointer *)&(_pContext), _contextid, \ RTContext, _client, DixUseAccess); \ if (rc != Success) \ - return (rc == BadValue) ? RecordErrorBase + XRecordBadContext : rc; \ + return rc; \ } static int RecordDeleteContext( @@ -2911,7 +2910,7 @@ RecordExtensionInit(void) DeleteCallback(&ClientStateCallback, RecordAClientStateChange, NULL); return; } - RecordErrorBase = extentry->errorBase; + SetResourceTypeErrorValue(RTContext, extentry->errorBase + XRecordBadContext); } /* RecordExtensionInit */ diff --git a/render/picture.c b/render/picture.c index aab939100..211fa38b3 100644 --- a/render/picture.c +++ b/render/picture.c @@ -1115,7 +1115,6 @@ ChangePicture (PicturePtr pPicture, if (error != Success) { client->errorValue = pid; - error = (error == BadValue) ? RenderErrBase + BadPicture : error; break; } if (pAlpha->pDrawable == NULL || @@ -1176,7 +1175,6 @@ ChangePicture (PicturePtr pPicture, if (error != Success) { client->errorValue = pid; - error = (error == BadValue) ? BadPixmap : error; break; } } diff --git a/render/picturestr.h b/render/picturestr.h index 5a796f441..a4011082b 100644 --- a/render/picturestr.h +++ b/render/picturestr.h @@ -412,7 +412,7 @@ extern _X_EXPORT RESTYPE GlyphSetType; int rc = dixLookupResourceByType((pointer)&(pPicture), pid,\ PictureType, client, mode);\ if (rc != Success)\ - return (rc == BadValue) ? RenderErrBase + BadPicture : rc;\ + return rc;\ } #define VERIFY_ALPHA(pPicture, pid, client, mode) {\ diff --git a/render/render.c b/render/render.c index 9aabcfb20..b58dd3ebe 100644 --- a/render/render.c +++ b/render/render.c @@ -233,6 +233,10 @@ RenderClientCallback (CallbackListPtr *list, pRenderClient->minor_version = 0; } +#ifdef PANORAMIX +unsigned long XRT_PICTURE; +#endif + void RenderExtensionInit (void) { @@ -253,6 +257,13 @@ RenderExtensionInit (void) if (!extEntry) return; RenderErrBase = extEntry->errorBase; +#ifdef PANORAMIX + if (XRT_PICTURE) + SetResourceTypeErrorValue(XRT_PICTURE, RenderErrBase + BadPicture); +#endif + SetResourceTypeErrorValue(PictureType, RenderErrBase + BadPicture); + SetResourceTypeErrorValue(PictFormatType, RenderErrBase + BadPictFormat); + SetResourceTypeErrorValue(GlyphSetType, RenderErrBase + BadGlyphSet); } static int @@ -532,7 +543,7 @@ ProcRenderQueryPictIndexValues (ClientPtr client) rc = dixLookupResourceByType((pointer *)&pFormat, stuff->format, PictFormatType, client, DixReadAccess); if (rc != Success) - return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; + return rc; if (pFormat->type != PictTypeIndexed) { @@ -601,7 +612,7 @@ ProcRenderCreatePicture (ClientPtr client) rc = dixLookupResourceByType((pointer *)&pFormat, stuff->format, PictFormatType, client, DixReadAccess); if (rc != Success) - return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; + return rc; if (pFormat->depth != pDrawable->depth) return BadMatch; @@ -755,7 +766,7 @@ ProcRenderTrapezoids (ClientPtr client) rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat, PictFormatType, client, DixReadAccess); if (rc != Success) - return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; + return rc; } else pFormat = 0; @@ -795,7 +806,7 @@ ProcRenderTriangles (ClientPtr client) rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat, PictFormatType, client, DixReadAccess); if (rc != Success) - return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; + return rc; } else pFormat = 0; @@ -835,7 +846,7 @@ ProcRenderTriStrip (ClientPtr client) rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat, PictFormatType, client, DixReadAccess); if (rc != Success) - return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; + return rc; } else pFormat = 0; @@ -875,7 +886,7 @@ ProcRenderTriFan (ClientPtr client) rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat, PictFormatType, client, DixReadAccess); if (rc != Success) - return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; + return rc; } else pFormat = 0; @@ -922,7 +933,7 @@ ProcRenderCreateGlyphSet (ClientPtr client) rc = dixLookupResourceByType((pointer *)&format, stuff->format, PictFormatType, client, DixReadAccess); if (rc != Success) - return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; + return rc; switch (format->depth) { case 1: @@ -974,7 +985,7 @@ ProcRenderReferenceGlyphSet (ClientPtr client) if (rc != Success) { client->errorValue = stuff->existing; - return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc; + return rc; } glyphSet->refcnt++; if (!AddResource (stuff->gsid, GlyphSetType, (pointer)glyphSet)) @@ -998,7 +1009,7 @@ ProcRenderFreeGlyphSet (ClientPtr client) if (rc != Success) { client->errorValue = stuff->glyphset; - return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc; + return rc; } FreeResource (stuff->glyphset, RT_NONE); return Success; @@ -1037,7 +1048,7 @@ ProcRenderAddGlyphs (ClientPtr client) if (err != Success) { client->errorValue = stuff->glyphset; - return (err == BadValue) ? RenderErrBase + BadGlyphSet : err; + return err; } err = BadAlloc; @@ -1238,7 +1249,7 @@ ProcRenderFreeGlyphs (ClientPtr client) if (rc != Success) { client->errorValue = stuff->glyphset; - return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc; + return rc; } nglyph = bytes_to_int32((client->req_len << 2) - sizeof (xRenderFreeGlyphsReq)); gids = (CARD32 *) (stuff + 1); @@ -1300,7 +1311,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) rc = dixLookupResourceByType((pointer *)&pFormat, stuff->maskFormat, PictFormatType, client, DixReadAccess); if (rc != Success) - return (rc == BadValue) ? RenderErrBase + BadPictFormat : rc; + return rc; } else pFormat = 0; @@ -1308,7 +1319,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) rc = dixLookupResourceByType((pointer *)&glyphSet, stuff->glyphset, GlyphSetType, client, DixUseAccess); if (rc != Success) - return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc; + return rc; buffer = (CARD8 *) (stuff + 1); end = (CARD8 *) stuff + (client->req_len << 2); @@ -1371,7 +1382,7 @@ ProcRenderCompositeGlyphs (ClientPtr client) free(glyphsBase); if (listsBase != listsLocal) free(listsBase); - return (rc == BadValue) ? RenderErrBase + BadGlyphSet : rc; + return rc; } } buffer += 4; @@ -1856,7 +1867,7 @@ ProcRenderCreateAnimCursor (ClientPtr client) if (ret != Success) { free(cursors); - return (ret == BadValue) ? BadCursor : ret; + return ret; } deltas[i] = elt->delay; elt++; @@ -2639,7 +2650,7 @@ SProcRenderDispatch (ClientPtr client) int rc = dixLookupResourceByType((pointer *)&(pPicture), pid,\ XRT_PICTURE, client, mode);\ if (rc != Success)\ - return (rc == BadValue) ? RenderErrBase + BadPicture : rc;\ + return rc;\ } #define VERIFY_XIN_ALPHA(pPicture, pid, client, mode) {\ @@ -2652,8 +2663,6 @@ SProcRenderDispatch (ClientPtr client) int (*PanoramiXSaveRenderVector[RenderNumberRequests])(ClientPtr); -unsigned long XRT_PICTURE; - static int PanoramiXRenderCreatePicture (ClientPtr client) { @@ -3330,6 +3339,8 @@ PanoramiXRenderInit (void) XRT_PICTURE = CreateNewResourceType (XineramaDeleteResource, "XineramaPicture"); + if (RenderErrBase) + SetResourceTypeErrorValue(XRT_PICTURE, RenderErrBase + BadPicture); for (i = 0; i < RenderNumberRequests; i++) PanoramiXSaveRenderVector[i] = ProcRenderVector[i]; /* @@ -3365,6 +3376,7 @@ PanoramiXRenderReset (void) int i; for (i = 0; i < RenderNumberRequests; i++) ProcRenderVector[i] = PanoramiXSaveRenderVector[i]; + RenderErrBase = 0; } #endif /* PANORAMIX */ diff --git a/xfixes/cursor.c b/xfixes/cursor.c index d5f8b290b..52bdb27f6 100644 --- a/xfixes/cursor.c +++ b/xfixes/cursor.c @@ -70,10 +70,7 @@ static void deleteCursorHideCountsForScreen (ScreenPtr pScreen); int err; \ err = dixLookupResourceByType((pointer *) &pCursor, cursor, \ RT_CURSOR, client, access); \ - if (err == BadValue) { \ - client->errorValue = cursor; \ - return BadCursor; \ - } else if (err != Success) { \ + if (err != Success) { \ client->errorValue = cursor; \ return err; \ } \ @@ -164,13 +161,11 @@ CursorDisplayCursor (DeviceIntPtr pDev, CursorCurrent[pDev->id] = pCursor; for (e = cursorEvents; e; e = e->next) { - if ((e->eventMask & XFixesDisplayCursorNotifyMask) && - !e->pClient->clientGone) + if ((e->eventMask & XFixesDisplayCursorNotifyMask)) { xXFixesCursorNotifyEvent ev; ev.type = XFixesEventBase + XFixesCursorNotify; ev.subtype = XFixesDisplayCursorNotify; - ev.sequenceNumber = e->pClient->sequence; ev.window = e->pWindow->drawable.id; ev.cursorSerial = pCursor->serialNumber; ev.timestamp = currentTime.milliseconds; @@ -884,7 +879,7 @@ ProcXFixesHideCursor (ClientPtr client) client, DixGetAttrAccess); if (ret != Success) { client->errorValue = stuff->window; - return (ret == BadValue) ? BadWindow : ret; + return ret; } /* @@ -947,7 +942,7 @@ ProcXFixesShowCursor (ClientPtr client) client, DixGetAttrAccess); if (rc != Success) { client->errorValue = stuff->window; - return (rc == BadValue) ? BadWindow : rc; + return rc; } /* diff --git a/xfixes/region.c b/xfixes/region.c index 5f0c2c432..7a71c78f9 100644 --- a/xfixes/region.c +++ b/xfixes/region.c @@ -119,7 +119,7 @@ ProcXFixesCreateRegionFromBitmap (ClientPtr client) if (rc != Success) { client->errorValue = stuff->bitmap; - return (rc == BadValue) ? BadPixmap : rc; + return rc; } if (pPixmap->drawable.depth != 1) return BadMatch; @@ -164,7 +164,7 @@ ProcXFixesCreateRegionFromWindow (ClientPtr client) if (rc != Success) { client->errorValue = stuff->window; - return (rc == BadValue) ? BadWindow : rc; + return rc; } switch (stuff->kind) { case WindowRegionBounding: @@ -675,7 +675,7 @@ ProcXFixesSetWindowShapeRegion (ClientPtr client) if (rc != Success) { client->errorValue = stuff->dest; - return (rc == BadValue) ? BadWindow : rc; + return rc; } VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixWriteAccess); pScreen = pWin->drawable.pScreen; diff --git a/xfixes/select.c b/xfixes/select.c index 6d86f63af..3aa26d365 100644 --- a/xfixes/select.c +++ b/xfixes/select.c @@ -78,15 +78,13 @@ XFixesSelectionCallback (CallbackListPtr *callbacks, pointer data, pointer args) for (e = selectionEvents; e; e = e->next) { if (e->selection == selection->selection && - (e->eventMask & eventMask) && - !e->pClient->clientGone) + (e->eventMask & eventMask)) { xXFixesSelectionNotifyEvent ev; memset(&ev, 0, sizeof(xXFixesSelectionNotifyEvent)); ev.type = XFixesEventBase + XFixesSelectionNotify; ev.subtype = subtype; - ev.sequenceNumber = e->pClient->sequence; ev.window = e->pWindow->drawable.id; if (subtype == XFixesSetSelectionOwnerNotify) ev.owner = selection->window; diff --git a/xfixes/xfixes.c b/xfixes/xfixes.c index 49ed5a0d5..2f64a04f7 100644 --- a/xfixes/xfixes.c +++ b/xfixes/xfixes.c @@ -259,5 +259,6 @@ XFixesExtensionInit(void) (EventSwapPtr) SXFixesSelectionNotifyEvent; EventSwapVector[XFixesEventBase + XFixesCursorNotify] = (EventSwapPtr) SXFixesCursorNotifyEvent; + SetResourceTypeErrorValue(RegionResType, XFixesErrorBase + BadRegion); } } diff --git a/xfixes/xfixes.h b/xfixes/xfixes.h index 69d162ffe..1638350c2 100644 --- a/xfixes/xfixes.h +++ b/xfixes/xfixes.h @@ -37,10 +37,7 @@ extern _X_EXPORT int XFixesErrorBase; int err; \ err = dixLookupResourceByType((pointer *) &pRegion, rid, \ RegionResType, client, mode); \ - if (err == BadValue) { \ - client->errorValue = rid; \ - return XFixesErrorBase + BadRegion; \ - } else if (err != Success) { \ + if (err != Success) { \ client->errorValue = rid; \ return err; \ } \ diff --git a/xkb/xkbEvents.c b/xkb/xkbEvents.c index 0a6a76c10..8028502b9 100644 --- a/xkb/xkbEvents.c +++ b/xkb/xkbEvents.c @@ -102,7 +102,6 @@ XkbSendLegacyMapNotify(DeviceIntPtr kbd, CARD16 xkb_event, CARD16 changed, if (!XIShouldNotify(clients[i], kbd)) continue; - core_mn.u.u.sequenceNumber = clients[i]->sequence; if (keymap_changed) { core_mn.u.mappingNotify.request = MappingKeyboard; |