Re: how to fully quit out of recursive main loops?



Paul Davis <pbd op net> writes: 
> why would i want to? imagine the user takes some steps to invoke
> a "quit" function. if there are nested main loops (e.g to run a
> dialog), gtk_main_quit() won't work as a way to return control to
> whatever called gtk_main_run() at the top level.

People sometimes write "while (gtk_main_level ()) gtk_main_quit()"
but I think it's a big old hack.

> ideas?

In my code the policy I use is that I never nest gtk_main(); for
recursive loops I create my own separate
GMainLoop. e.g. gtk_dialog_run does this. This avoids confusion.  Then
I only use gtk_dialog_run sort of stuff if the dialog is modal.

In GTK 2, delete_event for other windows gets turned off when you have
a modal dialog up, in 1.2 there's a bug there that most apps have.
(You can close grab-shadowed windows.)

Havoc





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