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,

When I add a background function with g_idle_add() I am blocking the
GTK main loop? Well I just wanted to avoid that.

But even without use of g_idle_add() the animation stops, when I move
the cursor out of the window and back, see my first example. So there
is a GTK bug.

My initial chess GUI was this:


I know that it was really ugly, I was told that

while gtk3.eventsPending(): discard gtk3.mainIteration()

is really bad design. But that first draft was basically only a test of
the low level Nim GTK wrapper, and it was working six months ago. It is
still working, but mouse cursor is not animated any longer.

For user input, I was going to use a basic state maschiene -- state
advances by each user mouse click. Response of computer is more
difficult, I was going to use g_idle_add() to run computer chess engine
in the background. But maybe I should use a own task/process? (Which
may be a problem again, as GTK is single threaded?)

Unfortunately, for such use cases there are nearly no GTK example
available. Have done some Goggle search already...
gtk-list mailing list