diff options
author | marha <marha@users.sourceforge.net> | 2009-09-09 05:23:48 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-09-09 05:23:48 +0000 |
commit | 81f91c615982e50bb62708201569c33a3cd3d973 (patch) | |
tree | 4f32ecc48a3b7b5e76642f3792338263c53879bd /xorg-server/mi/misprite.c | |
parent | b571a562410f565af2bdde52d9f7f9a23ffae04f (diff) | |
parent | a915739887477b28d924ecc8417ee107d125bd6c (diff) | |
download | vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.tar.gz vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.tar.bz2 vcxsrv-81f91c615982e50bb62708201569c33a3cd3d973.zip |
svn merge https://vcxsrv.svn.sourceforge.net/svnroot/vcxsrv/branches/released .
Diffstat (limited to 'xorg-server/mi/misprite.c')
-rw-r--r-- | xorg-server/mi/misprite.c | 353 |
1 files changed, 206 insertions, 147 deletions
diff --git a/xorg-server/mi/misprite.c b/xorg-server/mi/misprite.c index 6c4318f37..714c42944 100644 --- a/xorg-server/mi/misprite.c +++ b/xorg-server/mi/misprite.c @@ -33,29 +33,106 @@ in this Software without prior written authorization from The Open Group. #include <dix-config.h> #endif -# include <X11/X.h> -# include <X11/Xproto.h> -# include "misc.h" -# include "pixmapstr.h" -# include "input.h" -# include "mi.h" -# include "cursorstr.h" -# include <X11/fonts/font.h> -# include "scrnintstr.h" -# include "colormapst.h" -# include "windowstr.h" -# include "gcstruct.h" -# include "mipointer.h" -# include "mispritest.h" -# include "dixfontstr.h" -# include <X11/fonts/fontstruct.h> -# include "inputstr.h" - -#ifdef RENDER -# include "mipict.h" -#endif -# include "damage.h" +#include <X11/X.h> +#include <X11/Xproto.h> +#include "misc.h" +#include "pixmapstr.h" +#include "input.h" +#include "mi.h" +#include "cursorstr.h" +#include <X11/fonts/font.h> +#include "scrnintstr.h" +#include "colormapst.h" +#include "windowstr.h" +#include "gcstruct.h" +#include "mipointer.h" +#include "misprite.h" +#include "dixfontstr.h" +#include <X11/fonts/fontstruct.h> +#include "inputstr.h" +#include "damage.h" + +typedef struct { + CursorPtr pCursor; + int x; /* cursor hotspot */ + int y; + BoxRec saved; /* saved area from the screen */ + Bool isUp; /* cursor in frame buffer */ + Bool shouldBeUp; /* cursor should be displayed */ + WindowPtr pCacheWin; /* window the cursor last seen in */ + Bool isInCacheWin; + Bool checkPixels; /* check colormap collision */ + ScreenPtr pScreen; +} miCursorInfoRec, *miCursorInfoPtr; + +/* + * per screen information + */ + +typedef struct { + /* screen procedures */ + CloseScreenProcPtr CloseScreen; + GetImageProcPtr GetImage; + GetSpansProcPtr GetSpans; + SourceValidateProcPtr SourceValidate; + + /* window procedures */ + CopyWindowProcPtr CopyWindow; + + /* colormap procedures */ + InstallColormapProcPtr InstallColormap; + StoreColorsProcPtr StoreColors; + + /* os layer procedures */ + ScreenBlockHandlerProcPtr BlockHandler; + + /* device cursor procedures */ + DeviceCursorInitializeProcPtr DeviceCursorInitialize; + DeviceCursorCleanupProcPtr DeviceCursorCleanup; + + xColorItem colors[2]; + ColormapPtr pInstalledMap; + ColormapPtr pColormap; + VisualPtr pVisual; + miSpriteCursorFuncPtr funcs; + DamagePtr pDamage; /* damage tracking structure */ + Bool damageRegistered; +} miSpriteScreenRec, *miSpriteScreenPtr; + +#define SOURCE_COLOR 0 +#define MASK_COLOR 1 + +/* + * Overlap BoxPtr and Box elements + */ +#define BOX_OVERLAP(pCbox,X1,Y1,X2,Y2) \ + (((pCbox)->x1 <= (X2)) && ((X1) <= (pCbox)->x2) && \ + ((pCbox)->y1 <= (Y2)) && ((Y1) <= (pCbox)->y2)) + +/* + * Overlap BoxPtr, origins, and rectangle + */ +#define ORG_OVERLAP(pCbox,xorg,yorg,x,y,w,h) \ + BOX_OVERLAP((pCbox),(x)+(xorg),(y)+(yorg),(x)+(xorg)+(w),(y)+(yorg)+(h)) + +/* + * Overlap BoxPtr, origins and RectPtr + */ +#define ORGRECT_OVERLAP(pCbox,xorg,yorg,pRect) \ + ORG_OVERLAP((pCbox),(xorg),(yorg),(pRect)->x,(pRect)->y, \ + (int)((pRect)->width), (int)((pRect)->height)) +/* + * Overlap BoxPtr and horizontal span + */ +#define SPN_OVERLAP(pCbox,y,x,w) BOX_OVERLAP((pCbox),(x),(y),(x)+(w),(y)) + +#define LINE_SORT(x1,y1,x2,y2) \ +{ int _t; \ + if (x1 > x2) { _t = x1; x1 = x2; x2 = _t; } \ + if (y1 > y2) { _t = y1; y1 = y2; y2 = _t; } } +#define LINE_OVERLAP(pCbox,x1,y1,x2,y2,lw2) \ + BOX_OVERLAP((pCbox), (x1)-(lw2), (y1)-(lw2), (x2)+(lw2), (y2)+(lw2)) #define SPRITE_DEBUG_ENABLE 0 @@ -65,29 +142,26 @@ in this Software without prior written authorization from The Open Group. #define SPRITE_DEBUG(x) #endif - #define MISPRITE(dev) \ - ((DevHasCursor(dev)) ? \ + ((!IsMaster(dev) && !dev->u.master) ? \ (miCursorInfoPtr)dixLookupPrivate(&dev->devPrivates, miSpriteDevPrivatesKey) : \ - (miCursorInfoPtr)dixLookupPrivate(&dev->u.master->devPrivates, miSpriteDevPrivatesKey)) - -static int damageRegister = 0; + (miCursorInfoPtr)dixLookupPrivate(&(GetMaster(dev, MASTER_POINTER))->devPrivates, miSpriteDevPrivatesKey)) static void miSpriteDisableDamage(ScreenPtr pScreen, miSpriteScreenPtr pScreenPriv) { - if (damageRegister) { + if (pScreenPriv->damageRegistered) { DamageUnregister (&(pScreen->GetScreenPixmap(pScreen)->drawable), pScreenPriv->pDamage); - damageRegister = 0; + pScreenPriv->damageRegistered = 0; } } static void miSpriteEnableDamage(ScreenPtr pScreen, miSpriteScreenPtr pScreenPriv) { - if (!damageRegister) { - damageRegister = 1; + if (!pScreenPriv->damageRegistered) { + pScreenPriv->damageRegistered = 1; DamageRegister (&(pScreen->GetScreenPixmap(pScreen)->drawable), pScreenPriv->pDamage); } @@ -111,8 +185,8 @@ miSpriteIsDown(miCursorInfoPtr pDevCursor) static int miSpriteScreenKeyIndex; static DevPrivateKey miSpriteScreenKey = &miSpriteScreenKeyIndex; -static int mmiSpriteDevPrivatesKeyIndex; -static DevPrivateKey miSpriteDevPrivatesKey = &mmiSpriteDevPrivatesKeyIndex; +static int miSpriteDevPrivatesKeyIndex; +static DevPrivateKey miSpriteDevPrivatesKey = &miSpriteDevPrivatesKeyIndex; static Bool miSpriteCloseScreen(int i, ScreenPtr pScreen); static void miSpriteGetImage(DrawablePtr pDrawable, int sx, int sy, @@ -160,7 +234,7 @@ static void miSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, static void miSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y); -_X_EXPORT miPointerSpriteFuncRec miSpritePointerFuncs = { +miPointerSpriteFuncRec miSpritePointerFuncs = { miSpriteRealizeCursor, miSpriteUnrealizeCursor, miSpriteSetCursor, @@ -188,8 +262,7 @@ miSpriteReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure) miCursorInfoPtr pCursorInfo; DeviceIntPtr pDev; - pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, - miSpriteScreenKey); + pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); for (pDev = inputInfo.devices; pDev; pDev = pDev->next) { @@ -199,8 +272,7 @@ miSpriteReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure) if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen && - RECT_IN_REGION (pScreen, pRegion, &pCursorInfo->saved) - != rgnOUT) + miRectIn(pRegion, &pCursorInfo->saved) != rgnOUT) { SPRITE_DEBUG(("Damage remove\n")); miSpriteRemoveCursor (pDev, pScreen); @@ -226,20 +298,20 @@ miSpriteInitialize (ScreenPtr pScreen, if (!DamageSetup (pScreen)) return FALSE; - pScreenPriv = (miSpriteScreenPtr) xalloc (sizeof (miSpriteScreenRec)); + pScreenPriv = xalloc (sizeof (miSpriteScreenRec)); if (!pScreenPriv) return FALSE; pScreenPriv->pDamage = DamageCreate (miSpriteReportDamage, - (DamageDestroyFunc) 0, + NULL, DamageReportRawRegion, TRUE, pScreen, - (void *) pScreen); + pScreen); if (!miPointerInitialize (pScreen, &miSpritePointerFuncs, screenFuncs,TRUE)) { - xfree ((pointer) pScreenPriv); + xfree (pScreenPriv); return FALSE; } for (pVisual = pScreen->visuals; @@ -271,6 +343,8 @@ miSpriteInitialize (ScreenPtr pScreen, pScreenPriv->colors[MASK_COLOR].red = 0; pScreenPriv->colors[MASK_COLOR].green = 0; pScreenPriv->colors[MASK_COLOR].blue = 0; + pScreenPriv->damageRegistered = 0; + dixSetPrivate(&pScreen->devPrivates, miSpriteScreenKey, pScreenPriv); pScreen->CloseScreen = miSpriteCloseScreen; @@ -284,8 +358,6 @@ miSpriteInitialize (ScreenPtr pScreen, pScreen->BlockHandler = miSpriteBlockHandler; - damageRegister = 0; - return TRUE; } @@ -303,8 +375,7 @@ miSpriteCloseScreen (int i, ScreenPtr pScreen) { miSpriteScreenPtr pScreenPriv; - pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, - miSpriteScreenKey); + pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); pScreen->CloseScreen = pScreenPriv->CloseScreen; pScreen->GetImage = pScreenPriv->GetImage; pScreen->GetSpans = pScreenPriv->GetSpans; @@ -315,7 +386,7 @@ miSpriteCloseScreen (int i, ScreenPtr pScreen) DamageDestroy (pScreenPriv->pDamage); - xfree ((pointer) pScreenPriv); + xfree (pScreenPriv); return (*pScreen->CloseScreen) (i, pScreen); } @@ -327,27 +398,27 @@ miSpriteGetImage (DrawablePtr pDrawable, int sx, int sy, int w, int h, { ScreenPtr pScreen = pDrawable->pScreen; miSpriteScreenPtr pScreenPriv; - DeviceIntPtr pDev = inputInfo.pointer; + DeviceIntPtr pDev; miCursorInfoPtr pCursorInfo; SCREEN_PROLOGUE (pScreen, GetImage); - pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, - miSpriteScreenKey); - for(pDev = inputInfo.devices; pDev; pDev = pDev->next) + if (pDrawable->type == DRAWABLE_WINDOW) { - if (DevHasCursor(pDev)) + pScreenPriv = dixLookupPrivate(&pScreen->devPrivates,miSpriteScreenKey); + for(pDev = inputInfo.devices; pDev; pDev = pDev->next) { - pCursorInfo = MISPRITE(pDev); - if (pDrawable->type == DRAWABLE_WINDOW && - pCursorInfo->isUp && - pCursorInfo->pScreen == pScreen && - ORG_OVERLAP(&pCursorInfo->saved,pDrawable->x,pDrawable->y, - sx, sy, w, h)) - { - SPRITE_DEBUG (("GetImage remove\n")); - miSpriteRemoveCursor (pDev, pScreen); - } + if (DevHasCursor(pDev)) + { + pCursorInfo = MISPRITE(pDev); + if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen && + ORG_OVERLAP(&pCursorInfo->saved,pDrawable->x,pDrawable->y, + sx, sy, w, h)) + { + SPRITE_DEBUG (("GetImage remove\n")); + miSpriteRemoveCursor (pDev, pScreen); + } + } } } @@ -363,43 +434,43 @@ miSpriteGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, { ScreenPtr pScreen = pDrawable->pScreen; miSpriteScreenPtr pScreenPriv; - DeviceIntPtr pDev = inputInfo.pointer; + DeviceIntPtr pDev; miCursorInfoPtr pCursorInfo; SCREEN_PROLOGUE (pScreen, GetSpans); - pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, - miSpriteScreenKey); - - for(pDev = inputInfo.devices; pDev; pDev = pDev->next) + if (pDrawable->type == DRAWABLE_WINDOW) { - if (DevHasCursor(pDev)) - { - pCursorInfo = MISPRITE(pDev); + pScreenPriv = dixLookupPrivate(&pScreen->devPrivates,miSpriteScreenKey); - if (pDrawable->type == DRAWABLE_WINDOW && - pCursorInfo->isUp && - pCursorInfo->pScreen == pScreen) + for(pDev = inputInfo.devices; pDev; pDev = pDev->next) + { + if (DevHasCursor(pDev)) { - DDXPointPtr pts; - int *widths; - int nPts; - int xorg, - yorg; - - xorg = pDrawable->x; - yorg = pDrawable->y; - - for (pts = ppt, widths = pwidth, nPts = nspans; - nPts--; - pts++, widths++) + pCursorInfo = MISPRITE(pDev); + + if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen) { - if (SPN_OVERLAP(&pCursorInfo->saved,pts->y+yorg, - pts->x+xorg,*widths)) + DDXPointPtr pts; + int *widths; + int nPts; + int xorg, + yorg; + + xorg = pDrawable->x; + yorg = pDrawable->y; + + for (pts = ppt, widths = pwidth, nPts = nspans; + nPts--; + pts++, widths++) { - SPRITE_DEBUG (("GetSpans remove\n")); - miSpriteRemoveCursor (pDev, pScreen); - break; + if (SPN_OVERLAP(&pCursorInfo->saved,pts->y+yorg, + pts->x+xorg,*widths)) + { + SPRITE_DEBUG (("GetSpans remove\n")); + miSpriteRemoveCursor (pDev, pScreen); + break; + } } } } @@ -417,28 +488,29 @@ miSpriteSourceValidate (DrawablePtr pDrawable, int x, int y, int width, { ScreenPtr pScreen = pDrawable->pScreen; miSpriteScreenPtr pScreenPriv; - DeviceIntPtr pDev = inputInfo.pointer; + DeviceIntPtr pDev; miCursorInfoPtr pCursorInfo; SCREEN_PROLOGUE (pScreen, SourceValidate); - pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, - miSpriteScreenKey); - - for(pDev = inputInfo.devices; pDev; pDev = pDev->next) + if (pDrawable->type == DRAWABLE_WINDOW) { - if (DevHasCursor(pDev)) - { - pCursorInfo = MISPRITE(pDev); - if (pCursorInfo && pDrawable->type == DRAWABLE_WINDOW && pCursorInfo->isUp && - pCursorInfo->pScreen == pScreen && - ORG_OVERLAP(&pCursorInfo->saved, pDrawable->x, pDrawable->y, - x, y, width, height)) - { - SPRITE_DEBUG (("SourceValidate remove\n")); - miSpriteRemoveCursor (pDev, pScreen); - } - } + pScreenPriv = dixLookupPrivate(&pScreen->devPrivates,miSpriteScreenKey); + + for(pDev = inputInfo.devices; pDev; pDev = pDev->next) + { + if (DevHasCursor(pDev)) + { + pCursorInfo = MISPRITE(pDev); + if (pCursorInfo && pCursorInfo->isUp && pCursorInfo->pScreen == pScreen && + ORG_OVERLAP(&pCursorInfo->saved, pDrawable->x, pDrawable->y, + x, y, width, height)) + { + SPRITE_DEBUG (("SourceValidate remove\n")); + miSpriteRemoveCursor (pDev, pScreen); + } + } + } } if (pScreen->SourceValidate) @@ -452,13 +524,12 @@ miSpriteCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) { ScreenPtr pScreen = pWindow->drawable.pScreen; miSpriteScreenPtr pScreenPriv; - DeviceIntPtr pDev = inputInfo.pointer; + DeviceIntPtr pDev; miCursorInfoPtr pCursorInfo; SCREEN_PROLOGUE (pScreen, CopyWindow); - pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, - miSpriteScreenKey); + pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); for(pDev = inputInfo.devices; pDev; pDev = pDev->next) { @@ -469,7 +540,7 @@ miSpriteCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) * Damage will take care of destination check */ if (pCursorInfo && pCursorInfo->isUp && pCursorInfo->pScreen == pScreen && - RECT_IN_REGION (pScreen, prgnSrc, &pCursorInfo->saved) != rgnOUT) + miRectIn(prgnSrc, &pCursorInfo->saved) != rgnOUT) { SPRITE_DEBUG (("CopyWindow remove\n")); miSpriteRemoveCursor (pDev, pScreen); @@ -487,11 +558,10 @@ miSpriteBlockHandler (int i, pointer blockData, pointer pTimeout, { ScreenPtr pScreen = screenInfo.screens[i]; miSpriteScreenPtr pPriv; - DeviceIntPtr pDev = inputInfo.pointer; + DeviceIntPtr pDev; miCursorInfoPtr pCursorInfo; - pPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, - miSpriteScreenKey); + pPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); SCREEN_PROLOGUE(pScreen, BlockHandler); (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); @@ -534,8 +604,7 @@ miSpriteInstallColormap (ColormapPtr pMap) ScreenPtr pScreen = pMap->pScreen; miSpriteScreenPtr pPriv; - pPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, - miSpriteScreenKey); + pPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); SCREEN_PROLOGUE(pScreen, InstallColormap); (*pScreen->InstallColormap) (pMap); @@ -573,11 +642,10 @@ miSpriteStoreColors (ColormapPtr pMap, int ndef, xColorItem *pdef) int i; int updated; VisualPtr pVisual; - DeviceIntPtr pDev = inputInfo.pointer; + DeviceIntPtr pDev; miCursorInfoPtr pCursorInfo; - pPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, - miSpriteScreenKey); + pPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); SCREEN_PROLOGUE(pScreen, StoreColors); (*pScreen->StoreColors) (pMap, ndef, pdef); @@ -652,7 +720,7 @@ miSpriteStoreColors (ColormapPtr pMap, int ndef, xColorItem *pdef) static void miSpriteFindColors (miCursorInfoPtr pDevCursor, ScreenPtr pScreen) { - miSpriteScreenPtr pScreenPriv = (miSpriteScreenPtr) + miSpriteScreenPtr pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); CursorPtr pCursor; xColorItem *sourceColor, *maskColor; @@ -698,9 +766,8 @@ miSpriteRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) miSpriteScreenPtr pScreenPriv; miCursorInfoPtr pCursorInfo; - pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, - miSpriteScreenKey); - if (!pDev->isMaster && !pDev->u.master) + pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); + if (!IsMaster(pDev) && !pDev->u.master) { ErrorF("[mi] miSpriteRealizeCursor called for floating device.\n"); return FALSE; @@ -718,8 +785,7 @@ miSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) { miSpriteScreenPtr pScreenPriv; - pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, - miSpriteScreenKey); + pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); return (*pScreenPriv->funcs->UnrealizeCursor) (pScreen, pCursor); } @@ -730,10 +796,9 @@ miSpriteSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen, miSpriteScreenPtr pScreenPriv; miCursorInfoPtr pPointer; - pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, - miSpriteScreenKey); + pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); - if (!pDev->isMaster && !pDev->u.master) + if (!IsMaster(pDev) && !pDev->u.master) { ErrorF("[mi] miSpriteSetCursor called for floating device.\n"); return; @@ -849,9 +914,8 @@ miSpriteMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) miSpriteScreenPtr pScreenPriv; CursorPtr pCursor; - pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, - miSpriteScreenKey); - if (!pDev->isMaster && !pDev->u.master) + pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); + if (!IsMaster(pDev) && !pDev->u.master) { ErrorF("[mi] miSpriteMoveCursor called for floating device.\n"); return; @@ -869,8 +933,7 @@ miSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) miCursorInfoPtr pCursorInfo; int ret = FALSE; - pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, - miSpriteScreenKey); + pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); pCursorInfo = xalloc(sizeof(miCursorInfoRec)); if (!pCursorInfo) @@ -902,8 +965,8 @@ miSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen) if (DevHasCursor(pDev)) { miSpriteScreenPtr pScreenPriv; - pScreenPriv = (miSpriteScreenPtr) - dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); + pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, + miSpriteScreenKey); (*pScreenPriv->funcs->DeviceCursorCleanup)(pDev, pScreen); } @@ -920,14 +983,13 @@ miSpriteRemoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen) miCursorInfoPtr pCursorInfo; - if (!pDev->isMaster && !pDev->u.master) + if (!IsMaster(pDev) && !pDev->u.master) { ErrorF("[mi] miSpriteRemoveCursor called for floating device.\n"); return; } DamageDrawInternal (pScreen, TRUE); - pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, - miSpriteScreenKey); + pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); pCursorInfo = MISPRITE(pDev); miSpriteIsDown(pCursorInfo); @@ -961,14 +1023,13 @@ miSpriteSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen) CursorPtr pCursor; miCursorInfoPtr pCursorInfo; - if (!pDev->isMaster && !pDev->u.master) + if (!IsMaster(pDev) && !pDev->u.master) { ErrorF("[mi] miSpriteSaveUnderCursor called for floating device.\n"); return; } DamageDrawInternal (pScreen, TRUE); - pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, - miSpriteScreenKey); + pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); pCursorInfo = MISPRITE(pDev); miSpriteComputeSaved (pDev, pScreen); @@ -1005,15 +1066,14 @@ miSpriteRestoreCursor (DeviceIntPtr pDev, ScreenPtr pScreen) CursorPtr pCursor; miCursorInfoPtr pCursorInfo; - if (!pDev->isMaster && !pDev->u.master) + if (!IsMaster(pDev) && !pDev->u.master) { ErrorF("[mi] miSpriteRestoreCursor called for floating device.\n"); return; } DamageDrawInternal (pScreen, TRUE); - pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, - miSpriteScreenKey); + pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); pCursorInfo = MISPRITE(pDev); miSpriteComputeSaved (pDev, pScreen); @@ -1050,13 +1110,12 @@ miSpriteComputeSaved (DeviceIntPtr pDev, ScreenPtr pScreen) CursorPtr pCursor; miCursorInfoPtr pCursorInfo; - if (!pDev->isMaster && !pDev->u.master) + if (!IsMaster(pDev) && !pDev->u.master) { ErrorF("[mi] miSpriteComputeSaved called for floating device.\n"); return; } - pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates, - miSpriteScreenKey); + pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey); pCursorInfo = MISPRITE(pDev); pCursor = pCursorInfo->pCursor; |