gtk_main_iteration_do() usage



I've just started looking into using GTK for a gui on top of an existing main loop, i'm hoping that by using gtk_main_iteration_do(FALSE) i will be able to get the GUI and my existing main loop all working together reasonably well in a single thread.

I've just started testing it with hello world, on the latest version of win32 GTK and i've discovered that gtk_main_iteration_do() is ALWAYS returning TRUE.

The docs say that gtk_main_iteration_do() returns TRUE when quit has happened inside the message loops somewhere.. yet as i said its TRUE all the time at the moment. This presents a small problem with regard to closing the programme by clicking its x button or in this case the hello world button as well.

Is there something i have to do differently in initialising GTK when i wish to use gtk_main_iteration_do() its just looking at the src i found the definition of it and noticed this

if (main_loops)
    return !g_main_loop_is_running (main_loops->data);
else
    return TRUE;

which kind of hints like its doing the else path behaviour in my case, ie. main_loops is NULL, which makes me wonder if i've not set up everything correctly.. I literally copied and pasted the hello world app from the main GTK site (which originally has gtk_main() and i've changed it for gtk_main_iteration_do() within a loop)

Thanks for your time

Regards

James

--
Using Opera's revolutionary e-mail client: http://www.opera.com/m2/


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.5 - Release Date: 03/02/2005




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