Re: Refreshing the GUI without gtk_main ()



Chris Seaton wrote:
I wrote an interactive scripter with its own loop that runs in the
terminal. This scripter is a back-end of the dedicated GUI. But since it
has its own eternal loop, the GUI doesn't refresh. I can refresh it by
using:

    while (gtk_events_pending()) gtk_main_iteration ();

but this refreshes the GUI only when the scripter performs a particular
action. While it sits and waits for input, the GUI is frozen.

Any idea how to overcome this?


You should never, ever have IO in the same thread as your GUI. That's a
major no-no. Have the GUI running in the main thread, and do your IO in
a new thread.

Use gdk_threads_enter() and _leave() before and after calling GUI
functions from the IO thread.

Previous posts have said not to do *any* gui operations outside of the
main gtk thread. Is there a list of what can and can't be done?



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