[PATCH 5/8] dix: Restore PaintWindow screen hook

Adam Jackson ajax at redhat.com
Tue Aug 20 12:33:36 PDT 2013


Removes the last cpp conditional on ROOTLESS from dix code.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 composite/compwindow.c          |  2 +-
 dix/window.c                    |  4 ++--
 hw/xquartz/quartz.c             |  4 ++--
 hw/xwin/winrandr.c              |  2 +-
 include/scrnintstr.h            |  5 +++++
 mi/miexpose.c                   | 30 +++++-------------------------
 mi/mioverlay.c                  | 13 +++++++------
 mi/miscrinit.c                  |  1 +
 mi/miwindow.c                   |  6 ++++--
 miext/rootless/rootlessCommon.h |  1 +
 miext/rootless/rootlessScreen.c |  3 ++-
 miext/rootless/rootlessWindow.c | 23 ++++++++++++++++++++++-
 miext/rootless/rootlessWindow.h |  1 +
 13 files changed, 54 insertions(+), 41 deletions(-)

diff --git a/composite/compwindow.c b/composite/compwindow.c
index 0be7a1b..e7aadcd 100644
--- a/composite/compwindow.c
+++ b/composite/compwindow.c
@@ -104,7 +104,7 @@ compRepaintBorder(ClientPtr pClient, pointer closure)
 
         RegionNull(&exposed);
         RegionSubtract(&exposed, &pWindow->borderClip, &pWindow->winSize);
-        miPaintWindow(pWindow, &exposed, PW_BORDER);
+        pWindow->drawable.pScreen->PaintWindow(pWindow, &exposed, PW_BORDER);
         RegionUninit(&exposed);
     }
     return TRUE;
diff --git a/dix/window.c b/dix/window.c
index 735876e..df2f86a 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -1463,7 +1463,7 @@ ChangeWindowAttributes(WindowPtr pWin, Mask vmask, XID *vlist, ClientPtr client)
 
         RegionNull(&exposed);
         RegionSubtract(&exposed, &pWin->borderClip, &pWin->winSize);
-        miPaintWindow(pWin, &exposed, PW_BORDER);
+        pWin->drawable.pScreen->PaintWindow(pWin, &exposed, PW_BORDER);
         RegionUninit(&exposed);
     }
     return error;
@@ -2971,7 +2971,7 @@ dixSaveScreens(ClientPtr client, int on, int mode)
 
                 /* make it look like screen saver is off, so that
                  * NotClippedByChildren will compute a clip list
-                 * for the root window, so miPaintWindow works
+                 * for the root window, so PaintWindow works
                  */
                 screenIsSaved = SCREEN_SAVER_OFF;
                 (*pWin->drawable.pScreen->MoveWindow) (pWin,
diff --git a/hw/xquartz/quartz.c b/hw/xquartz/quartz.c
index 5b977c7..2d3d4ae 100644
--- a/hw/xquartz/quartz.c
+++ b/hw/xquartz/quartz.c
@@ -299,8 +299,8 @@ QuartzUpdateScreens(void)
 
     quartzProcs->UpdateScreen(pScreen);
 
-    /* miPaintWindow needs to be called after RootlessUpdateScreenPixmap (from xprUpdateScreen) */
-    miPaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND);
+    /* PaintWindow needs to be called after RootlessUpdateScreenPixmap (from xprUpdateScreen) */
+    pScreen->PaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND);
 
     /* Tell RandR about the new size, so new connections get the correct info */
     RRScreenSizeNotify(pScreen);
diff --git a/hw/xwin/winrandr.c b/hw/xwin/winrandr.c
index 1b34085..5624e75 100644
--- a/hw/xwin/winrandr.c
+++ b/hw/xwin/winrandr.c
@@ -104,7 +104,7 @@ winDoRandRScreenSetSize(ScreenPtr pScreen,
     SetRootClip(pScreen, TRUE);
 
     // and arrange for it to be repainted
-    miPaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND);
+    pScreen->PaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND);
 
     /* Indicate that a screen size change took place */
     RRScreenSizeNotify(pScreen);
diff --git a/include/scrnintstr.h b/include/scrnintstr.h
index df74073..b1bd5af 100644
--- a/include/scrnintstr.h
+++ b/include/scrnintstr.h
@@ -158,6 +158,10 @@ typedef void (*WindowExposuresProcPtr) (WindowPtr /*pWindow */ ,
                                         RegionPtr /*prgn */ ,
                                         RegionPtr /*other_exposed */ );
 
