diff options
Diffstat (limited to 'dix/events.c')
-rw-r--r-- | dix/events.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/dix/events.c b/dix/events.c index 9dd735694..f96fe1ce4 100644 --- a/dix/events.c +++ b/dix/events.c @@ -2932,6 +2932,7 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin) { SpritePtr pSprite; ScreenPtr pScreen; + CursorPtr pCursor; if (!pDev->spriteInfo->sprite) { @@ -2975,8 +2976,7 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin) if (pWin) { - pSprite->current = wCursor(pWin); - pSprite->current->refcnt++; + pCursor = wCursor(pWin); pSprite->spriteTrace = (WindowPtr *)xcalloc(1, 32*sizeof(WindowPtr)); if (!pSprite->spriteTrace) FatalError("Failed to allocate spriteTrace"); @@ -2989,13 +2989,18 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin) pSprite->pDequeueScreen = pSprite->pEnqueueScreen; } else { - pSprite->current = NullCursor; + pCursor = NullCursor; pSprite->spriteTrace = NULL; pSprite->spriteTraceSize = 0; pSprite->spriteTraceGood = 0; pSprite->pEnqueueScreen = screenInfo.screens[0]; pSprite->pDequeueScreen = pSprite->pEnqueueScreen; } + if (pCursor) + pCursor->refcnt++; + if (pSprite->current) + FreeCursor(pSprite->current, None); + pSprite->current = pCursor; if (pScreen) { @@ -3048,6 +3053,7 @@ UpdateSpriteForScreen(DeviceIntPtr pDev, ScreenPtr pScreen) { SpritePtr pSprite = NULL; WindowPtr win = NULL; + CursorPtr pCursor; if (!pScreen) return ; @@ -3063,8 +3069,12 @@ UpdateSpriteForScreen(DeviceIntPtr pDev, ScreenPtr pScreen) pSprite->hotLimits.x2 = pScreen->width; pSprite->hotLimits.y2 = pScreen->height; pSprite->win = win; - pSprite->current = wCursor (win); - pSprite->current->refcnt++; + pCursor = wCursor(win); + if (pCursor) + pCursor->refcnt++; + if (pSprite->current) + FreeCursor(pSprite->current, 0); + pSprite->current = pCursor; pSprite->spriteTraceGood = 1; pSprite->spriteTrace[0] = win; (*pScreen->CursorLimits) (pDev, |