[PATCH xserver 5/7] dix: Update window state based on paintable not viewable

Adam Jackson ajax at redhat.com
Tue Jul 24 19:51:26 UTC 2018


Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 dix/window.c | 69 ++++++++++++++++++++++++----------------------------
 1 file changed, 32 insertions(+), 37 deletions(-)

diff --git a/dix/window.c b/dix/window.c
index ea3920c869..55290577d9 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -1589,7 +1589,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
        for the tile to be rotated, and the correct function selected.
      */
     if (((vmaskCopy & (CWBorderPixel | CWBorderPixmap)) || borderRelative)
-        && pWin->viewable && HasBorder(pWin)) {
+        && pWin->paintable && HasBorder(pWin)) {
         RegionRec exposed;
 
         RegionNull(&exposed);
@@ -2163,7 +2163,7 @@ ReflectStackChange(WindowPtr pWin, WindowPtr pSib, VTKind kind)
 {
 /* Note that pSib might be NULL */
 
-    Bool WasViewable = (Bool) pWin->viewable;
+    Bool WasPaintable = (Bool) pWin->paintable;
     Bool anyMarked;
     WindowPtr pFirstChange;
     WindowPtr pLayerWin;
@@ -2175,7 +2175,7 @@ ReflectStackChange(WindowPtr pWin, WindowPtr pSib, VTKind kind)
 
     pFirstChange = MoveWindowInStack(pWin, pSib);
 
-    if (WasViewable) {
+    if (WasPaintable) {
         anyMarked = (*pScreen->MarkOverlappedWindows) (pWin, pFirstChange,
                                                        &pLayerWin);
         if (pLayerWin != pWin)
@@ -2614,7 +2614,7 @@ RealizeTree(WindowPtr pWin)
     pChild = pWin;
     while (1) {
         if (pChild->mapped) {
-            pChild->realized = TRUE;
+            pChild->realized = pChild->parent->realized;
             pChild->viewable = (pChild->drawable.class == InputOutput);
             pChild->paintable = (pChild->drawable.class == InputOutput);
             (*Realize) (pChild);
@@ -2692,7 +2692,7 @@ MapWindow(WindowPtr pWin, ClientPtr client)
         if (SubStrSend(pWin, pParent))
             DeliverMapNotify(pWin);
 
-        if (!pParent->realized)
+        if (!pParent->realized && !pParent->paintable)
             return Success;
         RealizeTree(pWin);
         if (pWin->viewable) {
@@ -2763,7 +2763,7 @@ MapSubwindows(WindowPtr pParent, ClientPtr client)
 
             if (!pFirstMapped)
                 pFirstMapped = pWin;
-            if (pParent->realized) {
+            if (pParent->realized || pParent->paintable) {
                 RealizeTree(pWin);
                 if (pWin->viewable) {
                     anyMarked |= (*pScreen->MarkOverlappedWindows) (pWin, pWin,
@@ -2861,7 +2861,7 @@ UnmapWindow(WindowPtr pWin, Bool fromConfigure)
 {
     WindowPtr pParent;
     Bool wasRealized = (Bool) pWin->realized;
-    Bool wasViewable = (Bool) pWin->viewable;
+    Bool wasPaintable = pWin->paintable;
     ScreenPtr pScreen = pWin->drawable.pScreen;
     WindowPtr pLayerWin = pWin;
 
@@ -2869,7 +2869,7 @@ UnmapWindow(WindowPtr pWin, Bool fromConfigure)
         return Success;
     if (SubStrSend(pWin, pParent))
         DeliverUnmapNotify(pWin, fromConfigure);
-    if (wasViewable && !fromConfigure) {
+    if (wasPaintable && !fromConfigure) {
         pWin->valdata = UnmapValData;
         (*pScreen->MarkOverlappedWindows) (pWin, pWin->nextSib, &pLayerWin);
         (*pScreen->MarkWindow) (pLayerWin->parent);
@@ -2877,13 +2877,11 @@ UnmapWindow(WindowPtr pWin, Bool fromConfigure)
     pWin->mapped = FALSE;
     if (wasRealized)
         UnrealizeTree(pWin, fromConfigure);
-    if (wasViewable) {
-        if (!fromConfigure) {
-            (*pScreen->ValidateTree) (pLayerWin->parent, pWin, VTUnmap);
-            (*pScreen->HandleExposures) (pLayerWin->parent);
-            if (pScreen->PostValidateTree)
-                (*pScreen->PostValidateTree) (pLayerWin->parent, pWin, VTUnmap);
-        }
+    if (wasPaintable && !fromConfigure) {
+        (*pScreen->ValidateTree) (pLayerWin->parent, pWin, VTUnmap);
+        (*pScreen->HandleExposures) (pLayerWin->parent);
+        if (pScreen->PostValidateTree)
+            (*pScreen->PostValidateTree) (pLayerWin->parent, pWin, VTUnmap);
     }
     if (wasRealized && !fromConfigure) {
         WindowsRestructured();
@@ -2903,7 +2901,7 @@ UnmapSubwindows(WindowPtr pWin)
 {
     WindowPtr pChild, pHead;
     Bool wasRealized = (Bool) pWin->realized;
-    Bool wasViewable = (Bool) pWin->viewable;
+    Bool wasPaintable = pWin->paintable;
     Bool anyMarked = FALSE;
     Mask parentNotify;
     WindowPtr pLayerWin = NULL;
@@ -2914,7 +2912,7 @@ UnmapSubwindows(WindowPtr pWin)
     parentNotify = SubSend(pWin);
     pHead = RealChildHead(pWin);
 
-    if (wasViewable)
+    if (wasPaintable)
         pLayerWin = (*pScreen->GetLayerWindow) (pWin);
 
     for (pChild = pWin->lastChild; pChild != pHead; pChild = pChild->prevSib) {
@@ -2930,31 +2928,28 @@ UnmapSubwindows(WindowPtr pWin)
                 UnrealizeTree(pChild, FALSE);
         }
     }
-    if (wasViewable) {
-        if (anyMarked) {
-            if (pLayerWin->parent == pWin)
-                (*pScreen->MarkWindow) (pWin);
-            else {
-                WindowPtr ptmp;
+    if (wasPaintable && anyMarked) {
+        if (pLayerWin->parent == pWin)
+            (*pScreen->MarkWindow) (pWin);
+        else {
+            WindowPtr ptmp;
 
-                (*pScreen->MarkOverlappedWindows) (pWin, pLayerWin, NULL);
-                (*pScreen->MarkWindow) (pLayerWin->parent);
+            (*pScreen->MarkOverlappedWindows) (pWin, pLayerWin, NULL);
+            (*pScreen->MarkWindow) (pLayerWin->parent);
 
-                /* Windows between pWin and pLayerWin may not have been marked */
-                ptmp = pWin;
+            /* Windows between pWin and pLayerWin may not have been marked */
+            ptmp = pWin;
 
-                while (ptmp != pLayerWin->parent) {
-                    (*pScreen->MarkWindow) (ptmp);
-                    ptmp = ptmp->parent;
-                }
-                pHead = pWin->firstChild;
+            while (ptmp != pLayerWin->parent) {
+                (*pScreen->MarkWindow) (ptmp);
+                ptmp = ptmp->parent;
             }
-            (*pScreen->ValidateTree) (pLayerWin->parent, pHead, VTUnmap);
-            (*pScreen->HandleExposures) (pLayerWin->parent);
-            if (pScreen->PostValidateTree)
-                (*pScreen->PostValidateTree) (pLayerWin->parent, pHead,
-                                              VTUnmap);
+            pHead = pWin->firstChild;
         }
+        (*pScreen->ValidateTree) (pLayerWin->parent, pHead, VTUnmap);
+        (*pScreen->HandleExposures) (pLayerWin->parent);
+        if (pScreen->PostValidateTree)
+            (*pScreen->PostValidateTree) (pLayerWin->parent, pHead, VTUnmap);
     }
     if (wasRealized) {
         WindowsRestructured();
-- 
2.17.0



More information about the xorg-devel mailing list