[PATCH v2 3/6] composite: Add GetImage wrapper

ville.syrjala at nokia.com ville.syrjala at nokia.com
Fri Dec 31 06:49:36 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 windows, so that the current 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 159f7c2..b869a97 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);
@@ -159,6 +161,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)
+	compScreenUpdate (pScreen);
+    (*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
  */
@@ -393,6 +414,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