Re: trouble with gtk idle function callback



Eric Smith <eric brouhaha com> writes: 
> I had one serious bug which was apparently unrelated to this.  I was calling
> gtk_idle_remove() from within the idle function.  Pennington's book set me
> straight about this.  (If there was a warning about that in the online GTK+
> docs at www.gtk.org, I missed it.)

It might be worth filing a bug report about the docs here (the
gtk_idle_add/gtk_idle_remove docs should really just say "use
g_idle_add" and then the docs for g_idle_add should explain this
issue. Though it may even work to remove an idle from inside itself in
glib 2, I dn't know.)
 
> 2)  have my idle callback periodically return, so that events can be
>     processed by gtk_main(), after which presumably my idle callback will
>     be called again
> 
> It occurs to me that in case 1, perhaps I could be preventing other idle
> callbacks from being executed.  I'm not installing any others myself, but
> I don't know if there are some standard ones now (or perhaps will be in
> the future).  So perhaps case 2 would be more elegant, or at least more
> future-proof?

The idea of an idle is that it's called continuously while there are
no higher-priority events pending. So I would use 2). Remember that
returning FALSE from your idle removes it though.

Havoc





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]