summaryrefslogtreecommitdiff
path: root/mi
diff options
context:
space:
mode:
authorPauli Nieminen <ext-pauli.nieminen@nokia.com>2010-12-30 19:19:37 +0200
committerDaniel Stone <daniel@fooishbar.org>2010-12-31 12:52:51 +0000
commit8fb43b8bf9fcbe015d4e98c7e09889184d136a1e (patch)
tree07c142b1b71426163c4d04960a01ef4d96645768 /mi
parent4be2a6d1b33fac7ceb50ad1de249a1acd5a46ab0 (diff)
mi: Fix wrapping for sprite screen
SCREEN_EPILOGUE should read the current function pointer from screen after calling wrapped function in case the pointer changes. Passing pPriv to macros instead of asking dix each time makes sense when both macros need same pointer. Signed-off-by: Pauli Nieminen <ext-pauli.nieminen@nokia.com> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'mi')
-rw-r--r--mi/misprite.c47
1 files changed, 25 insertions, 22 deletions
diff --git a/mi/misprite.c b/mi/misprite.c
index d1cf2bb3c..e5dbf1dae 100644
--- a/mi/misprite.c
+++ b/mi/misprite.c
@@ -216,11 +216,10 @@ static Bool miSpriteDeviceCursorInitialize(DeviceIntPtr pDev,
static void miSpriteDeviceCursorCleanup(DeviceIntPtr pDev,
ScreenPtr pScreen);
-#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \
- ((miSpriteScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \
- miSpriteScreenKey))->field)
-#define SCREEN_EPILOGUE(pScreen, field)\
- ((pScreen)->field = miSprite##field)
+#define SCREEN_PROLOGUE(pPriv, pScreen, field) ((pScreen)->field = \
+ (pPriv)->field)
+#define SCREEN_EPILOGUE(pPriv, pScreen, field)\
+ ((pPriv)->field = (pScreen)->field, (pScreen)->field = miSprite##field)
/*
* pointer-sprite method table
@@ -397,11 +396,12 @@ miSpriteGetImage (DrawablePtr pDrawable, int sx, int sy, int w, int h,
unsigned int format, unsigned long planemask,
char *pdstLine)
{
- ScreenPtr pScreen = pDrawable->pScreen;
- DeviceIntPtr pDev;
- miCursorInfoPtr pCursorInfo;
+ ScreenPtr pScreen = pDrawable->pScreen;
+ DeviceIntPtr pDev;
+ miCursorInfoPtr pCursorInfo;
+ miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
- SCREEN_PROLOGUE (pScreen, GetImage);
+ SCREEN_PROLOGUE (pPriv, pScreen, GetImage);
if (pDrawable->type == DRAWABLE_WINDOW)
{
@@ -424,7 +424,7 @@ miSpriteGetImage (DrawablePtr pDrawable, int sx, int sy, int w, int h,
(*pScreen->GetImage) (pDrawable, sx, sy, w, h,
format, planemask, pdstLine);
- SCREEN_EPILOGUE (pScreen, GetImage);
+ SCREEN_EPILOGUE (pPriv, pScreen, GetImage);
}
static void
@@ -434,8 +434,9 @@ miSpriteGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
ScreenPtr pScreen = pDrawable->pScreen;
DeviceIntPtr pDev;
miCursorInfoPtr pCursorInfo;
+ miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
- SCREEN_PROLOGUE (pScreen, GetSpans);
+ SCREEN_PROLOGUE (pPriv, pScreen, GetSpans);
if (pDrawable->type == DRAWABLE_WINDOW)
{
@@ -475,7 +476,7 @@ miSpriteGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
(*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
- SCREEN_EPILOGUE (pScreen, GetSpans);
+ SCREEN_EPILOGUE (pPriv, pScreen, GetSpans);
}
static void
@@ -485,8 +486,9 @@ miSpriteSourceValidate (DrawablePtr pDrawable, int x, int y, int width,
ScreenPtr pScreen = pDrawable->pScreen;
DeviceIntPtr pDev;
miCursorInfoPtr pCursorInfo;
+ miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
- SCREEN_PROLOGUE (pScreen, SourceValidate);
+ SCREEN_PROLOGUE (pPriv, pScreen, SourceValidate);
if (pDrawable->type == DRAWABLE_WINDOW)
{
@@ -509,7 +511,7 @@ miSpriteSourceValidate (DrawablePtr pDrawable, int x, int y, int width,
if (pScreen->SourceValidate)
(*pScreen->SourceValidate) (pDrawable, x, y, width, height);
- SCREEN_EPILOGUE (pScreen, SourceValidate);
+ SCREEN_EPILOGUE (pPriv, pScreen, SourceValidate);
}
static void
@@ -518,8 +520,9 @@ miSpriteCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
ScreenPtr pScreen = pWindow->drawable.pScreen;
DeviceIntPtr pDev;
miCursorInfoPtr pCursorInfo;
+ miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
- SCREEN_PROLOGUE (pScreen, CopyWindow);
+ SCREEN_PROLOGUE (pPriv, pScreen, CopyWindow);
for(pDev = inputInfo.devices; pDev; pDev = pDev->next)
{
@@ -539,7 +542,7 @@ miSpriteCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
}
(*pScreen->CopyWindow) (pWindow, ptOldOrg, prgnSrc);
- SCREEN_EPILOGUE (pScreen, CopyWindow);
+ SCREEN_EPILOGUE (pPriv, pScreen, CopyWindow);
}
static void
@@ -551,11 +554,11 @@ miSpriteBlockHandler (int i, pointer blockData, pointer pTimeout,
DeviceIntPtr pDev;
miCursorInfoPtr pCursorInfo;
- SCREEN_PROLOGUE(pScreen, BlockHandler);
+ SCREEN_PROLOGUE(pPriv, pScreen, BlockHandler);
(*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
- SCREEN_EPILOGUE(pScreen, BlockHandler);
+ SCREEN_EPILOGUE(pPriv, pScreen, BlockHandler);
for(pDev = inputInfo.devices; pDev; pDev = pDev->next)
{
@@ -593,11 +596,11 @@ miSpriteInstallColormap (ColormapPtr pMap)
ScreenPtr pScreen = pMap->pScreen;
miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen);
- SCREEN_PROLOGUE(pScreen, InstallColormap);
+ SCREEN_PROLOGUE(pPriv, pScreen, InstallColormap);
(*pScreen->InstallColormap) (pMap);
- SCREEN_EPILOGUE(pScreen, InstallColormap);
+ SCREEN_EPILOGUE(pPriv, pScreen, InstallColormap);
/* InstallColormap can be called before devices are initialized. */
pPriv->pInstalledMap = pMap;
@@ -630,11 +633,11 @@ miSpriteStoreColors (ColormapPtr pMap, int ndef, xColorItem *pdef)
DeviceIntPtr pDev;
miCursorInfoPtr pCursorInfo;
- SCREEN_PROLOGUE(pScreen, StoreColors);
+ SCREEN_PROLOGUE(pPriv, pScreen, StoreColors);
(*pScreen->StoreColors) (pMap, ndef, pdef);
- SCREEN_EPILOGUE(pScreen, StoreColors);
+ SCREEN_EPILOGUE(pPriv, pScreen, StoreColors);
if (pPriv->pColormap == pMap)
{