Web lists-archives.com

Re: Wait cursor animation does not work properly




On Sun, 2017-09-03 at 16:54 +0100, Emmanuele Bassi wrote:
> You're blocking the toolkit's main loop, here. If your application
> does this, it's broken and needs to be fixed - regardless of what the
> cursor looks like.
> 
> The cursor is rendered by the Wayland compositor, but the animation
> is
> performed by the toolkit, i.e. it's the toolkit that uploads the
> cursor's data to the compositor.

Of course you are right that using g_idle_add() is still blocking the
GUI. But I think that having an animated Busy cursor makes only sense
at all when it is animated while a program is doing some heavy
calculation. So the animated cursor is indeed an indication for a short
blocked period. My chess engine takes only a few seconds to calculate
the next move, so creating an own thread is some overkill. What I need:
User has done his move, so update display, indicate that computer is
"thinking" for a few seconds, and then update display again. I think
that should be possible with g_idle_add(). Instead of the busy pointer
I may set a message to the window title.

Later I may consider indeed using a separate thread -- I did that
already one year ago for my Ned Nim editor for communicating with the
nimsuggest process, but I can not remember details currently. Doing it
really properly may be not easy for a chess engine, as the human player
should be able to interrupt the computer thinking at arbitrary times. 
Unfortunately there exist very few examples, and some are more Python
related like

https://stackoverflow.com/questions/16934087/how-to-do-background-task-in-gtk3-python
_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list