From 84154954db54696d4661eb8d0a6014cdbff3c91f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= Date: Wed, 5 Jan 2011 20:41:07 +0200 Subject: [PATCH] composite: Add GetImage wrapper MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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ä Reviewed-by: Keith Packard Reviewed-by: Daniel Stone Signed-off-by: Keith Packard --- composite/compalloc.c | 2 +- composite/compinit.c | 24 ++++++++++++++++++++++++ composite/compint.h | 4 ++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/composite/compalloc.c b/composite/compalloc.c index 86a6f8ea95..b2e3f71656 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -47,7 +47,7 @@ #include "compint.h" -static void +void compScreenUpdate (ScreenPtr pScreen) { compCheckTree (pScreen); diff --git a/composite/compinit.c b/composite/compinit.c index 276ed75f86..e1a7656847 100644 --- a/composite/compinit.c +++ b/composite/compinit.c @@ -77,6 +77,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); @@ -129,6 +131,25 @@ compChangeWindowAttributes(WindowPtr pWin, unsigned long mask) return ret; } +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 */ @@ -361,6 +382,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 4b058e7c32..c188bf1c5c 100644 --- a/composite/compint.h +++ b/composite/compint.h @@ -159,6 +159,7 @@ typedef struct _CompScreen { Window overlayWid; CompOverlayClientPtr pOverlayClients; + GetImageProcPtr GetImage; } CompScreenRec, *CompScreenPtr; extern DevPrivateKeyRec CompScreenPrivateKeyRec; @@ -315,6 +316,9 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); void compWindowUpdate (WindowPtr pWin); +void +compScreenUpdate (ScreenPtr pScreen); + WindowPtr CompositeRealChildHead (WindowPtr pWin);