Bug 99798

Summary: Animated mouse cursors stop working
Product: xorg Reporter: Max Staudt <bugzilla-fdo-max>
Component: Server/GeneralAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED FIXED QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: medium CC: michalsrb, sndirsch
Version: git   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments:
Description Flags
Reset animated cursor timer when sprite changes none

Description Max Staudt 2017-02-13 16:45:09 UTC
This seems to happen when the cursor needs to stop animating, i.e. when the animation is only played once.

As an example, take the Jewel Green theme:
  https://store.kde.org/content/show.php?content=105848

When hovering over a text field, the cursor morphs into a text cursor. However, the next time the cursor is moved over a text field, it will just jump around, stuck in the first frame of the animation.

This happened with the change to OsTimer for animated cursors:
  https://cgit.freedesktop.org/xorg/xserver/commit/?id=e51ea53b26bd9ec05b9209825960af28d0b6bbe1

Cursors that keep on animating, such as the one used when moving windows, keep working, but break once the text entry cursor has been animated.

This seems to come down to a misunderstanding about the next time to fire, as well as timer_set, in AnimCurTimerNotify().


What is the right course of action here?


(This has originally been reported at: https://bugzilla.opensuse.org/show_bug.cgi?id=1020061)
Comment 1 Michal Srb 2017-08-30 15:57:45 UTC
Created attachment 133887 [details] [review]
Reset animated cursor timer when sprite changes

The problem is that the new animated cursor code will only re-schedule the timer after the previous timer ticked, or when there was no timer set. Even when the cursor image changed, the timer would not be re-scheduled if there is a timer set from the previous cursor image. For looped quickly animating cursors it is probably not even visible. However, the one-time animation is using very long delay on the last frame to prevent looping (1000 seconds in case of "Jewel Green" cursors). So no animations at all are played in the following 1000 seconds.

A solution is to always call `TimerSet` inside the `AnimCurDisplayCursor`. The `TimerSet` function already checks whether there is a pending timer associated with the handle and removes it first.
Comment 2 Michel Dänzer 2017-08-31 01:15:33 UTC
Please add

Bugzilla: https://bugs.freedesktop.org/99798

to the commit log and send the patch to the xorg-devel mailing list for review.
Comment 3 Michal Srb 2017-08-31 06:48:47 UTC
Ok, sent to xorg-devel.
Comment 6 Max Staudt 2018-05-18 15:48:59 UTC
Thanks for the help everyone!

If this has been fixed, can we close it?
Comment 7 Max Staudt 2018-05-18 15:53:36 UTC
Hmm, let's close it for now, and anyone objecting can re-open it ;)

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.