[PATCH 2/8] mi: miValidateTree based on paintable not viewable (v2)

Adam Jackson ajax at redhat.com
Wed Feb 25 13:03:08 PST 2015


v2: Incorporate keithp's review notes

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 mi/mivaltree.c | 110 ++++++++++++++++++++++++++++++---------------------------
 1 file changed, 58 insertions(+), 52 deletions(-)

diff --git a/mi/mivaltree.c b/mi/mivaltree.c
index ea6889f..f8a25b8 100644
--- a/mi/mivaltree.c
+++ b/mi/mivaltree.c
@@ -164,14 +164,16 @@ miShapedWindowIn(RegionPtr universe, RegionPtr bounding,
 
 /*
  * Manual redirected windows are treated as transparent; they do not obscure
- * siblings or parent windows
+ * siblings or parent windows.  Likewise windows that are paintable but not
+ * mapped.
  */
 
-#ifdef COMPOSITE
-#define TreatAsTransparent(w)	((w)->redirectDraw == RedirectDrawManual)
-#else
-#define TreatAsTransparent(w)	FALSE
-#endif
+static Bool
+TreatAsTransparent(WindowPtr w)
+{
+    return (w->redirectDraw == RedirectDrawManual) ||
+        (w->paintable && !w->mapped);
+}
 
 #define HasParentRelativeBorder(w) (!(w)->borderIsPixel && \
 				    HasBorder(w) && \
@@ -181,7 +183,7 @@ miShapedWindowIn(RegionPtr universe, RegionPtr bounding,
  *-----------------------------------------------------------------------
  * miComputeClips --
  *	Recompute the clipList, borderClip, exposed and borderExposed
- *	regions for pParent and its children. Only viewable windows are
+ *	regions for pParent and its children. Only paintable windows are
  *	taken into account.
  *
  * Results:
@@ -240,34 +242,39 @@ miComputeClips(WindowPtr pParent,
     }
 #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;
+    oldVis = newVis = pParent->visibility;
+    if (pParent->realized) {
+        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;
         }
-        break;
-    default:
-        newVis = VisibilityFullyObscured;
-        break;
+    }
+    else {
+        newVis = VisibilityNotViewable;
     }
     pParent->visibility = newVis;
     if (oldVis != newVis &&
@@ -293,14 +300,13 @@ miComputeClips(WindowPtr pParent,
              (oldVis == VisibilityUnobscured))) {
             pChild = pParent;
             while (1) {
-                if (pChild->viewable) {
+                if (pChild->paintable) {
                     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);
@@ -399,22 +405,22 @@ miComputeClips(WindowPtr pParent,
             ((pChild->drawable.y == pParent->lastChild->drawable.y) &&
              (pChild->drawable.x < pParent->lastChild->drawable.x))) {
             for (; pChild; pChild = pChild->nextSib) {
-                if (pChild->viewable && !TreatAsTransparent(pChild))
+                if (pChild->paintable && !TreatAsTransparent(pChild))
                     RegionAppend(&childUnion, &pChild->borderSize);
             }
         }
         else {
             for (pChild = pParent->lastChild; pChild; pChild = pChild->prevSib) {
-                if (pChild->viewable && !TreatAsTransparent(pChild))
+                if (pChild->paintable && !TreatAsTransparent(pChild))
                     RegionAppend(&childUnion, &pChild->borderSize);
             }
         }
         RegionValidate(&childUnion, &overlap);
 
         for (pChild = pParent->firstChild; pChild; pChild = pChild->nextSib) {
-            if (pChild->viewable) {
+            if (pChild->paintable) {
                 /*
-                 * If the child is viewable, we want to remove its extents
+                 * If the child is paintable, we want to remove its extents
                  * from the current universe, but we only re-clip it if
                  * it's been marked.
                  */
@@ -564,7 +570,7 @@ miValidateTree(WindowPtr pParent,       /* Parent to validate */
     ScreenPtr pScreen;
     WindowPtr pWin;
     Bool overlap;
-    int viewvals;
+    int paintables = 0;
     Bool forward;
 
     pScreen = pParent->drawable.pScreen;
@@ -581,7 +587,6 @@ miValidateTree(WindowPtr pParent,       /* Parent to validate */
      * children in their new configuration.
      */
     RegionNull(&totalClip);
-    viewvals = 0;
     if (RegionBroken(&pParent->clipList) && !RegionBroken(&pParent->borderClip)) {
         kind = VTBroken;
         /*
@@ -593,12 +598,12 @@ miValidateTree(WindowPtr pParent,       /* Parent to validate */
         RegionIntersect(&totalClip, &totalClip, &pParent->winSize);
 
         for (pWin = pParent->firstChild; pWin != pChild; pWin = pWin->nextSib) {
-            if (pWin->viewable && !TreatAsTransparent(pWin))
+            if (pWin->paintable && !TreatAsTransparent(pWin))
                 RegionSubtract(&totalClip, &totalClip, &pWin->borderSize);
         }
         for (pWin = pChild; pWin; pWin = pWin->nextSib)
-            if (pWin->valdata && pWin->viewable)
-                viewvals++;
+            if (pWin->valdata && pWin->paintable)
+                paintables++;
 
         RegionEmpty(&pParent->clipList);
     }
@@ -610,8 +615,8 @@ miValidateTree(WindowPtr pParent,       /* Parent to validate */
             for (pWin = pChild; pWin; pWin = pWin->nextSib) {
                 if (pWin->valdata) {
                     RegionAppend(&totalClip, getBorderClip(pWin));
-                    if (pWin->viewable)
-                        viewvals++;
+                    if (pWin->paintable)
+                        paintables++;
                 }
             }
         }
@@ -621,8 +626,8 @@ miValidateTree(WindowPtr pParent,       /* Parent to validate */
             while (1) {
                 if (pWin->valdata) {
                     RegionAppend(&totalClip, getBorderClip(pWin));
-                    if (pWin->viewable)
-                        viewvals++;
+                    if (pWin->paintable)
+                        paintables++;
                 }
                 if (pWin == pChild)
                     break;
@@ -642,7 +647,7 @@ miValidateTree(WindowPtr pParent,       /* Parent to validate */
     overlap = TRUE;
     if (kind != VTStack) {
         RegionUnion(&totalClip, &totalClip, &pParent->clipList);
-        if (viewvals > 1) {
+        if (paintables > 1) {
             /*
              * precompute childUnion to discover whether any of them
              * overlap.  This seems redundant, but performance studies
@@ -653,14 +658,14 @@ miValidateTree(WindowPtr pParent,       /* Parent to validate */
             RegionNull(&childUnion);
             if (forward) {
                 for (pWin = pChild; pWin; pWin = pWin->nextSib)
-                    if (pWin->valdata && pWin->viewable &&
+                    if (pWin->valdata && pWin->paintable &&
                         !TreatAsTransparent(pWin))
                         RegionAppend(&childUnion, &pWin->borderSize);
             }
             else {
                 pWin = pParent->lastChild;
                 while (1) {
-                    if (pWin->valdata && pWin->viewable &&
+                    if (pWin->valdata && pWin->paintable &&
                         !TreatAsTransparent(pWin))
                         RegionAppend(&childUnion, &pWin->borderSize);
                     if (pWin == pChild)
@@ -675,7 +680,7 @@ miValidateTree(WindowPtr pParent,       /* Parent to validate */
     }
 
     for (pWin = pChild; pWin != NullWindow; pWin = pWin->nextSib) {
-        if (pWin->viewable) {
+        if (pWin->paintable) {
             if (pWin->valdata) {
                 RegionIntersect(&childClip, &totalClip, &pWin->borderSize);
                 miComputeClips(pWin, pScreen, &childClip, kind, &exposed);
@@ -683,7 +688,8 @@ miValidateTree(WindowPtr pParent,       /* Parent to validate */
                     RegionSubtract(&totalClip, &totalClip, &pWin->borderSize);
                 }
             }
-            else if (pWin->visibility == VisibilityNotViewable) {
+            else if (pWin->viewable &&
+                     pWin->visibility == VisibilityNotViewable) {
                 miTreeObscured(pWin);
             }
         }
-- 
1.9.3



More information about the xorg-devel mailing list