[PATCH 05/22] mi: Add GetSprtieScreen macro to hide dixLookupPrivate

Pauli ext-pauli.nieminen at nokia.com
Wed Dec 29 11:27:17 PST 2010


From: Pauli Nieminen <ext-pauli.nieminen at nokia.com>

Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
---
 mi/misprite.c |   24 +++++++++++-------------
 1 files changed, 11 insertions(+), 13 deletions(-)

diff --git a/mi/misprite.c b/mi/misprite.c
index 38a6b93..c42760c 100644
--- a/mi/misprite.c
+++ b/mi/misprite.c
@@ -184,6 +184,9 @@ miSpriteIsDown(miCursorInfoPtr pDevCursor)
 
 static DevPrivateKeyRec miSpriteScreenKeyRec;
 #define miSpriteScreenKey (&miSpriteScreenKeyRec)
+#define GetSpriteScreen(pScreen) \
+	((miSpriteScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \
+					miSpriteScreenKey))
 static DevPrivateKeyRec miSpriteDevPrivatesKeyRec;
 #define miSpriteDevPrivatesKey (&miSpriteDevPrivatesKeyRec)
 
@@ -373,9 +376,8 @@ miSpriteInitialize (ScreenPtr               pScreen,
 static Bool
 miSpriteCloseScreen (int i, ScreenPtr pScreen)
 {
-    miSpriteScreenPtr   pScreenPriv;
+    miSpriteScreenPtr   pScreenPriv = GetSpriteScreen(pScreen);
 
-    pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey);
     pScreen->CloseScreen = pScreenPriv->CloseScreen;
     pScreen->GetImage = pScreenPriv->GetImage;
     pScreen->GetSpans = pScreenPriv->GetSpans;
@@ -546,11 +548,10 @@ miSpriteBlockHandler (int i, pointer blockData, pointer pTimeout,
                       pointer pReadmask)
 {
     ScreenPtr		pScreen = screenInfo.screens[i];
-    miSpriteScreenPtr	pPriv;
+    miSpriteScreenPtr   pPriv = GetSpriteScreen(pScreen);
     DeviceIntPtr            pDev;
     miCursorInfoPtr         pCursorInfo;
 
-    pPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey);
     SCREEN_PROLOGUE(pScreen, BlockHandler);
 
     (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
@@ -591,9 +592,8 @@ static void
 miSpriteInstallColormap (ColormapPtr pMap)
 {
     ScreenPtr		pScreen = pMap->pScreen;
-    miSpriteScreenPtr	pPriv;
+    miSpriteScreenPtr   pPriv = GetSpriteScreen(pScreen);
 
-    pPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey);
     SCREEN_PROLOGUE(pScreen, InstallColormap);
 
     (*pScreen->InstallColormap) (pMap);
@@ -624,14 +624,13 @@ static void
 miSpriteStoreColors (ColormapPtr pMap, int ndef, xColorItem *pdef)
 {
     ScreenPtr		pScreen = pMap->pScreen;
-    miSpriteScreenPtr	pPriv;
+    miSpriteScreenPtr   pPriv = GetSpriteScreen(pScreen);
     int			i;
     int			updated;
     VisualPtr		pVisual;
     DeviceIntPtr        pDev;
     miCursorInfoPtr     pCursorInfo;
 
-    pPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey);
     SCREEN_PROLOGUE(pScreen, StoreColors);
 
     (*pScreen->StoreColors) (pMap, ndef, pdef);
@@ -706,8 +705,7 @@ miSpriteStoreColors (ColormapPtr pMap, int ndef, xColorItem *pdef)
 static void
 miSpriteFindColors (miCursorInfoPtr pDevCursor, ScreenPtr pScreen)
 {
-    miSpriteScreenPtr   pScreenPriv =
-	dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey);
+    miSpriteScreenPtr   pScreenPriv = GetSpriteScreen(pScreen);
     CursorPtr		pCursor;
     xColorItem		*sourceColor, *maskColor;
 
@@ -884,7 +882,7 @@ miSpriteRemoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen)
         return;
 
     DamageDrawInternal (pScreen, TRUE);
-    pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey);
+    pScreenPriv = GetSpriteScreen(pScreen);
     pCursorInfo = MISPRITE(pDev);
 
     miSpriteIsDown(pCursorInfo);
@@ -922,7 +920,7 @@ miSpriteSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen)
         return;
 
     DamageDrawInternal (pScreen, TRUE);
-    pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey);
+    pScreenPriv = GetSpriteScreen(pScreen);
     pCursorInfo = MISPRITE(pDev);
 
     miSpriteComputeSaved (pDev, pScreen);
@@ -963,7 +961,7 @@ miSpriteRestoreCursor (DeviceIntPtr pDev, ScreenPtr pScreen)
         return;
 
     DamageDrawInternal (pScreen, TRUE);
-    pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey);
+    pScreenPriv = GetSpriteScreen(pScreen);
     pCursorInfo = MISPRITE(pDev);
 
     miSpriteComputeSaved (pDev, pScreen);
-- 
1.7.0.4



More information about the xorg-devel mailing list