void miWindowExposures(WindowPtr pWin, RegionPtr prgn) { RegionPtr exposures = prgn; if (prgn && !RegionNil(prgn)) { RegionRec expRec; int clientInterested = (pWin->eventMask | wOtherEventMasks(pWin)) & ExposureMask; if (clientInterested && (RegionNumRects(prgn) > RECTLIMIT)) { /* * If we have LOTS of rectangles, we decide to take the extents * and force an exposure on that. This should require much less * work overall, on both client and server. This is cheating, but * isn't prohibited by the protocol ("spontaneous combustion" :-). */ BoxRec box = *RegionExtents(prgn); exposures = &expRec; RegionInit(exposures, &box, 1); RegionReset(prgn, &box); /* miPaintWindow doesn't clip, so we have to */ RegionIntersect(prgn, prgn, &pWin->clipList); } pWin->drawable.pScreen->PaintWindow(pWin, prgn, PW_BACKGROUND); if (clientInterested) miSendExposures(pWin, exposures, pWin->drawable.x, pWin->drawable.y); if (exposures == &expRec) RegionUninit(exposures); RegionEmpty(prgn); } }
static void expose_1 (WindowPtr pWin) { WindowPtr pChild; if (!pWin->realized) return; miPaintWindow(pWin, &pWin->borderClip, PW_BACKGROUND); /* FIXME: comments in windowstr.h indicate that borderClip doesn't include subwindow visibility. But I'm not so sure.. so we may be exposing too much.. */ miSendExposures (pWin, &pWin->borderClip, pWin->drawable.x, pWin->drawable.y); for (pChild = pWin->firstChild; pChild != NULL; pChild = pChild->nextSib) expose_1 (pChild); }
void xnestCollectExposures(void) { XEvent X; WindowPtr pWin; RegionRec Rgn; BoxRec Box; while (XCheckIfEvent(xnestDisplay, &X, xnestExposurePredicate, NULL)) { pWin = xnestWindowPtr(X.xexpose.window); if (pWin && X.xexpose.width && X.xexpose.height) { Box.x1 = pWin->drawable.x + wBorderWidth(pWin) + X.xexpose.x; Box.y1 = pWin->drawable.y + wBorderWidth(pWin) + X.xexpose.y; Box.x2 = Box.x1 + X.xexpose.width; Box.y2 = Box.y1 + X.xexpose.height; RegionInit(&Rgn, &Box, 1); miSendExposures(pWin, &Rgn, Box.x2, Box.y2); } } }