Skip to content

Commit

Permalink
composite: Add GetImage wrapper
Browse files Browse the repository at this point in the history
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@nokia.com>
Reviewed-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Signed-off-by: Keith Packard <keithp@keithp.com>
  • Loading branch information
Ville Syrjälä authored and keith-packard committed Jan 5, 2011
1 parent a5dc353 commit 8415495
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion composite/compalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@

#include "compint.h"

static void
void
compScreenUpdate (ScreenPtr pScreen)
{
compCheckTree (pScreen);
Expand Down
24 changes: 24 additions & 0 deletions composite/compinit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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
*/
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions composite/compint.h
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ typedef struct _CompScreen {
Window overlayWid;
CompOverlayClientPtr pOverlayClients;

GetImageProcPtr GetImage;
} CompScreenRec, *CompScreenPtr;

extern DevPrivateKeyRec CompScreenPrivateKeyRec;
Expand Down Expand Up @@ -315,6 +316,9 @@ compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc);
void
compWindowUpdate (WindowPtr pWin);

void
compScreenUpdate (ScreenPtr pScreen);

WindowPtr
CompositeRealChildHead (WindowPtr pWin);

Expand Down

0 comments on commit 8415495

Please sign in to comment.