[PATCH 07/18] mi: Simplify composite border clip redirection interface

Adam Jackson ajax at redhat.com
Tue Sep 23 11:32:23 PDT 2014


There's not really a good reason for mi to not just call the composite
code directly.

Reviewed-by: Keith Packard <keithp at keithp.com>
Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 composite/compext.c |  3 ---
 mi/mi.h             | 11 -----------
 mi/mivaltree.c      | 52 +++++++++++++++++++---------------------------------
 3 files changed, 19 insertions(+), 47 deletions(-)

diff --git a/composite/compext.c b/composite/compext.c
index cadedbd..fcfc349 100644
--- a/composite/compext.c
+++ b/composite/compext.c
@@ -594,9 +594,6 @@ CompositeExtensionInit(void)
         return;
     CompositeReqCode = (CARD8) extEntry->base;
 
-    miRegisterRedirectBorderClipProc(compSetRedirectBorderClip,
-                                     compGetRedirectBorderClip);
-
     /* Initialization succeeded */
     noCompositeExtension = FALSE;
 }
diff --git a/mi/mi.h b/mi/mi.h
index 4b5e862..a4a01b8 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -425,17 +425,6 @@ extern _X_EXPORT int miShapedWindowIn(RegionPtr /*universe */ ,
                                       int       /*y */
     );
 
-typedef void
- (*SetRedirectBorderClipProcPtr) (WindowPtr pWindow, RegionPtr pRegion);
-
-typedef RegionPtr
- (*GetRedirectBorderClipProcPtr) (WindowPtr pWindow);
-
-extern _X_EXPORT void
-
-miRegisterRedirectBorderClipProc(SetRedirectBorderClipProcPtr setBorderClip,
-                                 GetRedirectBorderClipProcPtr getBorderClip);
-
 extern _X_EXPORT int miValidateTree(WindowPtr /*pParent */ ,
                                     WindowPtr /*pChild */ ,
                                     VTKind      /*kind */
diff --git a/mi/mivaltree.c b/mi/mivaltree.c
index c1cc431..8e4e9a9 100644
--- a/mi/mivaltree.c
+++ b/mi/mivaltree.c
@@ -99,8 +99,10 @@ Equipment Corporation.
 #include    "mi.h"
 #include    "regionstr.h"
 #include    "mivalidate.h"
-
 #include    "globals.h"
+#ifdef COMPOSITE
+#include    "compint.h"
+#endif
 
 /*
  * Compute the visibility of a shaped window
@@ -160,17 +162,6 @@ miShapedWindowIn(RegionPtr universe, RegionPtr bounding,
     return rgnOUT;
 }
 
-static GetRedirectBorderClipProcPtr miGetRedirectBorderClipProc;
-static SetRedirectBorderClipProcPtr miSetRedirectBorderClipProc;
-
-void
-miRegisterRedirectBorderClipProc(SetRedirectBorderClipProcPtr setBorderClip,
-                                 GetRedirectBorderClipProcPtr getBorderClip)
-{
-    miSetRedirectBorderClipProc = setBorderClip;
-    miGetRedirectBorderClipProc = getBorderClip;
-}
-
 /*
  * Manual redirected windows are treated as transparent; they do not obscure
  * siblings or parent windows
@@ -242,11 +233,9 @@ miComputeClips(WindowPtr pParent,
      * In redirected drawing case, reset universe to borderSize
      */
     if (pParent->redirectDraw != RedirectDrawNone) {
-        if (miSetRedirectBorderClipProc) {
-            if (TreatAsTransparent(pParent))
-                RegionEmpty(universe);
-            (*miSetRedirectBorderClipProc) (pParent, universe);
-        }
+        if (TreatAsTransparent(pParent))
+            RegionEmpty(universe);
+        compSetRedirectBorderClip (pParent, universe);
         RegionCopy(universe, &pParent->borderSize);
     }
 #endif
@@ -516,6 +505,17 @@ miTreeObscured(WindowPtr pParent)
     }
 }
 
+static RegionPtr
+getBorderClip(WindowPtr pWin)
+{
+#ifdef COMPOSITE
+    if (pWin->redirectDraw != RedirectDrawNone)
+        return compGetRedirectBorderClip(pWin);
+    else
+#endif
+        return &pWin->borderClip;
+}
+
 /*
  *-----------------------------------------------------------------------
  * miValidateTree --
@@ -609,14 +609,7 @@ miValidateTree(WindowPtr pParent,       /* Parent to validate */
             forward = TRUE;
             for (pWin = pChild; pWin; pWin = pWin->nextSib) {
                 if (pWin->valdata) {
-                    RegionPtr pBorderClip = &pWin->borderClip;
-
-#ifdef COMPOSITE
-                    if (pWin->redirectDraw != RedirectDrawNone &&
-                        miGetRedirectBorderClipProc)
-                        pBorderClip = (*miGetRedirectBorderClipProc) (pWin);
-#endif
-                    RegionAppend(&totalClip, pBorderClip);
+                    RegionAppend(&totalClip, getBorderClip(pWin));
                     if (pWin->viewable)
                         viewvals++;
                 }
@@ -627,14 +620,7 @@ miValidateTree(WindowPtr pParent,       /* Parent to validate */
             pWin = pParent->lastChild;
             while (1) {
                 if (pWin->valdata) {
-                    RegionPtr pBorderClip = &pWin->borderClip;
-
-#ifdef COMPOSITE
-                    if (pWin->redirectDraw != RedirectDrawNone &&
-                        miGetRedirectBorderClipProc)
-                        pBorderClip = (*miGetRedirectBorderClipProc) (pWin);
-#endif
-                    RegionAppend(&totalClip, pBorderClip);
+                    RegionAppend(&totalClip, getBorderClip(pWin));
                     if (pWin->viewable)
                         viewvals++;
                 }
-- 
1.9.3



More information about the xorg-devel mailing list