aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/mi/misprite.c
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/mi/misprite.c')
-rw-r--r--xorg-server/mi/misprite.c355
1 files changed, 207 insertions, 148 deletions
diff --git a/xorg-server/mi/misprite.c b/xorg-server/mi/misprite.c
index 692e6c97a..2ec67827e 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 (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->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->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);
@@ -570,11 +639,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);
@@ -649,7 +717,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;
@@ -695,9 +763,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;
@@ -715,8 +782,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);
}
@@ -725,12 +791,11 @@ miSpriteSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
CursorPtr pCursor, int x, int y)
{
miSpriteScreenPtr pScreenPriv;
-
- pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
- miSpriteScreenKey);
miCursorInfoPtr pPointer;
- if (!pDev->isMaster && !pDev->u.master)
+ pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey);
+
+ if (!IsMaster(pDev) && !pDev->u.master)
{
ErrorF("[mi] miSpriteSetCursor called for floating device.\n");
return;
@@ -846,9 +911,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;
@@ -866,8 +930,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)
@@ -899,8 +962,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);
}
@@ -917,14 +980,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);
@@ -958,14 +1020,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);
@@ -1002,15 +1063,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);
@@ -1047,13 +1107,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;