summaryrefslogtreecommitdiff
path: root/xserver/mi/misprite.c
diff options
context:
space:
mode:
Diffstat (limited to 'xserver/mi/misprite.c')
-rw-r--r--xserver/mi/misprite.c75
1 files changed, 37 insertions, 38 deletions
diff --git a/xserver/mi/misprite.c b/xserver/mi/misprite.c
index e682b243a..add2c5505 100644
--- a/xserver/mi/misprite.c
+++ b/xserver/mi/misprite.c
@@ -59,8 +59,6 @@ typedef struct {
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;
@@ -137,10 +135,24 @@ typedef struct {
#define SPRITE_DEBUG(x)
#endif
-#define MISPRITE(dev) \
- (IsFloating(dev) ? \
- (miCursorInfoPtr)dixLookupPrivate(&dev->devPrivates, miSpriteDevPrivatesKey) : \
- (miCursorInfoPtr)dixLookupPrivate(&(GetMaster(dev, MASTER_POINTER))->devPrivates, miSpriteDevPrivatesKey))
+static DevPrivateKeyRec miSpriteScreenKeyRec;
+static DevPrivateKeyRec miSpriteDevPrivatesKeyRec;
+
+static miSpriteScreenPtr
+GetSpriteScreen(ScreenPtr pScreen)
+{
+ return dixLookupPrivate(&pScreen->devPrivates, &miSpriteScreenKeyRec);
+}
+
+static miCursorInfoPtr
+GetSprite(DeviceIntPtr dev)
+{
+ if (IsFloating(dev))
+ return dixLookupPrivate(&dev->devPrivates, &miSpriteDevPrivatesKeyRec);
+
+ return dixLookupPrivate(&(GetMaster(dev, MASTER_POINTER))->devPrivates,
+ &miSpriteDevPrivatesKeyRec);
+}
static void
miSpriteDisableDamage(ScreenPtr pScreen, miSpriteScreenPtr pScreenPriv)
@@ -177,15 +189,6 @@ miSpriteIsDown(miCursorInfoPtr pDevCursor)
* screen wrappers
*/
-static DevPrivateKeyRec miSpriteScreenKeyRec;
-
-#define miSpriteScreenKey (&miSpriteScreenKeyRec)
-#define GetSpriteScreen(pScreen) \
- (dixLookupPrivate(&(pScreen)->devPrivates, miSpriteScreenKey))
-static DevPrivateKeyRec miSpriteDevPrivatesKeyRec;
-
-#define miSpriteDevPrivatesKey (&miSpriteDevPrivatesKeyRec)
-
static Bool miSpriteCloseScreen(ScreenPtr pScreen);
static void miSpriteGetImage(DrawablePtr pDrawable, int sx, int sy,
int w, int h, unsigned int format,
@@ -261,7 +264,7 @@ miSpriteReportDamage(DamagePtr pDamage, RegionPtr pRegion, void *closure)
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if (DevHasCursor(pDev)) {
- pCursorInfo = MISPRITE(pDev);
+ pCursorInfo = GetSprite(pDev);
if (pCursorInfo->isUp &&
pCursorInfo->pScreen == pScreen &&
@@ -334,7 +337,7 @@ miSpriteInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
pScreenPriv->damageRegistered = 0;
pScreenPriv->numberOfCursors = 0;
- dixSetPrivate(&pScreen->devPrivates, miSpriteScreenKey, pScreenPriv);
+ dixSetPrivate(&pScreen->devPrivates, &miSpriteScreenKeyRec, pScreenPriv);
pScreen->CloseScreen = miSpriteCloseScreen;
pScreen->GetImage = miSpriteGetImage;
@@ -390,7 +393,7 @@ miSpriteGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h,
if (pDrawable->type == DRAWABLE_WINDOW) {
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if (DevHasCursor(pDev)) {
- pCursorInfo = MISPRITE(pDev);
+ pCursorInfo = GetSprite(pDev);
if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen &&
ORG_OVERLAP(&pCursorInfo->saved, pDrawable->x, pDrawable->y,
sx, sy, w, h)) {
@@ -420,7 +423,7 @@ miSpriteGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
if (pDrawable->type == DRAWABLE_WINDOW) {
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if (DevHasCursor(pDev)) {
- pCursorInfo = MISPRITE(pDev);
+ pCursorInfo = GetSprite(pDev);
if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen) {
DDXPointPtr pts;
@@ -464,7 +467,7 @@ miSpriteSourceValidate(DrawablePtr pDrawable, int x, int y, int width,
if (pDrawable->type == DRAWABLE_WINDOW) {
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if (DevHasCursor(pDev)) {
- pCursorInfo = MISPRITE(pDev);
+ pCursorInfo = GetSprite(pDev);
if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen &&
ORG_OVERLAP(&pCursorInfo->saved, pDrawable->x, pDrawable->y,
x, y, width, height)) {
@@ -494,7 +497,7 @@ miSpriteCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if (DevHasCursor(pDev)) {
- pCursorInfo = MISPRITE(pDev);
+ pCursorInfo = GetSprite(pDev);
/*
* Damage will take care of destination check
*/
@@ -522,7 +525,7 @@ miSpriteBlockHandler(ScreenPtr pScreen, void *timeout)
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if (DevHasCursor(pDev)) {
- pCursorInfo = MISPRITE(pDev);
+ pCursorInfo = GetSprite(pDev);
if (pCursorInfo && !pCursorInfo->isUp
&& pCursorInfo->pScreen == pScreen && pCursorInfo->shouldBeUp) {
SPRITE_DEBUG(("BlockHandler save"));
@@ -532,7 +535,7 @@ miSpriteBlockHandler(ScreenPtr pScreen, void *timeout)
}
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if (DevHasCursor(pDev)) {
- pCursorInfo = MISPRITE(pDev);
+ pCursorInfo = GetSprite(pDev);
if (pCursorInfo && !pCursorInfo->isUp &&
pCursorInfo->pScreen == pScreen && pCursorInfo->shouldBeUp) {
SPRITE_DEBUG(("BlockHandler restore\n"));
@@ -571,7 +574,7 @@ miSpriteInstallColormap(ColormapPtr pMap)
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if (DevHasCursor(pDev)) {
- pCursorInfo = MISPRITE(pDev);
+ pCursorInfo = GetSprite(pDev);
pCursorInfo->checkPixels = TRUE;
if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen)
miSpriteRemoveCursor(pDev, pScreen);
@@ -641,7 +644,7 @@ miSpriteStoreColors(ColormapPtr pMap, int ndef, xColorItem * pdef)
if (updated) {
for (pDev = inputInfo.devices; pDev; pDev = pDev->next) {
if (DevHasCursor(pDev)) {
- pCursorInfo = MISPRITE(pDev);
+ pCursorInfo = GetSprite(pDev);
pCursorInfo->checkPixels = TRUE;
if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen)
miSpriteRemoveCursor(pDev, pScreen);
@@ -700,7 +703,7 @@ miSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
if (IsFloating(pDev))
return FALSE;
- pCursorInfo = MISPRITE(pDev);
+ pCursorInfo = GetSprite(pDev);
if (pCursor == pCursorInfo->pCursor)
pCursorInfo->checkPixels = TRUE;
@@ -724,7 +727,7 @@ miSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
if (IsFloating(pDev))
return;
- pPointer = MISPRITE(pDev);
+ pPointer = GetSprite(pDev);
pScreenPriv = GetSpriteScreen(pScreen);
if (!pCursor) {
@@ -750,7 +753,6 @@ miSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
}
pPointer->x = x;
pPointer->y = y;
- pPointer->pCacheWin = NullWindow;
if (pPointer->checkPixels || pPointer->pCursor != pCursor) {
pPointer->pCursor = pCursor;
miSpriteFindColors(pPointer, pScreen);
@@ -777,7 +779,7 @@ miSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
if (IsFloating(pDev))
return;
- pCursor = MISPRITE(pDev)->pCursor;
+ pCursor = GetSprite(pDev)->pCursor;
miSpriteSetCursor(pDev, pScreen, pCursor, x, y);
}
@@ -791,14 +793,12 @@ miSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
miCursorInfoPtr pCursorInfo;
pCursorInfo =
- dixLookupPrivate(&pDev->devPrivates, miSpriteDevPrivatesKey);
+ dixLookupPrivate(&pDev->devPrivates, &miSpriteDevPrivatesKeyRec);
pCursorInfo->pCursor = NULL;
pCursorInfo->x = 0;
pCursorInfo->y = 0;
pCursorInfo->isUp = FALSE;
pCursorInfo->shouldBeUp = FALSE;
- pCursorInfo->pCacheWin = NullWindow;
- pCursorInfo->isInCacheWin = FALSE;
pCursorInfo->checkPixels = TRUE;
pCursorInfo->pScreen = FALSE;
}
@@ -810,7 +810,7 @@ static void
miSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
{
miCursorInfoPtr pCursorInfo =
- dixLookupPrivate(&pDev->devPrivates, miSpriteDevPrivatesKey);
+ dixLookupPrivate(&pDev->devPrivates, &miSpriteDevPrivatesKeyRec);
if (DevHasCursor(pDev))
miDCDeviceCleanup(pDev, pScreen);
@@ -833,11 +833,10 @@ miSpriteRemoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen)
DamageDrawInternal(pScreen, TRUE);
pScreenPriv = GetSpriteScreen(pScreen);
- pCursorInfo = MISPRITE(pDev);
+ pCursorInfo = GetSprite(pDev);
miSpriteIsDown(pCursorInfo);
miSpriteRegisterBlockHandler(pScreen, pScreenPriv);
- pCursorInfo->pCacheWin = NullWindow;
miSpriteDisableDamage(pScreen, pScreenPriv);
if (!miDCRestoreUnderCursor(pDev,
pScreen,
@@ -869,7 +868,7 @@ miSpriteSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen)
DamageDrawInternal(pScreen, TRUE);
pScreenPriv = GetSpriteScreen(pScreen);
- pCursorInfo = MISPRITE(pDev);
+ pCursorInfo = GetSprite(pDev);
miSpriteComputeSaved(pDev, pScreen);
@@ -905,7 +904,7 @@ miSpriteRestoreCursor(DeviceIntPtr pDev, ScreenPtr pScreen)
DamageDrawInternal(pScreen, TRUE);
pScreenPriv = GetSpriteScreen(pScreen);
- pCursorInfo = MISPRITE(pDev);
+ pCursorInfo = GetSprite(pDev);
miSpriteComputeSaved(pDev, pScreen);
pCursor = pCursorInfo->pCursor;
@@ -942,7 +941,7 @@ miSpriteComputeSaved(DeviceIntPtr pDev, ScreenPtr pScreen)
if (IsFloating(pDev))
return;
- pCursorInfo = MISPRITE(pDev);
+ pCursorInfo = GetSprite(pDev);
pCursor = pCursorInfo->pCursor;
x = pCursorInfo->x - (int) pCursor->bits->xhot;