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

Adam Jackson ajax at redhat.com
Mon Nov 17 12:41:09 PST 2014


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

diff --git a/mi/mivaltree.c b/mi/mivaltree.c
index 8e4e9a9..024af18 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,37 +242,45 @@ 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:
+    }
+    else if (pParent->paintable)
         newVis = VisibilityFullyObscured;
-        break;
+    else {
+        newVis = VisibilityNotViewable;
     }
     pParent->visibility = newVis;
-    if (oldVis != newVis &&
+    if (pParent->realized &&
+        oldVis != newVis &&
         ((pParent->
           eventMask | wOtherEventMasks(pParent)) & VisibilityChangeMask))
         SendVisibilityNotify(pParent);
@@ -293,14 +303,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 +408,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 +573,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 +590,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 +601,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 +618,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 +629,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 +650,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 +661,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 +683,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);
-- 
1.9.3



More information about the xorg-devel mailing list