On 04/30/2016 03:26 PM, Integratron wrote:
I have been investigating using GTK windows and widgets in a program whose main loop is controlled by libdispatch. The target is X11 on Linux. GTK is used only for the GUI. (Other glib event sources are not used in this application. Networking is done using libdispatch.) I've read through the gtk source and the mainloop and believe that updating the GUI may be as simple as registering the following block callback for the main queue, where the file descriptor watched is the X11 socket.
How will this handle timeout events? Although your code only uses GTK, the implementation of GTK itself can and does use g_timeout_add and friends.
Also, you will almost certainly need to consider other sources. Again, even if your code doesn't use them, it is pretty likely that some GTK widgets make use of arbitrary GSources - the file chooser comes to mind.
Another thing you need to think about are modal dialogs, which run their own inner main loop. Your libdispatch main loop will be unresponsive during a modal dialog run.
Could you simply run the GTK main loop in one thread, and the libdispatch main loop in another? A libdispatch callback would then use g_idle_add to invoke GTK code, and GTK callbacks could do similar for libdispatch.
Hrvoje _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx https://mail.gnome.org/mailman/listinfo/gtk-list