aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/composite/compwindow.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/composite/compwindow.c')
-rw-r--r--xorg-server/composite/compwindow.c800
1 files changed, 390 insertions, 410 deletions
diff --git a/xorg-server/composite/compwindow.c b/xorg-server/composite/compwindow.c
index d2a866d6f..6eb624b11 100644
--- a/xorg-server/composite/compwindow.c
+++ b/xorg-server/composite/compwindow.c
@@ -53,129 +53,130 @@
#ifdef COMPOSITE_DEBUG
static int
-compCheckWindow (WindowPtr pWin, pointer data)
+compCheckWindow(WindowPtr pWin, pointer data)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- PixmapPtr pWinPixmap = (*pScreen->GetWindowPixmap) (pWin);
- PixmapPtr pParentPixmap = pWin->parent ? (*pScreen->GetWindowPixmap) (pWin->parent) : 0;
- PixmapPtr pScreenPixmap = (*pScreen->GetScreenPixmap) (pScreen);
-
- if (!pWin->parent)
- {
- assert (pWin->redirectDraw == RedirectDrawNone);
- assert (pWinPixmap == pScreenPixmap);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ PixmapPtr pWinPixmap = (*pScreen->GetWindowPixmap) (pWin);
+ PixmapPtr pParentPixmap =
+ pWin->parent ? (*pScreen->GetWindowPixmap) (pWin->parent) : 0;
+ PixmapPtr pScreenPixmap = (*pScreen->GetScreenPixmap) (pScreen);
+
+ if (!pWin->parent) {
+ assert(pWin->redirectDraw == RedirectDrawNone);
+ assert(pWinPixmap == pScreenPixmap);
}
- else if (pWin->redirectDraw != RedirectDrawNone)
- {
- assert (pWinPixmap != pParentPixmap);
- assert (pWinPixmap != pScreenPixmap);
+ else if (pWin->redirectDraw != RedirectDrawNone) {
+ assert(pWinPixmap != pParentPixmap);
+ assert(pWinPixmap != pScreenPixmap);
}
- else
- {
- assert (pWinPixmap == pParentPixmap);
+ else {
+ assert(pWinPixmap == pParentPixmap);
}
- assert (0 < pWinPixmap->refcnt && pWinPixmap->refcnt < 3);
- assert (0 < pScreenPixmap->refcnt && pScreenPixmap->refcnt < 3);
+ assert(0 < pWinPixmap->refcnt && pWinPixmap->refcnt < 3);
+ assert(0 < pScreenPixmap->refcnt && pScreenPixmap->refcnt < 3);
if (pParentPixmap)
- assert (0 <= pParentPixmap->refcnt && pParentPixmap->refcnt < 3);
+ assert(0 <= pParentPixmap->refcnt && pParentPixmap->refcnt < 3);
return WT_WALKCHILDREN;
}
void
-compCheckTree (ScreenPtr pScreen)
+compCheckTree(ScreenPtr pScreen)
{
- WalkTree (pScreen, compCheckWindow, 0);
+ WalkTree(pScreen, compCheckWindow, 0);
}
#endif
typedef struct _compPixmapVisit {
- WindowPtr pWindow;
- PixmapPtr pPixmap;
+ WindowPtr pWindow;
+ PixmapPtr pPixmap;
} CompPixmapVisitRec, *CompPixmapVisitPtr;
static Bool
-compRepaintBorder (ClientPtr pClient, pointer closure)
+compRepaintBorder(ClientPtr pClient, pointer closure)
{
WindowPtr pWindow;
- int rc = dixLookupWindow(&pWindow, (XID)(intptr_t)closure, pClient, DixWriteAccess);
+ int rc =
+ dixLookupWindow(&pWindow, (XID) (intptr_t) closure, pClient,
+ DixWriteAccess);
if (rc == Success) {
- RegionRec exposed;
+ RegionRec exposed;
- RegionNull(&exposed);
- RegionSubtract(&exposed, &pWindow->borderClip, &pWindow->winSize);
- miPaintWindow(pWindow, &exposed, PW_BORDER);
- RegionUninit(&exposed);
+ RegionNull(&exposed);
+ RegionSubtract(&exposed, &pWindow->borderClip, &pWindow->winSize);
+ miPaintWindow(pWindow, &exposed, PW_BORDER);
+ RegionUninit(&exposed);
}
return TRUE;
}
static int
-compSetPixmapVisitWindow (WindowPtr pWindow, pointer data)
+compSetPixmapVisitWindow(WindowPtr pWindow, pointer data)
{
- CompPixmapVisitPtr pVisit = (CompPixmapVisitPtr) data;
- ScreenPtr pScreen = pWindow->drawable.pScreen;
+ CompPixmapVisitPtr pVisit = (CompPixmapVisitPtr) data;
+ ScreenPtr pScreen = pWindow->drawable.pScreen;
if (pWindow != pVisit->pWindow && pWindow->redirectDraw != RedirectDrawNone)
- return WT_DONTWALKCHILDREN;
+ return WT_DONTWALKCHILDREN;
(*pScreen->SetWindowPixmap) (pWindow, pVisit->pPixmap);
/*
* Recompute winSize and borderSize. This is duplicate effort
* when resizing pixmaps, but necessary when changing redirection.
* Might be nice to fix this.
*/
- SetWinSize (pWindow);
- SetBorderSize (pWindow);
- if (HasBorder (pWindow))
- QueueWorkProc (compRepaintBorder, serverClient,
- (pointer)(intptr_t) pWindow->drawable.id);
+ SetWinSize(pWindow);
+ SetBorderSize(pWindow);
+ if (HasBorder(pWindow))
+ QueueWorkProc(compRepaintBorder, serverClient,
+ (pointer) (intptr_t) pWindow->drawable.id);
return WT_WALKCHILDREN;
}
void
-compSetPixmap (WindowPtr pWindow, PixmapPtr pPixmap)
+compSetPixmap(WindowPtr pWindow, PixmapPtr pPixmap)
{
- CompPixmapVisitRec visitRec;
+ CompPixmapVisitRec visitRec;
visitRec.pWindow = pWindow;
visitRec.pPixmap = pPixmap;
- TraverseTree (pWindow, compSetPixmapVisitWindow, (pointer) &visitRec);
- compCheckTree (pWindow->drawable.pScreen);
+ TraverseTree(pWindow, compSetPixmapVisitWindow, (pointer) &visitRec);
+ compCheckTree(pWindow->drawable.pScreen);
}
Bool
-compCheckRedirect (WindowPtr pWin)
+compCheckRedirect(WindowPtr pWin)
{
- CompWindowPtr cw = GetCompWindow (pWin);
- CompScreenPtr cs = GetCompScreen(pWin->drawable.pScreen);
- Bool should;
+ CompWindowPtr cw = GetCompWindow(pWin);
+ CompScreenPtr cs = GetCompScreen(pWin->drawable.pScreen);
+ Bool should;
should = pWin->realized && (pWin->drawable.class != InputOnly) &&
- (cw != NULL) && (pWin->parent != NULL);
+ (cw != NULL) && (pWin->parent != NULL);
/* Never redirect the overlay window */
if (cs->pOverlayWin != NULL) {
- if (pWin == cs->pOverlayWin) {
- should = FALSE;
- }
+ if (pWin == cs->pOverlayWin) {
+ should = FALSE;
+ }
}
- if (should != (pWin->redirectDraw != RedirectDrawNone))
- {
- if (should)
- return compAllocPixmap (pWin);
- else {
- ScreenPtr pScreen = pWin->drawable.pScreen;
- PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
- compSetParentPixmap (pWin);
- compRestoreWindow (pWin, pPixmap);
- (*pScreen->DestroyPixmap) (pPixmap);
- }
- } else if (should) {
- if (cw->update == CompositeRedirectAutomatic)
- pWin->redirectDraw = RedirectDrawAutomatic;
- else
- pWin->redirectDraw = RedirectDrawManual;
+ if (should != (pWin->redirectDraw != RedirectDrawNone)) {
+ if (should)
+ return compAllocPixmap(pWin);
+ else {
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+
+ compSetParentPixmap(pWin);
+ compRestoreWindow(pWin, pPixmap);
+ (*pScreen->DestroyPixmap) (pPixmap);
+ }
+ }
+ else if (should) {
+ if (cw->update == CompositeRedirectAutomatic)
+ pWin->redirectDraw = RedirectDrawAutomatic;
+ else
+ pWin->redirectDraw = RedirectDrawManual;
}
return TRUE;
}
@@ -183,110 +184,106 @@ compCheckRedirect (WindowPtr pWin)
static int
updateOverlayWindow(ScreenPtr pScreen)
{
- CompScreenPtr cs;
- WindowPtr pWin; /* overlay window */
- XID vlist[2];
- int w = pScreen->width;
- int h = pScreen->height;
+ CompScreenPtr cs;
+ WindowPtr pWin; /* overlay window */
+ XID vlist[2];
+ int w = pScreen->width;
+ int h = pScreen->height;
#ifdef PANORAMIX
- if (!noPanoramiXExtension)
- {
- w = PanoramiXPixWidth;
- h = PanoramiXPixHeight;
- }
+ if (!noPanoramiXExtension) {
+ w = PanoramiXPixWidth;
+ h = PanoramiXPixHeight;
+ }
#endif
- cs = GetCompScreen(pScreen);
- if ((pWin = cs->pOverlayWin) != NULL) {
- if ((pWin->drawable.width == w) &&
- (pWin->drawable.height == h))
- return Success;
+ cs = GetCompScreen(pScreen);
+ if ((pWin = cs->pOverlayWin) != NULL) {
+ if ((pWin->drawable.width == w) && (pWin->drawable.height == h))
+ return Success;
- /* Let's resize the overlay window. */
- vlist[0] = w;
- vlist[1] = h;
- return ConfigureWindow(pWin, CWWidth | CWHeight, vlist, wClient(pWin));
- }
+ /* Let's resize the overlay window. */
+ vlist[0] = w;
+ vlist[1] = h;
+ return ConfigureWindow(pWin, CWWidth | CWHeight, vlist, wClient(pWin));
+ }
- /* Let's be on the safe side and not assume an overlay window is always allocated. */
- return Success;
+ /* Let's be on the safe side and not assume an overlay window is always allocated. */
+ return Success;
}
Bool
-compPositionWindow (WindowPtr pWin, int x, int y)
+compPositionWindow(WindowPtr pWin, int x, int y)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- Bool ret = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ Bool ret = TRUE;
pScreen->PositionWindow = cs->PositionWindow;
/*
* "Shouldn't need this as all possible places should be wrapped
*
- compCheckRedirect (pWin);
+ compCheckRedirect (pWin);
*/
#ifdef COMPOSITE_DEBUG
if ((pWin->redirectDraw != RedirectDrawNone) !=
- (pWin->viewable && (GetCompWindow(pWin) != NULL)))
- OsAbort ();
+ (pWin->viewable && (GetCompWindow(pWin) != NULL)))
+ OsAbort();
#endif
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
- int bw = wBorderWidth (pWin);
- int nx = pWin->drawable.x - bw;
- int ny = pWin->drawable.y - bw;
-
- if (pPixmap->screen_x != nx || pPixmap->screen_y != ny)
- {
- pPixmap->screen_x = nx;
- pPixmap->screen_y = ny;
- pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- }
+ if (pWin->redirectDraw != RedirectDrawNone) {
+ PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+ int bw = wBorderWidth(pWin);
+ int nx = pWin->drawable.x - bw;
+ int ny = pWin->drawable.y - bw;
+
+ if (pPixmap->screen_x != nx || pPixmap->screen_y != ny) {
+ pPixmap->screen_x = nx;
+ pPixmap->screen_y = ny;
+ pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ }
}
if (!(*pScreen->PositionWindow) (pWin, x, y))
- ret = FALSE;
+ ret = FALSE;
cs->PositionWindow = pScreen->PositionWindow;
pScreen->PositionWindow = compPositionWindow;
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
if (updateOverlayWindow(pScreen) != Success)
- ret = FALSE;
+ ret = FALSE;
return ret;
}
Bool
-compRealizeWindow (WindowPtr pWin)
+compRealizeWindow(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- Bool ret = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ Bool ret = TRUE;
pScreen->RealizeWindow = cs->RealizeWindow;
- compCheckRedirect (pWin);
+ compCheckRedirect(pWin);
if (!(*pScreen->RealizeWindow) (pWin))
- ret = FALSE;
+ ret = FALSE;
cs->RealizeWindow = pScreen->RealizeWindow;
pScreen->RealizeWindow = compRealizeWindow;
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
return ret;
}
Bool
-compUnrealizeWindow (WindowPtr pWin)
+compUnrealizeWindow(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- Bool ret = TRUE;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ Bool ret = TRUE;
pScreen->UnrealizeWindow = cs->UnrealizeWindow;
- compCheckRedirect (pWin);
+ compCheckRedirect(pWin);
if (!(*pScreen->UnrealizeWindow) (pWin))
- ret = FALSE;
+ ret = FALSE;
cs->UnrealizeWindow = pScreen->UnrealizeWindow;
pScreen->UnrealizeWindow = compUnrealizeWindow;
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
return ret;
}
@@ -296,30 +293,27 @@ compUnrealizeWindow (WindowPtr pWin)
*/
void
-compClipNotify (WindowPtr pWin, int dx, int dy)
+compClipNotify(WindowPtr pWin, int dx, int dy)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- CompWindowPtr cw = GetCompWindow (pWin);
-
- if (cw)
- {
- if (cw->borderClipX != pWin->drawable.x ||
- cw->borderClipY != pWin->drawable.y)
- {
- RegionTranslate(&cw->borderClip,
- pWin->drawable.x - cw->borderClipX,
- pWin->drawable.y - cw->borderClipY);
- cw->borderClipX = pWin->drawable.x;
- cw->borderClipY = pWin->drawable.y;
- }
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ CompWindowPtr cw = GetCompWindow(pWin);
+
+ if (cw) {
+ if (cw->borderClipX != pWin->drawable.x ||
+ cw->borderClipY != pWin->drawable.y) {
+ RegionTranslate(&cw->borderClip,
+ pWin->drawable.x - cw->borderClipX,
+ pWin->drawable.y - cw->borderClipY);
+ cw->borderClipX = pWin->drawable.x;
+ cw->borderClipY = pWin->drawable.y;
+ }
}
- if (cs->ClipNotify)
- {
- pScreen->ClipNotify = cs->ClipNotify;
- (*pScreen->ClipNotify) (pWin, dx, dy);
- cs->ClipNotify = pScreen->ClipNotify;
- pScreen->ClipNotify = compClipNotify;
+ if (cs->ClipNotify) {
+ pScreen->ClipNotify = cs->ClipNotify;
+ (*pScreen->ClipNotify) (pWin, dx, dy);
+ cs->ClipNotify = pScreen->ClipNotify;
+ pScreen->ClipNotify = compClipNotify;
}
}
@@ -329,53 +323,53 @@ compClipNotify (WindowPtr pWin, int dx, int dy)
*/
static Bool
-compIsAlternateVisual (ScreenPtr pScreen,
- XID visual)
+compIsAlternateVisual(ScreenPtr pScreen, XID visual)
{
- CompScreenPtr cs = GetCompScreen (pScreen);
- int i;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ int i;
for (i = 0; i < cs->numAlternateVisuals; i++)
- if (cs->alternateVisuals[i] == visual)
- return TRUE;
+ if (cs->alternateVisuals[i] == visual)
+ return TRUE;
return FALSE;
}
static Bool
-compImplicitRedirect (WindowPtr pWin, WindowPtr pParent)
+compImplicitRedirect(WindowPtr pWin, WindowPtr pParent)
{
- if (pParent)
- {
- ScreenPtr pScreen = pWin->drawable.pScreen;
- XID winVisual = wVisual (pWin);
- XID parentVisual = wVisual (pParent);
-
- if (winVisual != parentVisual &&
- (compIsAlternateVisual (pScreen, winVisual) ||
- compIsAlternateVisual (pScreen, parentVisual)))
- return TRUE;
+ if (pParent) {
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ XID winVisual = wVisual(pWin);
+ XID parentVisual = wVisual(pParent);
+
+ if (winVisual != parentVisual &&
+ (compIsAlternateVisual(pScreen, winVisual) ||
+ compIsAlternateVisual(pScreen, parentVisual)))
+ return TRUE;
}
return FALSE;
}
-static void compFreeOldPixmap(WindowPtr pWin)
+static void
+compFreeOldPixmap(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- CompWindowPtr cw = GetCompWindow (pWin);
- if (cw->pOldPixmap)
- {
- (*pScreen->DestroyPixmap) (cw->pOldPixmap);
- cw->pOldPixmap = NullPixmap;
- }
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+
+ if (pWin->redirectDraw != RedirectDrawNone) {
+ CompWindowPtr cw = GetCompWindow(pWin);
+
+ if (cw->pOldPixmap) {
+ (*pScreen->DestroyPixmap) (cw->pOldPixmap);
+ cw->pOldPixmap = NullPixmap;
+ }
}
}
+
void
-compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind)
+compMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
pScreen->MoveWindow = cs->MoveWindow;
(*pScreen->MoveWindow) (pWin, x, y, pSib, kind);
@@ -383,15 +377,15 @@ compMoveWindow (WindowPtr pWin, int x, int y, WindowPtr pSib, VTKind kind)
pScreen->MoveWindow = compMoveWindow;
compFreeOldPixmap(pWin);
- compCheckTree (pScreen);
+ compCheckTree(pScreen);
}
void
-compResizeWindow (WindowPtr pWin, int x, int y,
- unsigned int w, unsigned int h, WindowPtr pSib)
+compResizeWindow(WindowPtr pWin, int x, int y,
+ unsigned int w, unsigned int h, WindowPtr pSib)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
pScreen->ResizeWindow = cs->ResizeWindow;
(*pScreen->ResizeWindow) (pWin, x, y, w, h, pSib);
@@ -399,14 +393,14 @@ compResizeWindow (WindowPtr pWin, int x, int y,
pScreen->ResizeWindow = compResizeWindow;
compFreeOldPixmap(pWin);
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
}
void
-compChangeBorderWidth (WindowPtr pWin, unsigned int bw)
+compChangeBorderWidth(WindowPtr pWin, unsigned int bw)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
pScreen->ChangeBorderWidth = cs->ChangeBorderWidth;
(*pScreen->ChangeBorderWidth) (pWin, bw);
@@ -414,189 +408,183 @@ compChangeBorderWidth (WindowPtr pWin, unsigned int bw)
pScreen->ChangeBorderWidth = compChangeBorderWidth;
compFreeOldPixmap(pWin);
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
}
void
-compReparentWindow (WindowPtr pWin, WindowPtr pPriorParent)
+compReparentWindow(WindowPtr pWin, WindowPtr pPriorParent)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
pScreen->ReparentWindow = cs->ReparentWindow;
/*
* Remove any implicit redirect due to synthesized visual
*/
- if (compImplicitRedirect (pWin, pPriorParent))
- compUnredirectWindow (serverClient, pWin, CompositeRedirectAutomatic);
+ if (compImplicitRedirect(pWin, pPriorParent))
+ compUnredirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
/*
* Handle subwindows redirection
*/
- compUnredirectOneSubwindow (pPriorParent, pWin);
- compRedirectOneSubwindow (pWin->parent, pWin);
+ compUnredirectOneSubwindow(pPriorParent, pWin);
+ compRedirectOneSubwindow(pWin->parent, pWin);
/*
* Add any implict redirect due to synthesized visual
*/
- if (compImplicitRedirect (pWin, pWin->parent))
- compRedirectWindow (serverClient, pWin, CompositeRedirectAutomatic);
+ if (compImplicitRedirect(pWin, pWin->parent))
+ compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
/*
* Allocate any necessary redirect pixmap
* (this actually should never be true; pWin is always unmapped)
*/
- compCheckRedirect (pWin);
+ compCheckRedirect(pWin);
/*
* Reset pixmap pointers as appropriate
*/
if (pWin->parent && pWin->redirectDraw == RedirectDrawNone)
- compSetPixmap (pWin, (*pScreen->GetWindowPixmap) (pWin->parent));
+ compSetPixmap(pWin, (*pScreen->GetWindowPixmap) (pWin->parent));
/*
* Call down to next function
*/
if (pScreen->ReparentWindow)
- (*pScreen->ReparentWindow) (pWin, pPriorParent);
+ (*pScreen->ReparentWindow) (pWin, pPriorParent);
cs->ReparentWindow = pScreen->ReparentWindow;
pScreen->ReparentWindow = compReparentWindow;
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
}
void
-compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
+compCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- int dx = 0, dy = 0;
-
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
- CompWindowPtr cw = GetCompWindow (pWin);
-
- assert (cw->oldx != COMP_ORIGIN_INVALID);
- assert (cw->oldy != COMP_ORIGIN_INVALID);
- if (cw->pOldPixmap)
- {
- /*
- * Ok, the old bits are available in pOldPixmap and
- * need to be copied to pNewPixmap.
- */
- RegionRec rgnDst;
- PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
- GCPtr pGC;
-
- dx = ptOldOrg.x - pWin->drawable.x;
- dy = ptOldOrg.y - pWin->drawable.y;
- RegionTranslate(prgnSrc, -dx, -dy);
-
- RegionNull(&rgnDst);
-
- RegionIntersect(&rgnDst,
- &pWin->borderClip, prgnSrc);
-
- RegionTranslate(&rgnDst,
- -pPixmap->screen_x, -pPixmap->screen_y);
-
- dx = dx + pPixmap->screen_x - cw->oldx;
- dy = dy + pPixmap->screen_y - cw->oldy;
- pGC = GetScratchGC (pPixmap->drawable.depth, pScreen);
- if (pGC)
- {
- BoxPtr pBox = RegionRects (&rgnDst);
- int nBox = RegionNumRects (&rgnDst);
-
- ValidateGC(&pPixmap->drawable, pGC);
- while (nBox--)
- {
- (void) (*pGC->ops->CopyArea) (&cw->pOldPixmap->drawable,
- &pPixmap->drawable,
- pGC,
- pBox->x1 + dx, pBox->y1 + dy,
- pBox->x2 - pBox->x1,
- pBox->y2 - pBox->y1,
- pBox->x1, pBox->y1);
- pBox++;
- }
- FreeScratchGC (pGC);
- }
- return;
- }
- dx = pPixmap->screen_x - cw->oldx;
- dy = pPixmap->screen_y - cw->oldy;
- ptOldOrg.x += dx;
- ptOldOrg.y += dy;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ int dx = 0, dy = 0;
+
+ if (pWin->redirectDraw != RedirectDrawNone) {
+ PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+ CompWindowPtr cw = GetCompWindow(pWin);
+
+ assert(cw->oldx != COMP_ORIGIN_INVALID);
+ assert(cw->oldy != COMP_ORIGIN_INVALID);
+ if (cw->pOldPixmap) {
+ /*
+ * Ok, the old bits are available in pOldPixmap and
+ * need to be copied to pNewPixmap.
+ */
+ RegionRec rgnDst;
+ PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+ GCPtr pGC;
+
+ dx = ptOldOrg.x - pWin->drawable.x;
+ dy = ptOldOrg.y - pWin->drawable.y;
+ RegionTranslate(prgnSrc, -dx, -dy);
+
+ RegionNull(&rgnDst);
+
+ RegionIntersect(&rgnDst, &pWin->borderClip, prgnSrc);
+
+ RegionTranslate(&rgnDst, -pPixmap->screen_x, -pPixmap->screen_y);
+
+ dx = dx + pPixmap->screen_x - cw->oldx;
+ dy = dy + pPixmap->screen_y - cw->oldy;
+ pGC = GetScratchGC(pPixmap->drawable.depth, pScreen);
+ if (pGC) {
+ BoxPtr pBox = RegionRects(&rgnDst);
+ int nBox = RegionNumRects(&rgnDst);
+
+ ValidateGC(&pPixmap->drawable, pGC);
+ while (nBox--) {
+ (void) (*pGC->ops->CopyArea) (&cw->pOldPixmap->drawable,
+ &pPixmap->drawable,
+ pGC,
+ pBox->x1 + dx, pBox->y1 + dy,
+ pBox->x2 - pBox->x1,
+ pBox->y2 - pBox->y1,
+ pBox->x1, pBox->y1);
+ pBox++;
+ }
+ FreeScratchGC(pGC);
+ }
+ return;
+ }
+ dx = pPixmap->screen_x - cw->oldx;
+ dy = pPixmap->screen_y - cw->oldy;
+ ptOldOrg.x += dx;
+ ptOldOrg.y += dy;
}
pScreen->CopyWindow = cs->CopyWindow;
- if (ptOldOrg.x != pWin->drawable.x || ptOldOrg.y != pWin->drawable.y)
- {
- if (dx || dy)
- RegionTranslate(prgnSrc, dx, dy);
- (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
- if (dx || dy)
- RegionTranslate(prgnSrc, -dx, -dy);
+ if (ptOldOrg.x != pWin->drawable.x || ptOldOrg.y != pWin->drawable.y) {
+ if (dx || dy)
+ RegionTranslate(prgnSrc, dx, dy);
+ (*pScreen->CopyWindow) (pWin, ptOldOrg, prgnSrc);
+ if (dx || dy)
+ RegionTranslate(prgnSrc, -dx, -dy);
}
- else
- {
- ptOldOrg.x -= dx;
- ptOldOrg.y -= dy;
- RegionTranslate(prgnSrc,
- pWin->drawable.x - ptOldOrg.x,
- pWin->drawable.y - ptOldOrg.y);
- DamageDamageRegion(&pWin->drawable, prgnSrc);
+ else {
+ ptOldOrg.x -= dx;
+ ptOldOrg.y -= dy;
+ RegionTranslate(prgnSrc,
+ pWin->drawable.x - ptOldOrg.x,
+ pWin->drawable.y - ptOldOrg.y);
+ DamageDamageRegion(&pWin->drawable, prgnSrc);
}
cs->CopyWindow = pScreen->CopyWindow;
pScreen->CopyWindow = compCopyWindow;
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
}
Bool
-compCreateWindow (WindowPtr pWin)
+compCreateWindow(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- Bool ret;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ Bool ret;
pScreen->CreateWindow = cs->CreateWindow;
ret = (*pScreen->CreateWindow) (pWin);
- if (pWin->parent && ret)
- {
- CompSubwindowsPtr csw = GetCompSubwindows (pWin->parent);
- CompClientWindowPtr ccw;
-
- (*pScreen->SetWindowPixmap) (pWin, (*pScreen->GetWindowPixmap) (pWin->parent));
- if (csw)
- for (ccw = csw->clients; ccw; ccw = ccw->next)
- compRedirectWindow (clients[CLIENT_ID(ccw->id)],
- pWin, ccw->update);
- if (compImplicitRedirect (pWin, pWin->parent))
- compRedirectWindow (serverClient, pWin, CompositeRedirectAutomatic);
+ if (pWin->parent && ret) {
+ CompSubwindowsPtr csw = GetCompSubwindows(pWin->parent);
+ CompClientWindowPtr ccw;
+
+ (*pScreen->SetWindowPixmap) (pWin,
+ (*pScreen->GetWindowPixmap) (pWin->
+ parent));
+ if (csw)
+ for (ccw = csw->clients; ccw; ccw = ccw->next)
+ compRedirectWindow(clients[CLIENT_ID(ccw->id)],
+ pWin, ccw->update);
+ if (compImplicitRedirect(pWin, pWin->parent))
+ compRedirectWindow(serverClient, pWin, CompositeRedirectAutomatic);
}
cs->CreateWindow = pScreen->CreateWindow;
pScreen->CreateWindow = compCreateWindow;
- compCheckTree (pWin->drawable.pScreen);
+ compCheckTree(pWin->drawable.pScreen);
return ret;
}
Bool
-compDestroyWindow (WindowPtr pWin)
+compDestroyWindow(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- CompWindowPtr cw;
- CompSubwindowsPtr csw;
- Bool ret;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ CompWindowPtr cw;
+ CompSubwindowsPtr csw;
+ Bool ret;
pScreen->DestroyWindow = cs->DestroyWindow;
- while ((cw = GetCompWindow (pWin)))
- FreeResource (cw->clients->id, RT_NONE);
- while ((csw = GetCompSubwindows (pWin)))
- FreeResource (csw->clients->id, RT_NONE);
+ while ((cw = GetCompWindow(pWin)))
+ FreeResource(cw->clients->id, RT_NONE);
+ while ((csw = GetCompSubwindows(pWin)))
+ FreeResource(csw->clients->id, RT_NONE);
if (pWin->redirectDraw != RedirectDrawNone) {
- PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
- compSetParentPixmap (pWin);
- (*pScreen->DestroyPixmap) (pPixmap);
+ PixmapPtr pPixmap = (*pScreen->GetWindowPixmap) (pWin);
+
+ compSetParentPixmap(pWin);
+ (*pScreen->DestroyPixmap) (pPixmap);
}
ret = (*pScreen->DestroyWindow) (pWin);
cs->DestroyWindow = pScreen->DestroyWindow;
@@ -606,18 +594,18 @@ compDestroyWindow (WindowPtr pWin)
}
void
-compSetRedirectBorderClip (WindowPtr pWin, RegionPtr pRegion)
+compSetRedirectBorderClip(WindowPtr pWin, RegionPtr pRegion)
{
- CompWindowPtr cw = GetCompWindow (pWin);
- RegionRec damage;
+ CompWindowPtr cw = GetCompWindow(pWin);
+ RegionRec damage;
RegionNull(&damage);
/*
* Align old border clip with new border clip
*/
RegionTranslate(&cw->borderClip,
- pWin->drawable.x - cw->borderClipX,
- pWin->drawable.y - cw->borderClipY);
+ pWin->drawable.x - cw->borderClipX,
+ pWin->drawable.y - cw->borderClipY);
/*
* Compute newly visible portion of window for repaint
*/
@@ -636,64 +624,63 @@ compSetRedirectBorderClip (WindowPtr pWin, RegionPtr pRegion)
}
RegionPtr
-compGetRedirectBorderClip (WindowPtr pWin)
+compGetRedirectBorderClip(WindowPtr pWin)
{
- CompWindowPtr cw = GetCompWindow (pWin);
+ CompWindowPtr cw = GetCompWindow(pWin);
return &cw->borderClip;
}
static VisualPtr
-compGetWindowVisual (WindowPtr pWin)
+compGetWindowVisual(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- VisualID vid = wVisual (pWin);
- int i;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ VisualID vid = wVisual(pWin);
+ int i;
for (i = 0; i < pScreen->numVisuals; i++)
- if (pScreen->visuals[i].vid == vid)
- return &pScreen->visuals[i];
+ if (pScreen->visuals[i].vid == vid)
+ return &pScreen->visuals[i];
return 0;
}
PictFormatPtr
-compWindowFormat (WindowPtr pWin)
+compWindowFormat(WindowPtr pWin)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
- return PictureMatchVisual (pScreen, pWin->drawable.depth,
- compGetWindowVisual (pWin));
+ return PictureMatchVisual(pScreen, pWin->drawable.depth,
+ compGetWindowVisual(pWin));
}
static void
-compWindowUpdateAutomatic (WindowPtr pWin)
+compWindowUpdateAutomatic(WindowPtr pWin)
{
- CompWindowPtr cw = GetCompWindow (pWin);
- ScreenPtr pScreen = pWin->drawable.pScreen;
- WindowPtr pParent = pWin->parent;
- PixmapPtr pSrcPixmap = (*pScreen->GetWindowPixmap) (pWin);
- PictFormatPtr pSrcFormat = compWindowFormat (pWin);
- PictFormatPtr pDstFormat = compWindowFormat (pWin->parent);
- int error;
- RegionPtr pRegion = DamageRegion (cw->damage);
- PicturePtr pSrcPicture = CreatePicture (0, &pSrcPixmap->drawable,
- pSrcFormat,
- 0, 0,
- serverClient,
- &error);
- XID subwindowMode = IncludeInferiors;
- PicturePtr pDstPicture = CreatePicture (0, &pParent->drawable,
- pDstFormat,
- CPSubwindowMode,
- &subwindowMode,
- serverClient,
- &error);
+ CompWindowPtr cw = GetCompWindow(pWin);
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ WindowPtr pParent = pWin->parent;
+ PixmapPtr pSrcPixmap = (*pScreen->GetWindowPixmap) (pWin);
+ PictFormatPtr pSrcFormat = compWindowFormat(pWin);
+ PictFormatPtr pDstFormat = compWindowFormat(pWin->parent);
+ int error;
+ RegionPtr pRegion = DamageRegion(cw->damage);
+ PicturePtr pSrcPicture = CreatePicture(0, &pSrcPixmap->drawable,
+ pSrcFormat,
+ 0, 0,
+ serverClient,
+ &error);
+ XID subwindowMode = IncludeInferiors;
+ PicturePtr pDstPicture = CreatePicture(0, &pParent->drawable,
+ pDstFormat,
+ CPSubwindowMode,
+ &subwindowMode,
+ serverClient,
+ &error);
/*
* First move the region from window to screen coordinates
*/
- RegionTranslate(pRegion,
- pWin->drawable.x, pWin->drawable.y);
+ RegionTranslate(pRegion, pWin->drawable.x, pWin->drawable.y);
/*
* Clip against the "real" border clip
@@ -703,130 +690,123 @@ compWindowUpdateAutomatic (WindowPtr pWin)
/*
* Now translate from screen to dest coordinates
*/
- RegionTranslate(pRegion,
- -pParent->drawable.x, -pParent->drawable.y);
+ RegionTranslate(pRegion, -pParent->drawable.x, -pParent->drawable.y);
/*
* Clip the picture
*/
- SetPictureClipRegion (pDstPicture, 0, 0, pRegion);
+ SetPictureClipRegion(pDstPicture, 0, 0, pRegion);
/*
* And paint
*/
- CompositePicture (PictOpSrc,
- pSrcPicture,
- 0,
- pDstPicture,
- 0, 0, /* src_x, src_y */
- 0, 0, /* msk_x, msk_y */
- pSrcPixmap->screen_x - pParent->drawable.x,
- pSrcPixmap->screen_y - pParent->drawable.y,
- pSrcPixmap->drawable.width,
- pSrcPixmap->drawable.height);
- FreePicture (pSrcPicture, 0);
- FreePicture (pDstPicture, 0);
+ CompositePicture(PictOpSrc, pSrcPicture, 0, pDstPicture, 0, 0, /* src_x, src_y */
+ 0, 0, /* msk_x, msk_y */
+ pSrcPixmap->screen_x - pParent->drawable.x,
+ pSrcPixmap->screen_y - pParent->drawable.y,
+ pSrcPixmap->drawable.width, pSrcPixmap->drawable.height);
+ FreePicture(pSrcPicture, 0);
+ FreePicture(pDstPicture, 0);
/*
* Empty the damage region. This has the nice effect of
* rendering the translations above harmless
*/
- DamageEmpty (cw->damage);
+ DamageEmpty(cw->damage);
}
static void
-compPaintWindowToParent (WindowPtr pWin)
+compPaintWindowToParent(WindowPtr pWin)
{
- compPaintChildrenToWindow (pWin);
+ compPaintChildrenToWindow(pWin);
- if (pWin->redirectDraw != RedirectDrawNone)
- {
- CompWindowPtr cw = GetCompWindow(pWin);
+ if (pWin->redirectDraw != RedirectDrawNone) {
+ CompWindowPtr cw = GetCompWindow(pWin);
- if (cw->damaged)
- {
- compWindowUpdateAutomatic (pWin);
- cw->damaged = FALSE;
- }
+ if (cw->damaged) {
+ compWindowUpdateAutomatic(pWin);
+ cw->damaged = FALSE;
+ }
}
}
void
-compPaintChildrenToWindow (WindowPtr pWin)
+compPaintChildrenToWindow(WindowPtr pWin)
{
WindowPtr pChild;
if (!pWin->damagedDescendants)
- return;
+ return;
for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib)
- compPaintWindowToParent (pChild);
+ compPaintWindowToParent(pChild);
pWin->damagedDescendants = FALSE;
}
WindowPtr
-CompositeRealChildHead (WindowPtr pWin)
+CompositeRealChildHead(WindowPtr pWin)
{
WindowPtr pChild, pChildBefore;
CompScreenPtr cs;
if (!pWin->parent &&
- (screenIsSaved == SCREEN_SAVER_ON) &&
- (HasSaverWindow (pWin->drawable.pScreen))) {
+ (screenIsSaved == SCREEN_SAVER_ON) &&
+ (HasSaverWindow(pWin->drawable.pScreen))) {
- /* First child is the screen saver; see if next child is the overlay */
- pChildBefore = pWin->firstChild;
- pChild = pChildBefore->nextSib;
+ /* First child is the screen saver; see if next child is the overlay */
+ pChildBefore = pWin->firstChild;
+ pChild = pChildBefore->nextSib;
- } else {
- pChildBefore = NullWindow;
- pChild = pWin->firstChild;
+ }
+ else {
+ pChildBefore = NullWindow;
+ pChild = pWin->firstChild;
}
if (!pChild) {
- return NullWindow;
+ return NullWindow;
}
cs = GetCompScreen(pWin->drawable.pScreen);
if (pChild == cs->pOverlayWin) {
- return pChild;
- } else {
- return pChildBefore;
+ return pChild;
+ }
+ else {
+ return pChildBefore;
}
}
int
compConfigNotify(WindowPtr pWin, int x, int y, int w, int h,
- int bw, WindowPtr pSib)
+ int bw, WindowPtr pSib)
{
- ScreenPtr pScreen = pWin->drawable.pScreen;
- CompScreenPtr cs = GetCompScreen (pScreen);
- Bool ret = 0;
- WindowPtr pParent = pWin->parent;
- int draw_x, draw_y;
+ ScreenPtr pScreen = pWin->drawable.pScreen;
+ CompScreenPtr cs = GetCompScreen(pScreen);
+ Bool ret = 0;
+ WindowPtr pParent = pWin->parent;
+ int draw_x, draw_y;
Bool alloc_ret;
- if (cs->ConfigNotify)
- {
- pScreen->ConfigNotify = cs->ConfigNotify;
- ret = (*pScreen->ConfigNotify)(pWin, x, y, w, h, bw, pSib);
- cs->ConfigNotify = pScreen->ConfigNotify;
- pScreen->ConfigNotify = compConfigNotify;
+ if (cs->ConfigNotify) {
+ pScreen->ConfigNotify = cs->ConfigNotify;
+ ret = (*pScreen->ConfigNotify) (pWin, x, y, w, h, bw, pSib);
+ cs->ConfigNotify = pScreen->ConfigNotify;
+ pScreen->ConfigNotify = compConfigNotify;
- if (ret)
- return ret;
+ if (ret)
+ return ret;
}
if (pWin->redirectDraw == RedirectDrawNone)
- return Success;
+ return Success;
- compCheckTree (pScreen);
+ compCheckTree(pScreen);
draw_x = pParent->drawable.x + x + bw;
draw_y = pParent->drawable.y + y + bw;
- alloc_ret = compReallocPixmap (pWin, draw_x, draw_y, w, h, bw);
+ alloc_ret = compReallocPixmap(pWin, draw_x, draw_y, w, h, bw);
if (alloc_ret == FALSE)
- return BadAlloc;
+ return BadAlloc;
return Success;
}