[PATCH 3/4] composite: Add GetImage wrapper

ville.syrjala at nokia.com ville.syrjala at nokia.com
Wed Dec 29 05:04:30 PST 2010


From: Ville Syrjälä <ville.syrjala at nokia.com>

When GetImage is performed on a window, force an immediate update of
all the automatically redirected children, so that the parent window
contents will be up to date.

Signed-off-by: Ville Syrjälä <ville.syrjala at nokia.com>
---
 composite/compinit.c |   24 ++++++++++++++++++++++++
 composite/compint.h  |    1 +
 2 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/composite/compinit.c b/composite/compinit.c
index 8c98a9d..85bb099 100644
--- a/composite/compinit.c
+++ b/composite/compinit.c
@@ -78,6 +78,8 @@ compCloseScreen (int index, ScreenPtr pScreen)
     pScreen->CopyWindow = cs->CopyWindow;
     pScreen->PositionWindow = cs->PositionWindow;
 
+    pScreen->GetImage = cs->GetImage;
+
     free(cs);
     dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL);
     ret = (*pScreen->CloseScreen) (index, pScreen);
@@ -164,6 +166,25 @@ compBlockHandler (int	    i,
     pScreen->BlockHandler = compBlockHandler;
 }
 
+static void
+compGetImage (DrawablePtr pDrawable,
+	      int sx, int sy,
+	      int w, int h,
+	      unsigned int format,
+	      unsigned long planemask,
+	      char *pdstLine)
+{
+    ScreenPtr pScreen = pDrawable->pScreen;
+    CompScreenPtr cs = GetCompScreen (pScreen);
+
+    pScreen->GetImage = cs->GetImage;
+    if (pDrawable->type == DRAWABLE_WINDOW)
+	compChildrenUpdate ((WindowPtr) pDrawable);
+    (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine);
+    cs->GetImage = pScreen->GetImage;
+    pScreen->GetImage = compGetImage;
+}
+
 /*
  * Add alternate visuals -- always expose an ARGB32 and RGB24 visual
  */
@@ -398,6 +419,9 @@ compScreenInit (ScreenPtr pScreen)
     cs->CloseScreen = pScreen->CloseScreen;
     pScreen->CloseScreen = compCloseScreen;
 
+    cs->GetImage = pScreen->GetImage;
+    pScreen->GetImage = compGetImage;
+
     dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, cs);
 
     RegisterRealChildHeadProc(CompositeRealChildHead);
diff --git a/composite/compint.h b/composite/compint.h
index 9ba5dd0..bf4b3cc 100644
--- a/composite/compint.h
+++ b/composite/compint.h
@@ -160,6 +160,7 @@ typedef struct _CompScreen {
     Window			overlayWid;
     CompOverlayClientPtr        pOverlayClients;
     
+    GetImageProcPtr		GetImage;
 } CompScreenRec, *CompScreenPtr;
 
 extern DevPrivateKeyRec CompScreenPrivateKeyRec;
-- 
1.7.2.2



More information about the xorg-devel mailing list