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

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


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 431566d..a82c294 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -1467,7 +1467,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);
@@ -2041,7 +2041,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;
@@ -2053,7 +2053,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)
@@ -2492,7 +2492,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);
@@ -2570,7 +2570,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) {
@@ -2641,7 +2641,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,
@@ -2739,7 +2739,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;
 
@@ -2747,7 +2747,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);
@@ -2755,13 +2755,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();
@@ -2781,7 +2779,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;
@@ -2792,7 +2790,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) {
@@ -2808,31 +2806,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();
-- 
1.9.3



More information about the xorg-devel mailing list