Commit ec7907f8 authored by Eamon Walsh's avatar Eamon Walsh

Add an array of integers for use as per-screen cursor private keys.

Replaces the use of the screen pointer itself as the key, which was
nice but won't work now that an array index is being stored.
parent 86898491
......@@ -142,6 +142,8 @@ CursorPtr rootCursor;
Bool blackRoot=FALSE;
Bool whiteRoot=FALSE;
_X_EXPORT int cursorScreenDevPriv[MAXSCREENS];
_X_EXPORT TimeStamp currentTime;
_X_EXPORT TimeStamp lastDeviceEventTime;
......
......@@ -63,10 +63,10 @@ extern void dmxHideCursor(DMXScreenInfo *dmxScreen);
extern void dmxBECreateCursor(ScreenPtr pScreen, CursorPtr pCursor);
extern Bool dmxBEFreeCursor(ScreenPtr pScreen, CursorPtr pCursor);
#define DMX_GET_CURSOR_PRIV(_pCursor, _pScreen) \
((dmxCursorPrivPtr)dixLookupPrivate(&(_pCursor)->devPrivates, _pScreen))
#define DMX_GET_CURSOR_PRIV(_pCursor, _pScreen) ((dmxCursorPrivPtr) \
dixLookupPrivate(&(_pCursor)->devPrivates, CursorScreenKey(_pScreen)))
#define DMX_SET_CURSOR_PRIV(_pCursor, _pScreen, v) \
dixSetPrivate(&(_pCursor)->devPrivates, _pScreen, v)
dixSetPrivate(&(_pCursor)->devPrivates, CursorScreenKey(_pScreen), v)
#endif /* DMXCURSOR_H */
......@@ -112,6 +112,7 @@ _X_HIDDEN void *dixLookupTab[] = {
SYMFUNC(QueryColors)
/* cursor.c */
SYMFUNC(FreeCursor)
SYMVAR(cursorScreenDevPriv)
/* deprecated.c */
SYMFUNC(LookupClient)
SYMFUNC(LookupDrawable)
......
......@@ -230,7 +230,7 @@ xf86_set_cursor_colors (ScrnInfoPtr scrn, int bg, int fg)
int c;
CARD8 *bits = cursor ?
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
dixLookupPrivate(&cursor->devPrivates, screen)
dixLookupPrivate(&cursor->devPrivates, CursorScreenKey(screen))
#else
cursor->devPriv[screen->myNum]
#endif
......@@ -617,7 +617,7 @@ xf86_reload_cursors (ScreenPtr screen)
if (cursor)
{
#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0)
void *src = dixLookupPrivate(&cursor->devPrivates, screen);
void *src = dixLookupPrivate(&cursor->devPrivates, CursorScreenKey(screen));
#else
void *src = cursor->devPriv[screen->myNum];
#endif
......
......@@ -269,7 +269,7 @@ xf86CursorRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCurs)
&pScreen->devPrivates, xf86CursorScreenKey);
if (pCurs->refcnt <= 1)
dixSetPrivate(&pCurs->devPrivates, pScreen, NULL);
dixSetPrivate(&pCurs->devPrivates, CursorScreenKey(pScreen), NULL);
return (*ScreenPriv->spriteFuncs->RealizeCursor)(pDev, pScreen, pCurs);
}
......@@ -282,8 +282,8 @@ xf86CursorUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
&pScreen->devPrivates, xf86CursorScreenKey);
if (pCurs->refcnt <= 1) {
xfree(dixLookupPrivate(&pCurs->devPrivates, pScreen));
dixSetPrivate(&pCurs->devPrivates, pScreen, NULL);
xfree(dixLookupPrivate(&pCurs->devPrivates, CursorScreenKey(pScreen)));
dixSetPrivate(&pCurs->devPrivates, CursorScreenKey(pScreen), NULL);
}
return (*ScreenPriv->spriteFuncs->UnrealizeCursor)(pDev, pScreen, pCurs);
......
......@@ -123,7 +123,7 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
return;
}
bits = (unsigned char *)dixLookupPrivate(&pCurs->devPrivates, pScreen);
bits = dixLookupPrivate(&pCurs->devPrivates, CursorScreenKey(pScreen));
x -= infoPtr->pScrn->frameX0 + ScreenPriv->HotX;
y -= infoPtr->pScrn->frameY0 + ScreenPriv->HotY;
......@@ -133,7 +133,7 @@ xf86SetCursor(ScreenPtr pScreen, CursorPtr pCurs, int x, int y)
#endif
if (!bits) {
bits = (*infoPtr->RealizeCursor)(infoPtr, pCurs);
dixSetPrivate(&pCurs->devPrivates, pScreen, bits);
dixSetPrivate(&pCurs->devPrivates, CursorScreenKey(pScreen), bits);
}
if (!(infoPtr->Flags & HARDWARE_CURSOR_UPDATE_UNHIDDEN))
......
......@@ -28,11 +28,11 @@ typedef struct {
Cursor cursor;
} xnestPrivCursor;
#define xnestGetCursorPriv(pCursor, pScreen) \
((xnestPrivCursor *)dixLookupPrivate(&(pCursor)->devPrivates, pScreen))
#define xnestGetCursorPriv(pCursor, pScreen) ((xnestPrivCursor *) \
dixLookupPrivate(&(pCursor)->devPrivates, CursorScreenKey(pScreen)))
#define xnestSetCursorPriv(pCursor, pScreen, v) \
dixSetPrivate(&(pCursor)->devPrivates, pScreen, v)
dixSetPrivate(&(pCursor)->devPrivates, CursorScreenKey(pScreen), v)
#define xnestCursor(pCursor, pScreen) \
(xnestGetCursorPriv(pCursor, pScreen)->cursor)
......
......@@ -65,6 +65,8 @@ typedef struct _Cursor *CursorPtr;
typedef struct _CursorMetric *CursorMetricPtr;
extern CursorPtr rootCursor;
extern int cursorScreenDevPriv[MAXSCREENS];
#define CursorScreenKey(pScreen) (cursorScreenDevPriv + (pScreen)->myNum)
extern int FreeCursor(
pointer /*pCurs*/,
......
......@@ -178,7 +178,7 @@ static Bool
miDCRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
{
if (pCursor->bits->refcnt <= 1)
dixSetPrivate(&pCursor->bits->devPrivates, pScreen, NULL);
dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), NULL);
return TRUE;
}
......@@ -277,7 +277,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
xfree ((pointer) pPriv);
return (miDCCursorPtr)NULL;
}
dixSetPrivate(&pCursor->bits->devPrivates, pScreen, pPriv);
dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), pPriv);
return pPriv;
}
pPriv->pPicture = 0;
......@@ -295,7 +295,7 @@ miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
xfree ((pointer) pPriv);
return (miDCCursorPtr)NULL;
}
dixSetPrivate(&pCursor->bits->devPrivates, pScreen, pPriv);
dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), pPriv);
/* create the two sets of bits, clipping as appropriate */
......@@ -340,7 +340,7 @@ miDCUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
miDCCursorPtr pPriv;
pPriv = (miDCCursorPtr)dixLookupPrivate(&pCursor->bits->devPrivates,
pScreen);
CursorScreenKey(pScreen));
if (pPriv && (pCursor->bits->refcnt <= 1))
{
if (pPriv->sourceBits)
......@@ -352,7 +352,7 @@ miDCUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
FreePicture (pPriv->pPicture, 0);
#endif
xfree ((pointer) pPriv);
dixSetPrivate(&pCursor->bits->devPrivates, pScreen, NULL);
dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), NULL);
}
return TRUE;
}
......@@ -446,7 +446,7 @@ miDCPutUpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
WindowPtr pWin;
pPriv = (miDCCursorPtr)dixLookupPrivate(&pCursor->bits->devPrivates,
pScreen);
CursorScreenKey(pScreen));
if (!pPriv)
{
pPriv = miDCRealize(pScreen, pCursor);
......@@ -756,7 +756,7 @@ miDCMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
PixmapPtr pTemp;
pPriv = (miDCCursorPtr)dixLookupPrivate(&pCursor->bits->devPrivates,
pScreen);
CursorScreenKey(pScreen));
if (!pPriv)
{
pPriv = miDCRealize(pScreen, pCursor);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment