diff options
author | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2010-12-05 15:36:12 +0000 |
---|---|---|
committer | Matthieu Herrb <matthieu@cvs.openbsd.org> | 2010-12-05 15:36:12 +0000 |
commit | a90ee792d96752ad1b71b9ada922fa6afe478c99 (patch) | |
tree | 6143b00f7646951d23dfe2a4fe2992ca40b77069 /xserver/mi/miexpose.c | |
parent | bc97d4ecc0aa9e1b823565b07282f848700bd11a (diff) |
Upgrade to xorg-server 1.9.2.
Tested by ajacoutot@, krw@, shadchin@ and jasper@ on various configurations
including multihead with both zaphod and xrandr.
Diffstat (limited to 'xserver/mi/miexpose.c')
-rw-r--r-- | xserver/mi/miexpose.c | 154 |
1 files changed, 76 insertions, 78 deletions
diff --git a/xserver/mi/miexpose.c b/xserver/mi/miexpose.c index f52b49211..94258b864 100644 --- a/xserver/mi/miexpose.c +++ b/xserver/mi/miexpose.c @@ -131,7 +131,6 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty, unsigned long plane) { - ScreenPtr pscr; RegionPtr prgnSrcClip; /* drawable-relative source clip */ RegionRec rgnSrcRec; RegionPtr prgnDstClip; /* drawable-relative dest clip */ @@ -148,9 +147,6 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, BoxRec expBox; Bool extents; - /* This prevents warning about pscr not being used. */ - pGC->pScreen = pscr = pGC->pScreen; - /* avoid work if we can */ if (!pGC->graphicsExposures && (pDstDrawable->type == DRAWABLE_PIXMAP) && @@ -175,21 +171,21 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, if (pGC->subWindowMode == IncludeInferiors) { prgnSrcClip = NotClippedByChildren (pSrcWin); - if ((RECT_IN_REGION(pscr, prgnSrcClip, &TsrcBox)) == rgnIN) + if ((RegionContainsRect(prgnSrcClip, &TsrcBox)) == rgnIN) { - REGION_DESTROY(pscr, prgnSrcClip); + RegionDestroy(prgnSrcClip); return NULL; } } else { - if ((RECT_IN_REGION(pscr, &pSrcWin->clipList, &TsrcBox)) == rgnIN) + if ((RegionContainsRect(&pSrcWin->clipList, &TsrcBox)) == rgnIN) return NULL; prgnSrcClip = &rgnSrcRec; - REGION_NULL(pscr, prgnSrcClip); - REGION_COPY(pscr, prgnSrcClip, &pSrcWin->clipList); + RegionNull(prgnSrcClip); + RegionCopy(prgnSrcClip, &pSrcWin->clipList); } - REGION_TRANSLATE(pscr, prgnSrcClip, + RegionTranslate(prgnSrcClip, -pSrcDrawable->x, -pSrcDrawable->y); } else @@ -206,7 +202,7 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, box.x2 = pSrcDrawable->width; box.y2 = pSrcDrawable->height; prgnSrcClip = &rgnSrcRec; - REGION_INIT(pscr, prgnSrcClip, &box, 1); + RegionInit(prgnSrcClip, &box, 1); pSrcWin = NULL; } @@ -223,11 +219,11 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, else { prgnDstClip = &rgnDstRec; - REGION_NULL(pscr, prgnDstClip); - REGION_COPY(pscr, prgnDstClip, + RegionNull(prgnDstClip); + RegionCopy(prgnDstClip, &((WindowPtr)pDstDrawable)->clipList); } - REGION_TRANSLATE(pscr, prgnDstClip, + RegionTranslate(prgnDstClip, -pDstDrawable->x, -pDstDrawable->y); } else @@ -239,24 +235,24 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, box.x2 = pDstDrawable->width; box.y2 = pDstDrawable->height; prgnDstClip = &rgnDstRec; - REGION_INIT(pscr, prgnDstClip, &box, 1); + RegionInit(prgnDstClip, &box, 1); } /* drawable-relative source region */ - REGION_INIT(pscr, &rgnExposed, &srcBox, 1); + RegionInit(&rgnExposed, &srcBox, 1); /* now get the hidden parts of the source box*/ - REGION_SUBTRACT(pscr, &rgnExposed, &rgnExposed, prgnSrcClip); + RegionSubtract(&rgnExposed, &rgnExposed, prgnSrcClip); /* move them over the destination */ - REGION_TRANSLATE(pscr, &rgnExposed, dstx-srcx, dsty-srcy); + RegionTranslate(&rgnExposed, dstx-srcx, dsty-srcy); /* intersect with visible areas of dest */ - REGION_INTERSECT(pscr, &rgnExposed, &rgnExposed, prgnDstClip); + RegionIntersect(&rgnExposed, &rgnExposed, prgnDstClip); /* intersect with client clip region. */ if (pGC->clientClipType == CT_REGION) - REGION_INTERSECT(pscr, &rgnExposed, &rgnExposed, pGC->clientClip); + RegionIntersect(&rgnExposed, &rgnExposed, pGC->clientClip); /* * If we have LOTS of rectangles, we decide to take the extents @@ -266,7 +262,7 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, * for windows. */ extents = pGC->graphicsExposures && - (REGION_NUM_RECTS(&rgnExposed) > RECTLIMIT) && + (RegionNumRects(&rgnExposed) > RECTLIMIT) && (pDstDrawable->type != DRAWABLE_PIXMAP); if (pSrcWin) { @@ -278,13 +274,13 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, * exposed region will undo all our work! */ if (extents && pSrcWin && region && - (RECT_IN_REGION(pscr, region, &srcBox) != rgnIN)) + (RegionContainsRect(region, &srcBox) != rgnIN)) extents = FALSE; } if (extents) { - expBox = *REGION_EXTENTS(pscr, &rgnExposed); - REGION_RESET(pscr, &rgnExposed, &expBox); + expBox = *RegionExtents(&rgnExposed); + RegionReset(&rgnExposed, &expBox); } if ((pDstDrawable->type != DRAWABLE_PIXMAP) && (((WindowPtr)pDstDrawable)->backgroundState != None)) @@ -292,52 +288,52 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable, WindowPtr pWin = (WindowPtr)pDstDrawable; /* make the exposed area screen-relative */ - REGION_TRANSLATE(pscr, &rgnExposed, + RegionTranslate(&rgnExposed, pDstDrawable->x, pDstDrawable->y); if (extents) { - /* PaintWindowBackground doesn't clip, so we have to */ - REGION_INTERSECT(pscr, &rgnExposed, &rgnExposed, &pWin->clipList); + /* miPaintWindow doesn't clip, so we have to */ + RegionIntersect(&rgnExposed, &rgnExposed, &pWin->clipList); } miPaintWindow((WindowPtr)pDstDrawable, &rgnExposed, PW_BACKGROUND); if (extents) { - REGION_RESET(pscr, &rgnExposed, &expBox); + RegionReset(&rgnExposed, &expBox); } else - REGION_TRANSLATE(pscr, &rgnExposed, + RegionTranslate(&rgnExposed, -pDstDrawable->x, -pDstDrawable->y); } if (prgnDstClip == &rgnDstRec) { - REGION_UNINIT(pscr, prgnDstClip); + RegionUninit(prgnDstClip); } else if (prgnDstClip != prgnSrcClip) { - REGION_DESTROY(pscr, prgnDstClip); + RegionDestroy(prgnDstClip); } if (prgnSrcClip == &rgnSrcRec) { - REGION_UNINIT(pscr, prgnSrcClip); + RegionUninit(prgnSrcClip); } else { - REGION_DESTROY(pscr, prgnSrcClip); + RegionDestroy(prgnSrcClip); } if (pGC->graphicsExposures) { /* don't look */ - RegionPtr exposed = REGION_CREATE(pscr, NullBox, 0); + RegionPtr exposed = RegionCreate(NullBox, 0); *exposed = rgnExposed; return exposed; } else { - REGION_UNINIT(pscr, &rgnExposed); + RegionUninit(&rgnExposed); return NULL; } } @@ -348,7 +344,7 @@ void miSendGraphicsExpose (ClientPtr client, RegionPtr pRgn, XID drawable, int major, int minor) { - if (pRgn && !REGION_NIL(pRgn)) + if (pRgn && !RegionNil(pRgn)) { xEvent *pEvent; xEvent *pe; @@ -356,9 +352,9 @@ miSendGraphicsExpose (ClientPtr client, RegionPtr pRgn, XID drawable, int i; int numRects; - numRects = REGION_NUM_RECTS(pRgn); - pBox = REGION_RECTS(pRgn); - if(!(pEvent = xalloc(numRects * sizeof(xEvent)))) + numRects = RegionNumRects(pRgn); + pBox = RegionRects(pRgn); + if(!(pEvent = malloc(numRects * sizeof(xEvent)))) return; pe = pEvent; @@ -374,9 +370,11 @@ 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); - xfree(pEvent); + free(pEvent); } else { @@ -386,8 +384,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); } } @@ -400,9 +397,9 @@ miSendExposures( WindowPtr pWin, RegionPtr pRgn, int dx, int dy) xEvent *pEvent, *pe; int i; - pBox = REGION_RECTS(pRgn); - numRects = REGION_NUM_RECTS(pRgn); - if(!(pEvent = xcalloc(1, numRects * sizeof(xEvent)))) + pBox = RegionRects(pRgn); + numRects = RegionNumRects(pRgn); + if(!(pEvent = calloc(1, numRects * sizeof(xEvent)))) return; for (i=numRects, pe = pEvent; --i >= 0; pe++, pBox++) @@ -423,16 +420,16 @@ miSendExposures( WindowPtr pWin, RegionPtr pRgn, int dx, int dy) XID realWin = 0; if(!pWin->parent) { - x = panoramiXdataPtr[scrnum].x; - y = panoramiXdataPtr[scrnum].y; - pWin = WindowTable[0]; + x = screenInfo.screens[scrnum]->x; + y = screenInfo.screens[scrnum]->y; + pWin = screenInfo.screens[0]->root; realWin = pWin->drawable.id; } else if (scrnum) { PanoramiXRes *win; win = PanoramiXFindIDByScrnum(XRT_WINDOW, pWin->drawable.id, scrnum); if(!win) { - xfree(pEvent); + free(pEvent); return; } realWin = win->info[0].id; @@ -449,15 +446,15 @@ miSendExposures( WindowPtr pWin, RegionPtr pRgn, int dx, int dy) DeliverEvents(pWin, pEvent, numRects, NullWindow); - xfree(pEvent); + free(pEvent); } void miWindowExposures( WindowPtr pWin, RegionPtr prgn, RegionPtr other_exposed) { RegionPtr exposures = prgn; - if ((prgn && !REGION_NIL(prgn)) || - (exposures && !REGION_NIL(exposures)) || other_exposed) + if ((prgn && !RegionNil(prgn)) || + (exposures && !RegionNil(exposures)) || other_exposed) { RegionRec expRec; int clientInterested; @@ -470,15 +467,15 @@ miWindowExposures( WindowPtr pWin, RegionPtr prgn, RegionPtr other_exposed) { if (exposures) { - REGION_UNION(pWin->drawable.pScreen, other_exposed, + RegionUnion(other_exposed, exposures, other_exposed); if (exposures != prgn) - REGION_DESTROY(pWin->drawable.pScreen, exposures); + RegionDestroy(exposures); } exposures = other_exposed; } - if (clientInterested && exposures && (REGION_NUM_RECTS(exposures) > RECTLIMIT)) + if (clientInterested && exposures && (RegionNumRects(exposures) > RECTLIMIT)) { /* * If we have LOTS of rectangles, we decide to take the extents @@ -488,34 +485,34 @@ miWindowExposures( WindowPtr pWin, RegionPtr prgn, RegionPtr other_exposed) */ BoxRec box; - box = *REGION_EXTENTS( pWin->drawable.pScreen, exposures); + box = *RegionExtents(exposures); if (exposures == prgn) { exposures = &expRec; - REGION_INIT( pWin->drawable.pScreen, exposures, &box, 1); - REGION_RESET( pWin->drawable.pScreen, prgn, &box); + RegionInit(exposures, &box, 1); + RegionReset(prgn, &box); } else { - REGION_RESET( pWin->drawable.pScreen, exposures, &box); - REGION_UNION( pWin->drawable.pScreen, prgn, prgn, exposures); + RegionReset(exposures, &box); + RegionUnion(prgn, prgn, exposures); } - /* PaintWindowBackground doesn't clip, so we have to */ - REGION_INTERSECT( pWin->drawable.pScreen, prgn, prgn, &pWin->clipList); + /* miPaintWindow doesn't clip, so we have to */ + RegionIntersect(prgn, prgn, &pWin->clipList); } - if (prgn && !REGION_NIL(prgn)) + if (prgn && !RegionNil(prgn)) miPaintWindow(pWin, prgn, PW_BACKGROUND); - if (clientInterested && exposures && !REGION_NIL(exposures)) + if (clientInterested && exposures && !RegionNil(exposures)) miSendExposures(pWin, exposures, pWin->drawable.x, pWin->drawable.y); if (exposures == &expRec) { - REGION_UNINIT( pWin->drawable.pScreen, exposures); + RegionUninit(exposures); } else if (exposures && exposures != prgn && exposures != other_exposed) - REGION_DESTROY( pWin->drawable.pScreen, exposures); + RegionDestroy(exposures); if (prgn) - REGION_EMPTY( pWin->drawable.pScreen, prgn); + RegionEmpty(prgn); } else if (exposures && exposures != prgn) - REGION_DESTROY( pWin->drawable.pScreen, exposures); + RegionDestroy(exposures); } #ifdef ROOTLESS @@ -646,22 +643,22 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what) gcmask |= GCFillStyle | GCTile | GCTileStipXOrigin | GCTileStipYOrigin; } - prect = xalloc(REGION_NUM_RECTS(prgn) * sizeof(xRectangle)); + prect = malloc(RegionNumRects(prgn) * sizeof(xRectangle)); if (!prect) return; pGC = GetScratchGC(drawable->depth, drawable->pScreen); if (!pGC) { - xfree(prect); + free(prect); return; } - dixChangeGC (NullClient, pGC, gcmask, NULL, gcval); + ChangeGC (NullClient, pGC, gcmask, gcval); ValidateGC (drawable, pGC); - numRects = REGION_NUM_RECTS(prgn); - pbox = REGION_RECTS(prgn); + numRects = RegionNumRects(prgn); + pbox = RegionRects(prgn); for (i= numRects; --i >= 0; pbox++, prect++) { prect->x = pbox->x1 - draw_x_off; @@ -671,7 +668,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what) } prect -= numRects; (*pGC->ops->PolyFillRect)(drawable, pGC, numRects, prect); - xfree(prect); + free(prect); FreeScratchGC(pGC); } @@ -683,17 +680,18 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what) void miClearDrawable(DrawablePtr pDraw, GCPtr pGC) { - XID fg = pGC->fgPixel; - XID bg = pGC->bgPixel; + ChangeGCVal fg, bg; xRectangle rect; + fg.val = pGC->fgPixel; + bg.val = pGC->bgPixel; rect.x = 0; rect.y = 0; rect.width = pDraw->width; rect.height = pDraw->height; - DoChangeGC(pGC, GCForeground, &bg, 0); + ChangeGC(NullClient, pGC, GCForeground, &bg); ValidateGC(pDraw, pGC); (*pGC->ops->PolyFillRect)(pDraw, pGC, 1, &rect); - DoChangeGC(pGC, GCForeground, &fg, 0); + ChangeGC(NullClient, pGC, GCForeground, &fg); ValidateGC(pDraw, pGC); } |