aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/mi/mivaltree.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2012-03-26 14:23:28 +0200
committermarha <marha@users.sourceforge.net>2012-03-26 14:23:28 +0200
commit76bcc36ed305418a3ddc5752d287ede894243e1b (patch)
treebacb320c825768471ce56f058f17ce863d592376 /xorg-server/mi/mivaltree.c
parent7d894e32566b710952c44cbc71939ad1d9e2fa8d (diff)
parent0f834b91a4768673833ab4917e87d86c237bb1a6 (diff)
downloadvcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.gz
vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.tar.bz2
vcxsrv-76bcc36ed305418a3ddc5752d287ede894243e1b.zip
Merge remote-tracking branch 'origin/released'
Conflicts: pixman/pixman/pixman-mmx.c xorg-server/Xext/shm.c xorg-server/Xext/syncsrv.h xorg-server/Xext/xvmain.c xorg-server/Xi/exevents.c xorg-server/Xi/opendev.c xorg-server/composite/compalloc.c xorg-server/composite/compoverlay.c xorg-server/dix/colormap.c xorg-server/dix/devices.c xorg-server/dix/dispatch.c xorg-server/dix/dixfonts.c xorg-server/dix/eventconvert.c xorg-server/dix/events.c xorg-server/dix/gc.c xorg-server/dix/getevents.c xorg-server/dix/main.c xorg-server/dix/privates.c xorg-server/dix/registry.c xorg-server/dix/resource.c xorg-server/exa/exa_accel.c xorg-server/exa/exa_migration_classic.c xorg-server/exa/exa_unaccel.c xorg-server/fb/fb.h xorg-server/fb/fbcopy.c xorg-server/fb/fbpixmap.c xorg-server/glx/dispatch.h xorg-server/glx/glapi.h xorg-server/glx/glapi_gentable.c xorg-server/glx/glapitable.h xorg-server/glx/glprocs.h xorg-server/glx/glxcmds.c xorg-server/glx/glxcmdsswap.c xorg-server/glx/glxdricommon.c xorg-server/glx/glxdriswrast.c xorg-server/glx/glxext.c xorg-server/glx/indirect_dispatch.c xorg-server/glx/indirect_dispatch.h xorg-server/glx/indirect_dispatch_swap.c xorg-server/glx/indirect_size.h xorg-server/glx/indirect_size_get.h xorg-server/glx/indirect_table.c xorg-server/glx/indirect_util.c xorg-server/glx/rensize.c xorg-server/glx/single2swap.c xorg-server/glx/singlepix.c xorg-server/glx/singlepixswap.c xorg-server/glx/singlesize.c xorg-server/hw/dmx/dmxinit.c xorg-server/hw/kdrive/ephyr/ephyr.c xorg-server/hw/kdrive/ephyr/hostx.c xorg-server/hw/kdrive/ephyr/hostx.h xorg-server/hw/kdrive/src/kinput.c xorg-server/hw/xfree86/common/compiler.h xorg-server/hw/xwin/InitInput.c xorg-server/hw/xwin/InitOutput.c xorg-server/hw/xwin/ddraw.h xorg-server/hw/xwin/glx/glwrap.c xorg-server/hw/xwin/glx/indirect.c xorg-server/hw/xwin/glx/wgl_ext_api.h xorg-server/hw/xwin/glx/winpriv.c xorg-server/hw/xwin/win.h xorg-server/hw/xwin/winallpriv.c xorg-server/hw/xwin/winauth.c xorg-server/hw/xwin/winclipboard.h xorg-server/hw/xwin/winclipboardinit.c xorg-server/hw/xwin/winclipboardthread.c xorg-server/hw/xwin/winclipboardunicode.c xorg-server/hw/xwin/winclipboardwndproc.c xorg-server/hw/xwin/winclipboardwrappers.c xorg-server/hw/xwin/winclipboardxevents.c xorg-server/hw/xwin/wincmap.c xorg-server/hw/xwin/winconfig.c xorg-server/hw/xwin/wincreatewnd.c xorg-server/hw/xwin/wincursor.c xorg-server/hw/xwin/windialogs.c xorg-server/hw/xwin/winengine.c xorg-server/hw/xwin/winerror.c xorg-server/hw/xwin/wingc.c xorg-server/hw/xwin/wingetsp.c xorg-server/hw/xwin/winkeybd.c xorg-server/hw/xwin/winkeybd.h xorg-server/hw/xwin/winlayouts.h xorg-server/hw/xwin/winmisc.c xorg-server/hw/xwin/winmonitors.c xorg-server/hw/xwin/winmouse.c xorg-server/hw/xwin/winmsg.c xorg-server/hw/xwin/winmsg.h xorg-server/hw/xwin/winmultiwindowclass.c xorg-server/hw/xwin/winmultiwindowicons.c xorg-server/hw/xwin/winmultiwindowshape.c xorg-server/hw/xwin/winmultiwindowwindow.c xorg-server/hw/xwin/winmultiwindowwm.c xorg-server/hw/xwin/winmultiwindowwndproc.c xorg-server/hw/xwin/winnativegdi.c xorg-server/hw/xwin/winpfbdd.c xorg-server/hw/xwin/winpixmap.c xorg-server/hw/xwin/winpolyline.c xorg-server/hw/xwin/winprefs.c xorg-server/hw/xwin/winprocarg.c xorg-server/hw/xwin/winregistry.c xorg-server/hw/xwin/winscrinit.c xorg-server/hw/xwin/winsetsp.c xorg-server/hw/xwin/winshaddd.c xorg-server/hw/xwin/winshadddnl.c xorg-server/hw/xwin/winshadgdi.c xorg-server/hw/xwin/wintrayicon.c xorg-server/hw/xwin/winwin32rootless.c xorg-server/hw/xwin/winwin32rootlesswindow.c xorg-server/hw/xwin/winwin32rootlesswndproc.c xorg-server/hw/xwin/winwindow.c xorg-server/hw/xwin/winwindow.h xorg-server/hw/xwin/winwindowswm.c xorg-server/hw/xwin/winwndproc.c xorg-server/include/callback.h xorg-server/include/dixstruct.h xorg-server/include/misc.h xorg-server/include/os.h xorg-server/include/scrnintstr.h xorg-server/mi/micmap.c xorg-server/mi/miinitext.c xorg-server/mi/mioverlay.c xorg-server/mi/misprite.c xorg-server/mi/mivaltree.c xorg-server/mi/miwindow.c xorg-server/miext/damage/damage.c xorg-server/miext/rootless/rootlessGC.c xorg-server/miext/rootless/rootlessWindow.c xorg-server/os/WaitFor.c xorg-server/os/access.c xorg-server/os/connection.c xorg-server/os/io.c xorg-server/os/log.c xorg-server/os/osinit.c xorg-server/os/utils.c xorg-server/os/xdmcp.c xorg-server/os/xprintf.c xorg-server/os/xstrans.c xorg-server/render/mipict.c xorg-server/xkb/xkbActions.c xorg-server/xkb/xkbInit.c xorg-server/xkeyboard-config/compat/default.in
Diffstat (limited to 'xorg-server/mi/mivaltree.c')
-rw-r--r--xorg-server/mi/mivaltree.c897
1 files changed, 419 insertions, 478 deletions
diff --git a/xorg-server/mi/mivaltree.c b/xorg-server/mi/mivaltree.c
index f1de5bfd7..88f9a4084 100644
--- a/xorg-server/mi/mivaltree.c
+++ b/xorg-server/mi/mivaltree.c
@@ -79,15 +79,14 @@ Equipment Corporation.
******************************************************************/
-
/*
* Aug '86: Susan Angebranndt -- original code
* July '87: Adam de Boor -- substantially modified and commented
* Summer '89: Joel McCormack -- so fast you wouldn't believe it possible.
* In particular, much improved code for window mapping and
* circulating.
- * Bob Scheifler -- avoid miComputeClips for unmapped windows,
- * valdata changes
+ * Bob Scheifler -- avoid miComputeClips for unmapped windows,
+ * valdata changes
*/
#ifdef HAVE_DIX_CONFIG_H
#include <dix-config.h>
@@ -107,68 +106,66 @@ Equipment Corporation.
* Compute the visibility of a shaped window
*/
int
-miShapedWindowIn (RegionPtr universe, RegionPtr bounding,
- BoxPtr rect, int x, int y)
+miShapedWindowIn(RegionPtr universe, RegionPtr bounding,
+ BoxPtr rect, int x, int y)
{
- BoxRec box;
- BoxPtr boundBox;
- int nbox;
- Bool someIn, someOut;
- int t, x1, y1, x2, y2;
-
- nbox = RegionNumRects (bounding);
- boundBox = RegionRects (bounding);
+ BoxRec box;
+ BoxPtr boundBox;
+ int nbox;
+ Bool someIn, someOut;
+ int t, x1, y1, x2, y2;
+
+ nbox = RegionNumRects(bounding);
+ boundBox = RegionRects(bounding);
someIn = someOut = FALSE;
x1 = rect->x1;
y1 = rect->y1;
x2 = rect->x2;
y2 = rect->y2;
- while (nbox--)
- {
- if ((t = boundBox->x1 + x) < x1)
- t = x1;
- box.x1 = t;
- if ((t = boundBox->y1 + y) < y1)
- t = y1;
- box.y1 = t;
- if ((t = boundBox->x2 + x) > x2)
- t = x2;
- box.x2 = t;
- if ((t = boundBox->y2 + y) > y2)
- t = y2;
- box.y2 = t;
- if (box.x1 > box.x2)
- box.x2 = box.x1;
- if (box.y1 > box.y2)
- box.y2 = box.y1;
- switch (RegionContainsRect(universe, &box))
- {
- case rgnIN:
- if (someOut)
- return rgnPART;
- someIn = TRUE;
- break;
- case rgnOUT:
- if (someIn)
- return rgnPART;
- someOut = TRUE;
- break;
- default:
- return rgnPART;
- }
- boundBox++;
+ while (nbox--) {
+ if ((t = boundBox->x1 + x) < x1)
+ t = x1;
+ box.x1 = t;
+ if ((t = boundBox->y1 + y) < y1)
+ t = y1;
+ box.y1 = t;
+ if ((t = boundBox->x2 + x) > x2)
+ t = x2;
+ box.x2 = t;
+ if ((t = boundBox->y2 + y) > y2)
+ t = y2;
+ box.y2 = t;
+ if (box.x1 > box.x2)
+ box.x2 = box.x1;
+ if (box.y1 > box.y2)
+ box.y2 = box.y1;
+ switch (RegionContainsRect(universe, &box)) {
+ case rgnIN:
+ if (someOut)
+ return rgnPART;
+ someIn = TRUE;
+ break;
+ case rgnOUT:
+ if (someIn)
+ return rgnPART;
+ someOut = TRUE;
+ break;
+ default:
+ return rgnPART;
+ }
+ boundBox++;
}
if (someIn)
- return rgnIN;
+ return rgnIN;
return rgnOUT;
}
-static GetRedirectBorderClipProcPtr miGetRedirectBorderClipProc;
-static SetRedirectBorderClipProcPtr miSetRedirectBorderClipProc;
+static GetRedirectBorderClipProcPtr miGetRedirectBorderClipProc;
+static SetRedirectBorderClipProcPtr miSetRedirectBorderClipProc;
void
-miRegisterRedirectBorderClipProc (SetRedirectBorderClipProcPtr setBorderClip,
- GetRedirectBorderClipProcPtr getBorderClip)
+miRegisterRedirectBorderClipProc(SetRedirectBorderClipProcPtr setBorderClip,
+ GetRedirectBorderClipProcPtr getBorderClip)
{
miSetRedirectBorderClipProc = setBorderClip;
miGetRedirectBorderClipProc = getBorderClip;
@@ -189,7 +186,6 @@ miRegisterRedirectBorderClipProc (SetRedirectBorderClipProcPtr setBorderClip,
HasBorder(w) && \
(w)->backgroundState == ParentRelative)
-
/*
*-----------------------------------------------------------------------
* miComputeClips --
@@ -207,22 +203,19 @@ miRegisterRedirectBorderClipProc (SetRedirectBorderClipProcPtr setBorderClip,
*-----------------------------------------------------------------------
*/
static void
-miComputeClips (
- WindowPtr pParent,
- ScreenPtr pScreen,
- RegionPtr universe,
- VTKind kind,
- RegionPtr exposed ) /* for intermediate calculations */
-{
- int dx,
- dy;
- RegionRec childUniverse;
- WindowPtr pChild;
- int oldVis, newVis;
- BoxRec borderSize;
- RegionRec childUnion;
- Bool overlap;
- RegionPtr borderVisible;
+miComputeClips(WindowPtr pParent,
+ ScreenPtr pScreen,
+ RegionPtr universe, VTKind kind, RegionPtr exposed)
+{ /* for intermediate calculations */
+ int dx, dy;
+ RegionRec childUniverse;
+ WindowPtr pChild;
+ int oldVis, newVis;
+ BoxRec borderSize;
+ RegionRec childUnion;
+ Bool overlap;
+ RegionPtr borderVisible;
+
/*
* Figure out the new visibility of this window.
* The extent of the universe should be the same as the extent of
@@ -233,67 +226,65 @@ miComputeClips (
*/
borderSize.x1 = pParent->drawable.x - wBorderWidth(pParent);
borderSize.y1 = pParent->drawable.y - wBorderWidth(pParent);
- dx = (int) pParent->drawable.x + (int) pParent->drawable.width + wBorderWidth(pParent);
+ dx = (int) pParent->drawable.x + (int) pParent->drawable.width +
+ wBorderWidth(pParent);
if (dx > 32767)
- dx = 32767;
+ dx = 32767;
borderSize.x2 = dx;
- dy = (int) pParent->drawable.y + (int) pParent->drawable.height + wBorderWidth(pParent);
+ dy = (int) pParent->drawable.y + (int) pParent->drawable.height +
+ wBorderWidth(pParent);
if (dy > 32767)
- dy = 32767;
+ dy = 32767;
borderSize.y2 = dy;
#ifdef COMPOSITE
/*
* In redirected drawing case, reset universe to borderSize
*/
- if (pParent->redirectDraw != RedirectDrawNone)
- {
- if (miSetRedirectBorderClipProc)
- {
- if (TreatAsTransparent (pParent))
- RegionEmpty(universe);
- (*miSetRedirectBorderClipProc) (pParent, universe);
- }
- RegionCopy(universe, &pParent->borderSize);
+ if (pParent->redirectDraw != RedirectDrawNone) {
+ if (miSetRedirectBorderClipProc) {
+ if (TreatAsTransparent(pParent))
+ RegionEmpty(universe);
+ (*miSetRedirectBorderClipProc) (pParent, universe);
+ }
+ RegionCopy(universe, &pParent->borderSize);
}
#endif
oldVis = pParent->visibility;
- switch (RegionContainsRect(universe, &borderSize))
- {
- case rgnIN:
- newVis = VisibilityUnobscured;
- break;
- case rgnPART:
- newVis = VisibilityPartiallyObscured;
- {
- RegionPtr pBounding;
-
- if ((pBounding = wBoundingShape (pParent)))
- {
- switch (miShapedWindowIn (universe, pBounding,
- &borderSize,
- pParent->drawable.x,
- pParent->drawable.y))
- {
- case rgnIN:
- newVis = VisibilityUnobscured;
- break;
- case rgnOUT:
- newVis = VisibilityFullyObscured;
- break;
- }
- }
- }
- break;
- default:
- newVis = VisibilityFullyObscured;
- break;
+ switch (RegionContainsRect(universe, &borderSize)) {
+ case rgnIN:
+ newVis = VisibilityUnobscured;
+ break;
+ case rgnPART:
+ newVis = VisibilityPartiallyObscured;
+ {
+ RegionPtr pBounding;
+
+ if ((pBounding = wBoundingShape(pParent))) {
+ switch (miShapedWindowIn(universe, pBounding,
+ &borderSize,
+ pParent->drawable.x,
+ pParent->drawable.y)) {
+ case rgnIN:
+ newVis = VisibilityUnobscured;
+ break;
+ case rgnOUT:
+ newVis = VisibilityFullyObscured;
+ break;
+ }
+ }
+ }
+ break;
+ default:
+ newVis = VisibilityFullyObscured;
+ break;
}
pParent->visibility = newVis;
if (oldVis != newVis &&
- ((pParent->eventMask | wOtherEventMasks(pParent)) & VisibilityChangeMask))
- SendVisibilityNotify(pParent);
+ ((pParent->
+ eventMask | wOtherEventMasks(pParent)) & VisibilityChangeMask))
+ SendVisibilityNotify(pParent);
if (pParent->valdata==UnmapValData)
return; // return if no valid valdata
@@ -309,74 +300,64 @@ miComputeClips (
case VTMap:
case VTStack:
case VTUnmap:
- break;
+ break;
case VTMove:
- if ((oldVis == newVis) &&
- ((oldVis == VisibilityFullyObscured) ||
- (oldVis == VisibilityUnobscured)))
- {
- pChild = pParent;
- while (1)
- {
- if (pChild->viewable)
- {
- if (pChild->visibility != VisibilityFullyObscured)
- {
- RegionTranslate(&pChild->borderClip,
- dx, dy);
- RegionTranslate(&pChild->clipList,
- dx, dy);
- pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- if (pScreen->ClipNotify)
- (* pScreen->ClipNotify) (pChild, dx, dy);
-
- }
- if (pChild->valdata)
- {
- RegionNull(&pChild->valdata->after.borderExposed);
- if (HasParentRelativeBorder(pChild))
- {
- RegionSubtract(&pChild->valdata->after.borderExposed,
- &pChild->borderClip,
- &pChild->winSize);
- }
- RegionNull(&pChild->valdata->after.exposed);
- }
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- }
- while (!pChild->nextSib && (pChild != pParent))
- pChild = pChild->parent;
- if (pChild == pParent)
- break;
- pChild = pChild->nextSib;
- }
- return;
- }
- /* fall through */
+ if ((oldVis == newVis) &&
+ ((oldVis == VisibilityFullyObscured) ||
+ (oldVis == VisibilityUnobscured))) {
+ pChild = pParent;
+ while (1) {
+ if (pChild->viewable) {
+ if (pChild->visibility != VisibilityFullyObscured) {
+ RegionTranslate(&pChild->borderClip, dx, dy);
+ RegionTranslate(&pChild->clipList, dx, dy);
+ pChild->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ if (pScreen->ClipNotify)
+ (*pScreen->ClipNotify) (pChild, dx, dy);
+
+ }
+ if (pChild->valdata) {
+ RegionNull(&pChild->valdata->after.borderExposed);
+ if (HasParentRelativeBorder(pChild)) {
+ RegionSubtract(&pChild->valdata->after.
+ borderExposed, &pChild->borderClip,
+ &pChild->winSize);
+ }
+ RegionNull(&pChild->valdata->after.exposed);
+ }
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ }
+ while (!pChild->nextSib && (pChild != pParent))
+ pChild = pChild->parent;
+ if (pChild == pParent)
+ break;
+ pChild = pChild->nextSib;
+ }
+ return;
+ }
+ /* fall through */
default:
- /*
- * To calculate exposures correctly, we have to translate the old
- * borderClip and clipList regions to the window's new location so there
- * is a correspondence between pieces of the new and old clipping regions.
- */
- if (dx || dy)
- {
- /*
- * We translate the old clipList because that will be exposed or copied
- * if gravity is right.
- */
- RegionTranslate(&pParent->borderClip, dx, dy);
- RegionTranslate(&pParent->clipList, dx, dy);
- }
- break;
+ /*
+ * To calculate exposures correctly, we have to translate the old
+ * borderClip and clipList regions to the window's new location so there
+ * is a correspondence between pieces of the new and old clipping regions.
+ */
+ if (dx || dy) {
+ /*
+ * We translate the old clipList because that will be exposed or copied
+ * if gravity is right.
+ */
+ RegionTranslate(&pParent->borderClip, dx, dy);
+ RegionTranslate(&pParent->clipList, dx, dy);
+ }
+ break;
case VTBroken:
- RegionEmpty(&pParent->borderClip);
- RegionEmpty(&pParent->clipList);
- break;
+ RegionEmpty(&pParent->borderClip);
+ RegionEmpty(&pParent->clipList);
+ break;
}
borderVisible = pParent->valdata->before.borderVisible;
@@ -392,103 +373,89 @@ miComputeClips (
* This leaves a region of pieces that weren't exposed before.
*/
- if (HasBorder (pParent))
- {
- if (borderVisible)
- {
- /*
- * when the border changes shape, the old visible portions
- * of the border will be saved by DIX in borderVisible --
- * use that region and destroy it
- */
- RegionSubtract(exposed, universe, borderVisible);
- RegionDestroy(borderVisible);
- }
- else
- {
- RegionSubtract(exposed, universe, &pParent->borderClip);
- }
- if (HasParentRelativeBorder(pParent) && (dx || dy))
- RegionSubtract(&pParent->valdata->after.borderExposed,
- universe,
- &pParent->winSize);
- else
- RegionSubtract(&pParent->valdata->after.borderExposed,
- exposed, &pParent->winSize);
-
- RegionCopy(&pParent->borderClip, universe);
-
- /*
- * To get the right clipList for the parent, and to make doubly sure
- * that no child overlaps the parent's border, we remove the parent's
- * border from the universe before proceeding.
- */
-
- RegionIntersect(universe, universe, &pParent->winSize);
+ if (HasBorder(pParent)) {
+ if (borderVisible) {
+ /*
+ * when the border changes shape, the old visible portions
+ * of the border will be saved by DIX in borderVisible --
+ * use that region and destroy it
+ */
+ RegionSubtract(exposed, universe, borderVisible);
+ RegionDestroy(borderVisible);
+ }
+ else {
+ RegionSubtract(exposed, universe, &pParent->borderClip);
+ }
+ if (HasParentRelativeBorder(pParent) && (dx || dy))
+ RegionSubtract(&pParent->valdata->after.borderExposed,
+ universe, &pParent->winSize);
+ else
+ RegionSubtract(&pParent->valdata->after.borderExposed,
+ exposed, &pParent->winSize);
+
+ RegionCopy(&pParent->borderClip, universe);
+
+ /*
+ * To get the right clipList for the parent, and to make doubly sure
+ * that no child overlaps the parent's border, we remove the parent's
+ * border from the universe before proceeding.
+ */
+
+ RegionIntersect(universe, universe, &pParent->winSize);
}
else
- RegionCopy(&pParent->borderClip, universe);
-
- if ((pChild = pParent->firstChild) && pParent->mapped)
- {
- RegionNull(&childUniverse);
- RegionNull(&childUnion);
- if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
- ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
- (pChild->drawable.x < pParent->lastChild->drawable.x)))
- {
- for (; pChild; pChild = pChild->nextSib)
- {
- if (pChild->viewable && !TreatAsTransparent(pChild))
- RegionAppend(&childUnion, &pChild->borderSize);
- }
- }
- else
- {
- for (pChild = pParent->lastChild; pChild; pChild = pChild->prevSib)
- {
- if (pChild->viewable && !TreatAsTransparent(pChild))
- RegionAppend(&childUnion, &pChild->borderSize);
- }
- }
- RegionValidate(&childUnion, &overlap);
-
- for (pChild = pParent->firstChild;
- pChild;
- pChild = pChild->nextSib)
- {
- if (pChild->viewable) {
- /*
- * If the child is viewable, we want to remove its extents
- * from the current universe, but we only re-clip it if
- * it's been marked.
- */
- if (pChild->valdata) {
- /*
- * Figure out the new universe from the child's
- * perspective and recurse.
- */
- RegionIntersect(&childUniverse,
- universe,
- &pChild->borderSize);
- miComputeClips (pChild, pScreen, &childUniverse, kind,
- exposed);
- }
- /*
- * Once the child has been processed, we remove its extents
- * from the current universe, thus denying its space to any
- * other sibling.
- */
- if (overlap && !TreatAsTransparent (pChild))
- RegionSubtract(universe, universe,
- &pChild->borderSize);
- }
- }
- if (!overlap)
- RegionSubtract(universe, universe, &childUnion);
- RegionUninit(&childUnion);
- RegionUninit(&childUniverse);
- } /* if any children */
+ RegionCopy(&pParent->borderClip, universe);
+
+ if ((pChild = pParent->firstChild) && pParent->mapped) {
+ RegionNull(&childUniverse);
+ RegionNull(&childUnion);
+ if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
+ ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
+ (pChild->drawable.x < pParent->lastChild->drawable.x))) {
+ for (; pChild; pChild = pChild->nextSib) {
+ if (pChild->viewable && !TreatAsTransparent(pChild))
+ RegionAppend(&childUnion, &pChild->borderSize);
+ }
+ }
+ else {
+ for (pChild = pParent->lastChild; pChild; pChild = pChild->prevSib) {
+ if (pChild->viewable && !TreatAsTransparent(pChild))
+ RegionAppend(&childUnion, &pChild->borderSize);
+ }
+ }
+ RegionValidate(&childUnion, &overlap);
+
+ for (pChild = pParent->firstChild; pChild; pChild = pChild->nextSib) {
+ if (pChild->viewable) {
+ /*
+ * If the child is viewable, we want to remove its extents
+ * from the current universe, but we only re-clip it if
+ * it's been marked.
+ */
+ if (pChild->valdata) {
+ /*
+ * Figure out the new universe from the child's
+ * perspective and recurse.
+ */
+ RegionIntersect(&childUniverse,
+ universe, &pChild->borderSize);
+ miComputeClips(pChild, pScreen, &childUniverse, kind,
+ exposed);
+ }
+ /*
+ * Once the child has been processed, we remove its extents
+ * from the current universe, thus denying its space to any
+ * other sibling.
+ */
+ if (overlap && !TreatAsTransparent(pChild))
+ RegionSubtract(universe, universe, &pChild->borderSize);
+ }
+ }
+ if (!overlap)
+ RegionSubtract(universe, universe, &childUnion);
+ RegionUninit(&childUnion);
+ RegionUninit(&childUniverse);
+ } /* if any children */
/*
* 'universe' now contains the new clipList for the parent window.
@@ -497,25 +464,22 @@ miComputeClips (
* new, just as for the border.
*/
- if (oldVis == VisibilityFullyObscured ||
- oldVis == VisibilityNotViewable)
- {
- RegionCopy(&pParent->valdata->after.exposed, universe);
+ if (oldVis == VisibilityFullyObscured || oldVis == VisibilityNotViewable) {
+ RegionCopy(&pParent->valdata->after.exposed, universe);
}
else if (newVis != VisibilityFullyObscured &&
- newVis != VisibilityNotViewable)
- {
- RegionSubtract(&pParent->valdata->after.exposed,
- universe, &pParent->clipList);
+ newVis != VisibilityNotViewable) {
+ RegionSubtract(&pParent->valdata->after.exposed,
+ universe, &pParent->clipList);
}
/* HACK ALERT - copying contents of regions, instead of regions */
{
- RegionRec tmp;
+ RegionRec tmp;
- tmp = pParent->clipList;
- pParent->clipList = *universe;
- *universe = tmp;
+ tmp = pParent->clipList;
+ pParent->clipList = *universe;
+ *universe = tmp;
}
#ifdef NOTDEF
@@ -525,36 +489,33 @@ miComputeClips (
pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER;
if (pScreen->ClipNotify)
- (* pScreen->ClipNotify) (pParent, dx, dy);
+ (*pScreen->ClipNotify) (pParent, dx, dy);
}
static void
-miTreeObscured(
- WindowPtr pParent )
+miTreeObscured(WindowPtr pParent)
{
- WindowPtr pChild;
- int oldVis;
+ WindowPtr pChild;
+ int oldVis;
pChild = pParent;
- while (1)
- {
- if (pChild->viewable)
- {
- oldVis = pChild->visibility;
- if (oldVis != (pChild->visibility = VisibilityFullyObscured) &&
- ((pChild->eventMask | wOtherEventMasks(pChild)) & VisibilityChangeMask))
- SendVisibilityNotify(pChild);
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- }
- while (!pChild->nextSib && (pChild != pParent))
- pChild = pChild->parent;
- if (pChild == pParent)
- break;
- pChild = pChild->nextSib;
+ while (1) {
+ if (pChild->viewable) {
+ oldVis = pChild->visibility;
+ if (oldVis != (pChild->visibility = VisibilityFullyObscured) &&
+ ((pChild->
+ eventMask | wOtherEventMasks(pChild)) & VisibilityChangeMask))
+ SendVisibilityNotify(pChild);
+ if (pChild->firstChild) {
+ pChild = pChild->firstChild;
+ continue;
+ }
+ }
+ while (!pChild->nextSib && (pChild != pParent))
+ pChild = pChild->parent;
+ if (pChild == pParent)
+ break;
+ pChild = pChild->nextSib;
}
}
@@ -587,33 +548,31 @@ miTreeObscured(
*
*-----------------------------------------------------------------------
*/
-/*ARGSUSED*/
-int
-miValidateTree (
- WindowPtr pParent, /* Parent to validate */
- WindowPtr pChild, /* First child of pParent that was
- * affected */
- VTKind kind /* What kind of configuration caused call */
+ /*ARGSUSED*/ int
+miValidateTree(WindowPtr pParent, /* Parent to validate */
+ WindowPtr pChild, /* First child of pParent that was
+ * affected */
+ VTKind kind /* What kind of configuration caused call */
)
{
- RegionRec totalClip; /* Total clipping region available to
- * the marked children. pParent's clipList
- * merged with the borderClips of all
- * the marked children. */
- RegionRec childClip; /* The new borderClip for the current
- * child */
- RegionRec childUnion; /* the space covered by borderSize for
- * all marked children */
- RegionRec exposed; /* For intermediate calculations */
- ScreenPtr pScreen;
- WindowPtr pWin;
- Bool overlap;
- int viewvals;
- Bool forward;
+ RegionRec totalClip; /* Total clipping region available to
+ * the marked children. pParent's clipList
+ * merged with the borderClips of all
+ * the marked children. */
+ RegionRec childClip; /* The new borderClip for the current
+ * child */
+ RegionRec childUnion; /* the space covered by borderSize for
+ * all marked children */
+ RegionRec exposed; /* For intermediate calculations */
+ ScreenPtr pScreen;
+ WindowPtr pWin;
+ Bool overlap;
+ int viewvals;
+ Bool forward;
pScreen = pParent->drawable.pScreen;
if (pChild == NullWindow)
- pChild = pParent->firstChild;
+ pChild = pParent->firstChild;
RegionNull(&childClip);
RegionNull(&exposed);
@@ -626,74 +585,68 @@ miValidateTree (
*/
RegionNull(&totalClip);
viewvals = 0;
- if (RegionBroken(&pParent->clipList) &&
- !RegionBroken(&pParent->borderClip))
- {
- kind = VTBroken;
- /*
- * When rebuilding clip lists after out of memory,
- * assume everything is busted.
- */
- forward = TRUE;
- RegionCopy(&totalClip, &pParent->borderClip);
- RegionIntersect(&totalClip, &totalClip, &pParent->winSize);
-
- for (pWin = pParent->firstChild; pWin != pChild; pWin = pWin->nextSib)
- {
- if (pWin->viewable && !TreatAsTransparent (pWin))
- RegionSubtract(&totalClip, &totalClip, &pWin->borderSize);
- }
- for (pWin = pChild; pWin; pWin = pWin->nextSib)
- if (pWin->valdata && pWin->viewable)
- viewvals++;
-
- RegionEmpty(&pParent->clipList);
+ if (RegionBroken(&pParent->clipList) && !RegionBroken(&pParent->borderClip)) {
+ kind = VTBroken;
+ /*
+ * When rebuilding clip lists after out of memory,
+ * assume everything is busted.
+ */
+ forward = TRUE;
+ RegionCopy(&totalClip, &pParent->borderClip);
+ RegionIntersect(&totalClip, &totalClip, &pParent->winSize);
+
+ for (pWin = pParent->firstChild; pWin != pChild; pWin = pWin->nextSib) {
+ if (pWin->viewable && !TreatAsTransparent(pWin))
+ RegionSubtract(&totalClip, &totalClip, &pWin->borderSize);
+ }
+ for (pWin = pChild; pWin; pWin = pWin->nextSib)
+ if (pWin->valdata && pWin->viewable)
+ viewvals++;
+
+ RegionEmpty(&pParent->clipList);
}
- else
- {
- if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
- ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
- (pChild->drawable.x < pParent->lastChild->drawable.x)))
- {
- forward = TRUE;
- for (pWin = pChild; pWin; pWin = pWin->nextSib)
- {
- if (pWin->valdata)
- {
- RegionPtr pBorderClip = &pWin->borderClip;
+ else {
+ if ((pChild->drawable.y < pParent->lastChild->drawable.y) ||
+ ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
+ (pChild->drawable.x < pParent->lastChild->drawable.x))) {
+ forward = TRUE;
+ for (pWin = pChild; pWin; pWin = pWin->nextSib) {
+ if (pWin->valdata) {
+ RegionPtr pBorderClip = &pWin->borderClip;
+
#ifdef COMPOSITE
- if (pWin->redirectDraw != RedirectDrawNone && miGetRedirectBorderClipProc)
- pBorderClip = (*miGetRedirectBorderClipProc)(pWin);
+ if (pWin->redirectDraw != RedirectDrawNone &&
+ miGetRedirectBorderClipProc)
+ pBorderClip = (*miGetRedirectBorderClipProc) (pWin);
#endif
- RegionAppend(&totalClip, pBorderClip );
- if (pWin->viewable)
- viewvals++;
- }
- }
- }
- else
- {
- forward = FALSE;
- pWin = pParent->lastChild;
- while (1)
- {
- if (pWin->valdata)
- {
- RegionPtr pBorderClip = &pWin->borderClip;
+ RegionAppend(&totalClip, pBorderClip);
+ if (pWin->viewable)
+ viewvals++;
+ }
+ }
+ }
+ else {
+ forward = FALSE;
+ pWin = pParent->lastChild;
+ while (1) {
+ if (pWin->valdata) {
+ RegionPtr pBorderClip = &pWin->borderClip;
+
#ifdef COMPOSITE
- if (pWin->redirectDraw != RedirectDrawNone && miGetRedirectBorderClipProc)
- pBorderClip = (*miGetRedirectBorderClipProc)(pWin);
+ if (pWin->redirectDraw != RedirectDrawNone &&
+ miGetRedirectBorderClipProc)
+ pBorderClip = (*miGetRedirectBorderClipProc) (pWin);
#endif
- RegionAppend(&totalClip, pBorderClip );
- if (pWin->viewable)
- viewvals++;
- }
- if (pWin == pChild)
- break;
- pWin = pWin->prevSib;
- }
- }
- RegionValidate(&totalClip, &overlap);
+ RegionAppend(&totalClip, pBorderClip);
+ if (pWin->viewable)
+ viewvals++;
+ }
+ if (pWin == pChild)
+ break;
+ pWin = pWin->prevSib;
+ }
+ }
+ RegionValidate(&totalClip, &overlap);
}
/*
@@ -704,80 +657,68 @@ miValidateTree (
*/
overlap = TRUE;
- if (kind != VTStack)
- {
- RegionUnion(&totalClip, &totalClip, &pParent->clipList);
- if (viewvals > 1)
- {
- /*
- * precompute childUnion to discover whether any of them
- * overlap. This seems redundant, but performance studies
- * have demonstrated that the cost of this loop is
- * lower than the cost of multiple Subtracts in the
- * loop below.
- */
- RegionNull(&childUnion);
- if (forward)
- {
- for (pWin = pChild; pWin; pWin = pWin->nextSib)
- if (pWin->valdata && pWin->viewable && !TreatAsTransparent (pWin))
- RegionAppend(&childUnion,
- &pWin->borderSize);
- }
- else
- {
- pWin = pParent->lastChild;
- while (1)
- {
- if (pWin->valdata && pWin->viewable && !TreatAsTransparent (pWin))
- RegionAppend(&childUnion,
- &pWin->borderSize);
- if (pWin == pChild)
- break;
- pWin = pWin->prevSib;
- }
- }
- RegionValidate(&childUnion, &overlap);
- if (overlap)
- RegionUninit(&childUnion);
- }
+ if (kind != VTStack) {
+ RegionUnion(&totalClip, &totalClip, &pParent->clipList);
+ if (viewvals > 1) {
+ /*
+ * precompute childUnion to discover whether any of them
+ * overlap. This seems redundant, but performance studies
+ * have demonstrated that the cost of this loop is
+ * lower than the cost of multiple Subtracts in the
+ * loop below.
+ */
+ RegionNull(&childUnion);
+ if (forward) {
+ for (pWin = pChild; pWin; pWin = pWin->nextSib)
+ if (pWin->valdata && pWin->viewable &&
+ !TreatAsTransparent(pWin))
+ RegionAppend(&childUnion, &pWin->borderSize);
+ }
+ else {
+ pWin = pParent->lastChild;
+ while (1) {
+ if (pWin->valdata && pWin->viewable &&
+ !TreatAsTransparent(pWin))
+ RegionAppend(&childUnion, &pWin->borderSize);
+ if (pWin == pChild)
+ break;
+ pWin = pWin->prevSib;
+ }
+ }
+ RegionValidate(&childUnion, &overlap);
+ if (overlap)
+ RegionUninit(&childUnion);
+ }
}
- for (pWin = pChild;
- pWin != NullWindow;
- pWin = pWin->nextSib)
- {
- if (pWin->viewable) {
- if (pWin->valdata) {
- RegionIntersect(&childClip,
- &totalClip,
- &pWin->borderSize);
- miComputeClips (pWin, pScreen, &childClip, kind, &exposed);
- if (overlap && !TreatAsTransparent (pWin))
- {
- RegionSubtract(&totalClip,
- &totalClip,
- &pWin->borderSize);
- }
- } else if (pWin->visibility == VisibilityNotViewable) {
- miTreeObscured(pWin);
- }
- } else {
- if (pWin->valdata) {
- RegionEmpty(&pWin->clipList);
- if (pScreen->ClipNotify)
- (* pScreen->ClipNotify) (pWin, 0, 0);
- RegionEmpty(&pWin->borderClip);
- pWin->valdata = NULL;
- }
- }
+ for (pWin = pChild; pWin != NullWindow; pWin = pWin->nextSib) {
+ if (pWin->viewable) {
+ if (pWin->valdata) {
+ RegionIntersect(&childClip, &totalClip, &pWin->borderSize);
+ miComputeClips(pWin, pScreen, &childClip, kind, &exposed);
+ if (overlap && !TreatAsTransparent(pWin)) {
+ RegionSubtract(&totalClip, &totalClip, &pWin->borderSize);
+ }
+ }
+ else if (pWin->visibility == VisibilityNotViewable) {
+ miTreeObscured(pWin);
+ }
+ }
+ else {
+ if (pWin->valdata) {
+ RegionEmpty(&pWin->clipList);
+ if (pScreen->ClipNotify)
+ (*pScreen->ClipNotify) (pWin, 0, 0);
+ RegionEmpty(&pWin->borderClip);
+ pWin->valdata = NULL;
+ }
+ }
}
RegionUninit(&childClip);
- if (!overlap)
- {
- RegionSubtract(&totalClip, &totalClip, &childUnion);
- RegionUninit(&childUnion);
+ if (!overlap) {
+ RegionSubtract(&totalClip, &totalClip, &childUnion);
+ RegionUninit(&childUnion);
}
if (pParent->valdata && pParent->valdata!=UnmapValData)
@@ -792,26 +733,26 @@ miValidateTree (
switch (kind) {
case VTStack:
- break;
+ break;
default:
- /*
- * totalClip contains the new clipList for the parent. Figure out
- * exposures and obscures as per miComputeClips and reset the parent's
- * clipList.
- */
- if (pParent->valdata && pParent->valdata!=UnmapValData)
- RegionSubtract(&pParent->valdata->after.exposed,
- &totalClip, &pParent->clipList);
- /* fall through */
+ /*
+ * totalClip contains the new clipList for the parent. Figure out
+ * exposures and obscures as per miComputeClips and reset the parent's
+ * clipList.
+ */
+ if (pParent->valdata && pParent->valdata!=UnmapValData)
+ RegionSubtract(&pParent->valdata->after.exposed,
+ &totalClip, &pParent->clipList);
+ /* fall through */
case VTMap:
- RegionCopy(&pParent->clipList, &totalClip);
- pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- break;
+ RegionCopy(&pParent->clipList, &totalClip);
+ pParent->drawable.serialNumber = NEXT_SERIAL_NUMBER;
+ break;
}
RegionUninit(&totalClip);
RegionUninit(&exposed);
if (pScreen->ClipNotify)
- (*pScreen->ClipNotify) (pParent, 0, 0);
+ (*pScreen->ClipNotify) (pParent, 0, 0);
return 1;
}