|
|
28a1ec |
From a8f8ecdde495fb2a6ecdeca306b55c22b5fd3a6d Mon Sep 17 00:00:00 2001
|
|
|
28a1ec |
From: Adam Jackson <ajax@redhat.com>
|
|
|
28a1ec |
Date: Tue, 9 Jan 2018 10:54:05 -0500
|
|
|
28a1ec |
Subject: [PATCH xserver 5/6] animcur: Fix transitions between animated cursors
|
|
|
28a1ec |
|
|
|
28a1ec |
We weren't cancelling the old timer when changing cursors, making things
|
|
|
28a1ec |
go all crashy. Logically we could always cancel the timer first, but
|
|
|
28a1ec |
then we'd have to call TimerSet to re-arm ourselves, and GetTimeInMillis
|
|
|
28a1ec |
is potentially expensive.
|
|
|
28a1ec |
|
|
|
28a1ec |
Reported-by: https://devtalk.nvidia.com/default/topic/1028172/linux/titan-v-ubuntu-16-04lts-and-387-34-driver-crashes-badly/post/5230967/#5230967
|
|
|
28a1ec |
Signed-off-by: Adam Jackson <ajax@redhat.com>
|
|
|
28a1ec |
Reviewed-by: Aaron Plattner <aplattner@nvidia.com>
|
|
|
28a1ec |
Tested-by: Aaron Plattner <aplattner@nvidia.com>
|
|
|
28a1ec |
(cherry picked from commit de60245e05c0d2528d4ff42557a044387e53315c)
|
|
|
28a1ec |
---
|
|
|
28a1ec |
render/animcur.c | 25 +++++++++++++++----------
|
|
|
28a1ec |
1 file changed, 15 insertions(+), 10 deletions(-)
|
|
|
28a1ec |
|
|
|
28a1ec |
diff --git a/render/animcur.c b/render/animcur.c
|
|
|
28a1ec |
index 9393b4018..e585a8f23 100644
|
|
|
28a1ec |
--- a/render/animcur.c
|
|
|
28a1ec |
+++ b/render/animcur.c
|
|
|
28a1ec |
@@ -152,11 +152,20 @@ AnimCurTimerNotify(OsTimerPtr timer, CARD32 now, void *arg)
|
|
|
28a1ec |
return ac->elts[elt].delay;
|
|
|
28a1ec |
}
|
|
|
28a1ec |
|
|
|
28a1ec |
+static void
|
|
|
28a1ec |
+AnimCurCancelTimer(DeviceIntPtr pDev)
|
|
|
28a1ec |
+{
|
|
|
28a1ec |
+ CursorPtr cur = pDev->spriteInfo->anim.pCursor;
|
|
|
28a1ec |
+
|
|
|
28a1ec |
+ if (IsAnimCur(cur))
|
|
|
28a1ec |
+ TimerCancel(GetAnimCur(cur)->timer);
|
|
|
28a1ec |
+}
|
|
|
28a1ec |
+
|
|
|
28a1ec |
static Bool
|
|
|
28a1ec |
AnimCurDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
|
|
|
28a1ec |
{
|
|
|
28a1ec |
AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
|
|
|
28a1ec |
- Bool ret;
|
|
|
28a1ec |
+ Bool ret = TRUE;
|
|
|
28a1ec |
|
|
|
28a1ec |
if (IsFloating(pDev))
|
|
|
28a1ec |
return FALSE;
|
|
|
28a1ec |
@@ -166,8 +175,10 @@ AnimCurDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
|
|
|
28a1ec |
if (pCursor != pDev->spriteInfo->anim.pCursor) {
|
|
|
28a1ec |
AnimCurPtr ac = GetAnimCur(pCursor);
|
|
|
28a1ec |
|
|
|
28a1ec |
- ret = (*pScreen->DisplayCursor)
|
|
|
28a1ec |
- (pDev, pScreen, ac->elts[0].pCursor);
|
|
|
28a1ec |
+ AnimCurCancelTimer(pDev);
|
|
|
28a1ec |
+ ret = (*pScreen->DisplayCursor) (pDev, pScreen,
|
|
|
28a1ec |
+ ac->elts[0].pCursor);
|
|
|
28a1ec |
+
|
|
|
28a1ec |
if (ret) {
|
|
|
28a1ec |
pDev->spriteInfo->anim.elt = 0;
|
|
|
28a1ec |
pDev->spriteInfo->anim.time =
|
|
|
28a1ec |
@@ -179,15 +190,9 @@ AnimCurDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
|
|
|
28a1ec |
AnimCurTimerNotify, pDev);
|
|
|
28a1ec |
}
|
|
|
28a1ec |
}
|
|
|
28a1ec |
- else
|
|
|
28a1ec |
- ret = TRUE;
|
|
|
28a1ec |
}
|
|
|
28a1ec |
else {
|
|
|
28a1ec |
- CursorPtr old = pDev->spriteInfo->anim.pCursor;
|
|
|
28a1ec |
-
|
|
|
28a1ec |
- if (old && IsAnimCur(old))
|
|
|
28a1ec |
- TimerCancel(GetAnimCur(old)->timer);
|
|
|
28a1ec |
-
|
|
|
28a1ec |
+ AnimCurCancelTimer(pDev);
|
|
|
28a1ec |
pDev->spriteInfo->anim.pCursor = 0;
|
|
|
28a1ec |
pDev->spriteInfo->anim.pScreen = 0;
|
|
|
28a1ec |
ret = (*pScreen->DisplayCursor) (pDev, pScreen, pCursor);
|
|
|
28a1ec |
--
|
|
|
28a1ec |
2.14.3
|