summaryrefslogtreecommitdiff
path: root/xserver/render/animcur.c
diff options
context:
space:
mode:
Diffstat (limited to 'xserver/render/animcur.c')
-rw-r--r--xserver/render/animcur.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/xserver/render/animcur.c b/xserver/render/animcur.c
index e585a8f23..ef27bda27 100644
--- a/xserver/render/animcur.c
+++ b/xserver/render/animcur.c
@@ -133,7 +133,7 @@ AnimCurTimerNotify(OsTimerPtr timer, CARD32 now, void *arg)
ScreenPtr pScreen = dev->spriteInfo->anim.pScreen;
AnimCurScreenPtr as = GetAnimCurScreen(pScreen);
- AnimCurPtr ac = GetAnimCur(dev->spriteInfo->anim.pCursor);
+ AnimCurPtr ac = GetAnimCur(dev->spriteInfo->sprite->current);
int elt = (dev->spriteInfo->anim.elt + 1) % ac->nelt;
DisplayCursorProcPtr DisplayCursor = pScreen->DisplayCursor;
@@ -147,7 +147,7 @@ AnimCurTimerNotify(OsTimerPtr timer, CARD32 now, void *arg)
pScreen->DisplayCursor = DisplayCursor;
dev->spriteInfo->anim.elt = elt;
- dev->spriteInfo->anim.time = now + ac->elts[elt].delay;
+ dev->spriteInfo->anim.pCursor = ac->elts[elt].pCursor;
return ac->elts[elt].delay;
}
@@ -155,7 +155,8 @@ AnimCurTimerNotify(OsTimerPtr timer, CARD32 now, void *arg)
static void
AnimCurCancelTimer(DeviceIntPtr pDev)
{
- CursorPtr cur = pDev->spriteInfo->anim.pCursor;
+ CursorPtr cur = pDev->spriteInfo->sprite ?
+ pDev->spriteInfo->sprite->current : NULL;
if (IsAnimCur(cur))
TimerCancel(GetAnimCur(cur)->timer);
@@ -172,7 +173,7 @@ AnimCurDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
Unwrap(as, pScreen, DisplayCursor);
if (IsAnimCur(pCursor)) {
- if (pCursor != pDev->spriteInfo->anim.pCursor) {
+ if (pCursor != pDev->spriteInfo->sprite->current) {
AnimCurPtr ac = GetAnimCur(pCursor);
AnimCurCancelTimer(pDev);
@@ -181,8 +182,6 @@ AnimCurDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
if (ret) {
pDev->spriteInfo->anim.elt = 0;
- pDev->spriteInfo->anim.time =
- GetTimeInMillis() + ac->elts[0].delay;
pDev->spriteInfo->anim.pCursor = pCursor;
pDev->spriteInfo->anim.pScreen = pScreen;
@@ -302,7 +301,7 @@ AnimCursorCreate(CursorPtr *cursors, CARD32 *deltas, int ncursor,
CursorPtr *ppCursor, ClientPtr client, XID cid)
{
CursorPtr pCursor;
- int rc, i;
+ int rc = BadAlloc, i;
AnimCurPtr ac;
for (i = 0; i < screenInfo.numScreens; i++)
@@ -317,7 +316,7 @@ AnimCursorCreate(CursorPtr *cursors, CARD32 *deltas, int ncursor,
sizeof(AnimCurRec) +
ncursor * sizeof(AnimCurElt), 1);
if (!pCursor)
- return BadAlloc;
+ return rc;
dixInitPrivates(pCursor, pCursor + 1, PRIVATE_CURSOR);
pCursor->bits = &animCursorBits;
pCursor->refcnt = 1;
@@ -336,8 +335,10 @@ AnimCursorCreate(CursorPtr *cursors, CARD32 *deltas, int ncursor,
ac->timer = TimerSet(NULL, 0, 0, AnimCurTimerNotify, NULL);
/* security creation/labeling check */
- rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR, pCursor,
- RT_NONE, NULL, DixCreateAccess);
+ if (ac->timer)
+ rc = XaceHook(XACE_RESOURCE_ACCESS, client, cid, RT_CURSOR, pCursor,
+ RT_NONE, NULL, DixCreateAccess);
+
if (rc != Success) {
TimerFree(ac->timer);
dixFiniPrivates(pCursor, PRIVATE_CURSOR);