static RootlessWindowRec * canAccelBlit(DrawablePtr pDraw, GCPtr pGC) { WindowPtr pTop; RootlessWindowRec *winRec; unsigned int pm; if (pGC->alu != GXcopy) return NULL; if (pDraw->type != DRAWABLE_WINDOW) return NULL; pm = ~RootlessAlphaMask(pDraw->bitsPerPixel); if ((pGC->planemask & pm) != pm) return NULL; pTop = TopLevelParent((WindowPtr) pDraw); if (pTop == NULL) return NULL; winRec = WINREC(pTop); if (winRec == NULL) return NULL; return winRec; }
/* * xprHideWindows * Hide or unhide all top level windows. This is called for application hide/ * unhide events if the window manager is not Apple-WM aware. Xplugin windows * do not hide or unhide themselves. */ void xprHideWindows(Bool hide) { int screen; WindowPtr pRoot, pWin; for (screen = 0; screen < screenInfo.numScreens; screen++) { pRoot = WindowTable[screenInfo.screens[screen]->myNum]; RootlessFrameID prevWid = NULL; for (pWin = pRoot->firstChild; pWin; pWin = pWin->nextSib) { RootlessWindowRec *winRec = WINREC(pWin); if (winRec != NULL) { if (hide) { xprUnmapFrame(winRec->wid); } else { BoxRec box; xprRestackFrame(winRec->wid, prevWid); prevWid = winRec->wid; box.x1 = 0; box.y1 = 0; box.x2 = winRec->width; box.y2 = winRec->height; xprDamageRects(winRec->wid, 1, &box, 0, 0); RootlessQueueRedisplay(screenInfo.screens[screen]); } } } } }
static void RootlessGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, unsigned int format, unsigned long planeMask, char *pdstLine) { ScreenPtr pScreen = pDrawable->pScreen; SCREEN_UNWRAP(pScreen, GetImage); if (pDrawable->type == DRAWABLE_WINDOW) { int x0, y0, x1, y1; RootlessWindowRec *winRec; // Many apps use GetImage to sync with the visible frame buffer // FIXME: entire screen or just window or all screens? RootlessRedisplayScreen(pScreen); // RedisplayScreen stops drawing, so we need to start it again RootlessStartDrawing((WindowPtr)pDrawable); /* Check that we have some place to read from. */ winRec = WINREC(TopLevelParent((WindowPtr) pDrawable)); if (winRec == NULL) goto out; /* Clip to top-level window bounds. */ /* FIXME: fbGetImage uses the width parameter to calculate the stride of the destination pixmap. If w is clipped, the data returned will be garbage, although we will not crash. */ x0 = pDrawable->x + sx; y0 = pDrawable->y + sy; x1 = x0 + w; y1 = y0 + h; x0 = max (x0, winRec->x); y0 = max (y0, winRec->y); x1 = min (x1, winRec->x + winRec->width); y1 = min (y1, winRec->y + winRec->height); sx = x0 - pDrawable->x; sy = y0 - pDrawable->y; w = x1 - x0; h = y1 - y0; if (w <= 0 || h <= 0) goto out; } pScreen->GetImage(pDrawable, sx, sy, w, h, format, planeMask, pdstLine); out: SCREEN_WRAP(pScreen, GetImage); }