GTK's Main Loop After initializing the library and creating its windows (we'll see this later), we should pass control to GTK's main loop function, as follows: /* All GTK applications must have a gtk_main(). Control * ends here and waits for an event to occur (like a * key press or mouse event). */ gtk_main(); This function will only return when the application tells GTK to exit, by using the following code in one of the callbacks: /* * mark that we should exit as soon as control * returns to the gtk_main() function. */ gtk_main_quit();