Animated cursor

while my threads are busy computing thing, i have my main thread handling the GUI. if there’s a process going, i change the cursor to an animating little disk that spins. (just calls sequential SDL_SetCursor()'s when it needs to).

the problem is that, depending on where the cursor is in my window, the SetCursor calls don’t force a redraw. but if i move the cursor around, it redraws fine. it seems to be throwing out redraws if it doesn’t think things have changed… some times. i can’t figure out what the criteria is for this behavior, tho. if the cursor is generally on the left, it seems to behave properly, but if i move it towards the right, it tends to not animate unless it’s moving.

i think i’ve even forced a redraw with the SDL_SetCursor(NULL) call, but i’m not certain…

any ideas?

-miles vignol

while my threads are busy computing thing, i have my main thread
handling the GUI. if there’s a process going, i change the cursor to
an animating little disk that spins. (just calls sequential
SDL_SetCursor()'s when it needs to).

As Sam said, it doesn’t work that way. Use a timer to send a userevent
to your event handler loop. In side that loop call SDL_SetCursor() when
you get the timer event.

	Bob PendletonOn Wed, 2003-12-03 at 03:29, Miles Vignol wrote:

the problem is that, depending on where the cursor is in my window,
the SetCursor calls don’t force a redraw. but if i move the cursor
around, it redraws fine. it seems to be throwing out redraws if it
doesn’t think things have changed… some times. i can’t figure out
what the criteria is for this behavior, tho. if the cursor is
generally on the left, it seems to behave properly, but if i move it
towards the right, it tends to not animate unless it’s moving.

i think i’ve even forced a redraw with the SDL_SetCursor(NULL) call,
but i’m not certain…

any ideas?

-miles vignol


±--------------------------------------+

while my threads are busy computing thing, i have my main thread
handling the GUI. if there’s a process going, i change the cursor to
an animating little disk that spins. (just calls sequential
SDL_SetCursor()'s when it needs to).

As Sam said, it doesn’t work that way. Use a timer to send a userevent
to your event handler loop. In side that loop call SDL_SetCursor() when
you get the timer event.

Bob Pendleton

that’s what i’m doing. it’s just that some times the cursor doesn’t change
unless i move the mouse (which makes me think it’s throwing out cursor
redraws if the mouse hasn’t moved). i’ve got a timer going every 100ms (i
think) and that aspect is fine.

the strange thing is that i can move the cursor to a different place in my
window (generally more left) and it works fine.

maybe i’ve peeked at the cusor code, but i’m not too familiar with much of
what’s going on there to shed much light on it.

-miles vignolSent: Wednesday, December 03, 2003 10:53 AM

On Wed, 2003-12-03 at 03:29, Miles Vignol wrote:

When you say “move the mouse”, do you mean manually, as in pushing the
physical mouse around on the mousepad? Or have you tried moving the cursor
programmatically? If there’s some bug or feature requiring the mouse’s
position change, it might work to tell SDL (and hence the underlying system)
to move the cursor to the place it’s already at. :^)

-bill!On Wed, Dec 03, 2003 at 12:02:52PM -0800, Miles Vignol wrote:

that’s what i’m doing. it’s just that some times the cursor doesn’t change
unless i move the mouse (which makes me think it’s throwing out cursor
redraws if the mouse hasn’t moved).

doh!

i was compiling with 1.2.6, but the DLL in my project directory was 1.2.4.
it works fine with the latest SDL.DLL in the right place. :slight_smile:

-miles vignol

while my threads are busy computing thing, i have my main thread
handling the GUI. if there’s a process going, i change the cursor to
an animating little disk that spins. (just calls sequential
SDL_SetCursor()'s when it needs to).

As Sam said, it doesn’t work that way. Use a timer to send a userevent
to your event handler loop. In side that loop call SDL_SetCursor() when
you get the timer event.

Bob Pendleton

that’s what i’m doing. it’s just that some times the cursor doesn’t change
unless i move the mouse (which makes me think it’s throwing out cursor
redraws if the mouse hasn’t moved). i’ve got a timer going every 100ms (i
think) and that aspect is fine.

the strange thing is that i can move the cursor to a different place in my
window (generally more left) and it works fine.

At this point I think the best idea is to build the simplest test case
that demonstrates the problem and post it to the list so we can look at
it. Just boil it down to something that animates the cursor with only
the code to animate the cursor.

	Bob PendletonOn Wed, 2003-12-03 at 14:02, Miles Vignol wrote:

Sent: Wednesday, December 03, 2003 10:53 AM

On Wed, 2003-12-03 at 03:29, Miles Vignol wrote:

maybe i’ve peeked at the cusor code, but i’m not too familiar with much of
what’s going on there to shed much light on it.

-miles vignol


SDL mailing list
SDL at libsdl.org
http://www.libsdl.org/mailman/listinfo/sdl

±--------------------------------------+