+typedef void (*PaintWindowProcPtr) (WindowPtr /*pWindow*/,
+                                    RegionPtr /*pRegion*/,
+                                    int /*what*/);
+
 typedef void (*CopyWindowProcPtr) (WindowPtr /*pWindow */ ,
                                    DDXPointRec /*ptOldOrg */ ,
                                    RegionPtr /*prgnSrc */ );
@@ -407,6 +411,7 @@ typedef struct _Screen {
     ClearToBackgroundProcPtr ClearToBackground;
     ClipNotifyProcPtr ClipNotify;
     RestackWindowProcPtr RestackWindow;
+    PaintWindowProcPtr PaintWindow;
 
     /* Pixmap procedures */
 
diff --git a/mi/miexpose.c b/mi/miexpose.c
index 115f6b0..4fd779a 100644
--- a/mi/miexpose.c
+++ b/mi/miexpose.c
@@ -274,10 +274,11 @@ miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
         RegionTranslate(&rgnExposed, pDstDrawable->x, pDstDrawable->y);
 
         if (extents) {
-            /* miPaintWindow doesn't clip, so we have to */
+            /* PaintWindow doesn't clip, so we have to */
             RegionIntersect(&rgnExposed, &rgnExposed, &pWin->clipList);
         }
-        miPaintWindow((WindowPtr) pDstDrawable, &rgnExposed, PW_BACKGROUND);
+        pDstDrawable->pScreen->PaintWindow((WindowPtr) pDstDrawable,
+                                           &rgnExposed, PW_BACKGROUND);
 
         if (extents) {
             RegionReset(&rgnExposed, &expBox);
@@ -463,11 +464,11 @@ miWindowExposures(WindowPtr pWin, RegionPtr prgn, RegionPtr other_exposed)
                 RegionReset(exposures, &box);
                 RegionUnion(prgn, prgn, exposures);
             }
-            /* miPaintWindow doesn't clip, so we have to */
+            /*iPaintWindow doesn't clip, so we have to */
             RegionIntersect(prgn, prgn, &pWin->clipList);
         }
         if (prgn && !RegionNil(prgn))
-            miPaintWindow(pWin, prgn, PW_BACKGROUND);
+            pWin->drawable.pScreen->PaintWindow(pWin, prgn, PW_BACKGROUND);
         if (clientInterested && exposures && !RegionNil(exposures))
             miSendExposures(pWin, exposures,
                             pWin->drawable.x, pWin->drawable.y);
@@ -483,14 +484,6 @@ miWindowExposures(WindowPtr pWin, RegionPtr prgn, RegionPtr other_exposed)
         RegionDestroy(exposures);
 }
 
