[PATCH 07/11] mi: Factor out visibility notify check/send

Adam Jackson ajax at redhat.com
Thu Sep 18 10:23:56 PDT 2014


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

diff --git a/mi/mivaltree.c b/mi/mivaltree.c
index c1cc431..2a39c56 100644
--- a/mi/mivaltree.c
+++ b/mi/mivaltree.c
@@ -171,6 +171,14 @@ miRegisterRedirectBorderClipProc(SetRedirectBorderClipProcPtr setBorderClip,
     miGetRedirectBorderClipProc = getBorderClip;
 }
 
+static void
+doVisibilityNotify(WindowPtr pWin, unsigned oldVis)
+{
+    if (oldVis != pWin->visibility &&
+        ((pWin->eventMask | wOtherEventMasks(pWin)) & VisibilityChangeMask))
+        SendVisibilityNotify(pWin);
+}
+
 /*
  * Manual redirected windows are treated as transparent; they do not obscure
  * siblings or parent windows
@@ -281,10 +289,7 @@ miComputeClips(WindowPtr pParent,
         break;
     }
     pParent->visibility = newVis;
-    if (oldVis != newVis &&
-        ((pParent->
-          eventMask | wOtherEventMasks(pParent)) & VisibilityChangeMask))
-        SendVisibilityNotify(pParent);
+    doVisibilityNotify(pParent, oldVis);
 
     dx = pParent->drawable.x - pParent->valdata->before.oldAbsCorner.x;
     dy = pParent->drawable.y - pParent->valdata->before.oldAbsCorner.y;
@@ -499,10 +504,8 @@ miTreeObscured(WindowPtr pParent)
     while (1) {
         if (pChild->viewable) {
             oldVis = pChild->visibility;
-            if (oldVis != (pChild->visibility = VisibilityFullyObscured) &&
-                ((pChild->
-                  eventMask | wOtherEventMasks(pChild)) & VisibilityChangeMask))
-                SendVisibilityNotify(pChild);
+            pChild->visibility = VisibilityFullyObscured;
+            doVisibilityNotify(pChild, oldVis);
             if (pChild->firstChild) {
                 pChild = pChild->firstChild;
                 continue;
-- 
1.9.3



More information about the xorg-devel mailing list