-#ifdef ROOTLESS
-/* Ugly, ugly, but we lost our hooks into miPaintWindow... =/ */
-void RootlessSetPixmapOfAncestors(WindowPtr pWin);
-void RootlessStartDrawing(WindowPtr pWin);
-void RootlessDamageRegion(WindowPtr pWin, RegionPtr prgn);
-Bool IsFramedWindow(WindowPtr pWin);
-#endif
-
 void
 miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
 {
@@ -518,19 +511,6 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
     Bool solid = TRUE;
     DrawablePtr drawable = &pWin->drawable;
 
-#ifdef ROOTLESS
-    if (IsFramedWindow(pWin)) {
-        RootlessStartDrawing(pWin);
-        RootlessDamageRegion(pWin, prgn);
-
-        if (pWin->backgroundState == ParentRelative) {
-            if ((what == PW_BACKGROUND) ||
-                (what == PW_BORDER && !pWin->borderIsPixel))
-                RootlessSetPixmapOfAncestors(pWin);
-        }
-    }
-#endif
-
     if (what == PW_BACKGROUND) {
         while (pWin->backgroundState == ParentRelative)
             pWin = pWin->parent;
diff --git a/mi/mioverlay.c b/mi/mioverlay.c
index b014d3d..1dd3778 100644
--- a/mi/mioverlay.c
+++ b/mi/mioverlay.c
@@ -844,8 +844,8 @@ miOverlayHandleExposures(WindowPtr pWin)
             if ((mival = pTree->valdata)) {
                 if (!((*pPriv->InOverlay) (pTree->pWin))) {
                     if (RegionNotEmpty(&mival->borderExposed)) {
-                        miPaintWindow(pTree->pWin, &mival->borderExposed,
-                                      PW_BORDER);
+                        pScreen->PaintWindow(pTree->pWin, &mival->borderExposed,
+                                             PW_BORDER);
                     }
                     RegionUninit(&mival->borderExposed);
 
@@ -884,7 +884,8 @@ miOverlayHandleExposures(WindowPtr pWin)
             }
             else {
                 if (RegionNotEmpty(&val->after.borderExposed)) {
-                    miPaintWindow(pChild, &val->after.borderExposed, PW_BORDER);
+                    pScreen->PaintWindow(pChild, &val->after.borderExposed,
+                                         PW_BORDER);
                 }
                 (*WindowExposures) (pChild, &val->after.exposed, NullRegion);
             }
@@ -984,6 +985,7 @@ miOverlayWindowExposures(WindowPtr pWin,
                          RegionPtr prgn, RegionPtr other_exposed)
 {
     RegionPtr exposures = prgn;
+    ScreenPtr pScreen = pWin->drawable.pScreen;
 
     if ((prgn && !RegionNil(prgn)) ||
         (exposures && !RegionNil(exposures)) || other_exposed) {
@@ -1002,7 +1004,6 @@ miOverlayWindowExposures(WindowPtr pWin,
         }
         if (clientInterested && exposures &&
             (RegionNumRects(exposures) > RECTLIMIT)) {
-            ScreenPtr pScreen = pWin->drawable.pScreen;
             miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
             BoxRec box;
 
@@ -1028,7 +1029,7 @@ miOverlayWindowExposures(WindowPtr pWin,
                 RegionIntersect(prgn, prgn, &pWin->clipList);
         }
         if (prgn && !RegionNil(prgn))
-            miPaintWindow(pWin, prgn, PW_BACKGROUND);
+            pScreen->PaintWindow(pWin, prgn, PW_BACKGROUND);
         if (clientInterested && exposures && !RegionNil(exposures))
             miSendExposures(pWin, exposures,
                             pWin->drawable.x, pWin->drawable.y);
@@ -1638,7 +1639,7 @@ miOverlayClearToBackground(WindowPtr pWin,
     if (generateExposures)
         (*pScreen->WindowExposures) (pWin, &reg, pBSReg);
     else if (pWin->backgroundState != None)
-        miPaintWindow(pWin, &reg, PW_BACKGROUND);
+        pScreen->PaintWindow(pWin, &reg, PW_BACKGROUND);
     RegionUninit(&reg);
     if (pBSReg)
         RegionDestroy(pBSReg);
diff --git a/mi/miscrinit.c b/mi/miscrinit.c
index 4698b53..02fe628 100644
--- a/mi/miscrinit.c
+++ b/mi/miscrinit.c
@@ -253,6 +253,7 @@ miScreenInit(ScreenPtr pScreen, pointer pbits,  /* pointer to screen bits */
     pScreen->ClearToBackground = miClearToBackground;
     pScreen->ClipNotify = (ClipNotifyProcPtr) 0;
     pScreen->RestackWindow = (RestackWindowProcPtr) 0;
+    pScreen->PaintWindow = miPaintWindow;
     /* CreatePixmap, DestroyPixmap */
     /* RealizeFont, UnrealizeFont */
     /* CreateGC */
diff --git a/mi/miwindow.c b/mi/miwindow.c
index 8adafdc..e2ffe4e 100644
--- a/mi/miwindow.c
+++ b/mi/miwindow.c
@@ -112,7 +112,7 @@ miClearToBackground(WindowPtr pWin,
     if (generateExposures)
         (*pWin->drawable.pScreen->WindowExposures) (pWin, &reg, NULL);
     else if (pWin->backgroundState != None)
-        miPaintWindow(pWin, &reg, PW_BACKGROUND);
+        pWin->drawable.pScreen->PaintWindow(pWin, &reg, PW_BACKGROUND);
     RegionUninit(&reg);
 }
 
@@ -218,7 +218,9 @@ miHandleValidateExposures(WindowPtr pWin)
     while (1) {
         if ((val = pChild->valdata)) {
             if (RegionNotEmpty(&val->after.borderExposed))
-                miPaintWindow(pChild, &val->after.borderExposed, PW_BORDER);
+                pWin->drawable.pScreen->PaintWindow(pChild,
+                                                    &val->after.borderExposed,
+                                                    PW_BORDER);
             RegionUninit(&val->after.borderExposed);
             (*WindowExposures) (pChild, &val->after.exposed, NullRegion);
             RegionUninit(&val->after.exposed);
diff --git a/miext/rootless/rootlessCommon.h b/miext/rootless/rootlessCommon.h
index fd9c941..aa55579 100644
--- a/miext/rootless/rootlessCommon.h
+++ b/miext/rootless/rootlessCommon.h
@@ -94,6 +94,7 @@ typedef struct _RootlessScreenRec {
     ChangeBorderWidthProcPtr ChangeBorderWidth;
     PositionWindowProcPtr PositionWindow;
     ChangeWindowAttributesProcPtr ChangeWindowAttributes;
+    PaintWindowProcPtr PaintWindow;
 
     CreateGCProcPtr CreateGC;
     CopyWindowProcPtr CopyWindow;
diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c
index a1af3e7..72e54d8 100644
--- a/miext/rootless/rootlessScreen.c
+++ b/miext/rootless/rootlessScreen.c
@@ -473,7 +473,7 @@ expose_1(WindowPtr pWin)
     if (!pWin->realized)
         return;
 
-    miPaintWindow(pWin, &pWin->borderClip, PW_BACKGROUND);
+    pWin->drawable.pScreen->PaintWindow(pWin, &pWin->borderClip, PW_BACKGROUND);
 
     /* FIXME: comments in windowstr.h indicate that borderClip doesn't
        include subwindow visibility. But I'm not so sure.. so we may
@@ -669,6 +669,7 @@ RootlessWrap(ScreenPtr pScreen)
     WRAP(CloseScreen);
     WRAP(CreateGC);
     WRAP(CopyWindow);
+    WRAP(PaintWindow);
     WRAP(GetImage);
     WRAP(SourceValidate);
     WRAP(CreateWindow);
diff --git a/miext/rootless/rootlessWindow.c b/miext/rootless/rootlessWindow.c
index 9f0ecf6..453f1f5 100644
--- a/miext/rootless/rootlessWindow.c
+++ b/miext/rootless/rootlessWindow.c
@@ -720,7 +720,7 @@ RootlessResizeCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
 /*
  * RootlessCopyWindow
  *  Update *new* location of window. Old location is redrawn with
- *  miPaintWindow. Cloned from fbCopyWindow.
+ *  PaintWindow. Cloned from fbCopyWindow.
  *  The original always draws on the root pixmap, which we don't have.
  *  Instead, draw on the parent window's pixmap.
  */
@@ -794,6 +794,27 @@ RootlessCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
     RL_DEBUG_MSG("copywindowFB end\n");
 }
 
+void
+RootlessPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
+{
+    ScreenPtr pScreen = pWin->drawable.pScreen;
+
+    if (IsFramedWindow(pWin)) {
+        RootlessStartDrawing(pWin);
+        RootlessDamageRegion(pWin, prgn);
+
+        if (pWin->backgroundState == ParentRelative) {
+            if ((what == PW_BACKGROUND) ||
+                (what == PW_BORDER && !pWin->borderIsPixel))
+                RootlessSetPixmapOfAncestors(pWin);
+        }
+    }
+
+    SCREEN_UNWRAP(pScreen, PaintWindow);
+    pScreen->PaintWindow(pWin, prgn, what);
+    SCREEN_WRAP(pScreen, PaintWindow);
+}
+
 /*
  * Window resize procedures
  */
diff --git a/miext/rootless/rootlessWindow.h b/miext/rootless/rootlessWindow.h
index d3955fc..4fd34d5 100644
--- a/miext/rootless/rootlessWindow.h
+++ b/miext/rootless/rootlessWindow.h
@@ -48,6 +48,7 @@ Bool RootlessUnrealizeWindow(WindowPtr pWin);
 void RootlessRestackWindow(WindowPtr pWin, WindowPtr pOldNextSib);
 void RootlessCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg,
                         RegionPtr prgnSrc);
+void RootlessPaintWindow(WindowPtr pWin, RegionPtr prgn, int what);
 void RootlessMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pSib,
                         VTKind kind);
 void RootlessResizeWindow(WindowPtr pWin, int x, int y, unsigned int w,
-- 
1.8.3.1



More information about the xorg-devel mailing list