On Wed, May 16, 2007 at 02:19:19PM -0400, Dan Gruhn wrote: > I am running on FedoraCore5 and I have an application that when the user > clicks the "X" in the upper right wants to query for saving any changed > data. I have currently coded this as a signal handler for the delete > event which puts up a modal dialog box with the questions and waits for > the user's response. However, after some internal timeout, I get > another dialog box warning me that the window titled "..." is not > responding and do I want to force it to quit, losing all of my data. > > I would like to disable this if possible, but I've not yet found a way. > Is this caused by GTK? Has anyone encountered this and have you found a > way around it?
You are probably doing something wrong. As you can try yourself, this program ====================================================== #include <gtk/gtk.h> static gboolean deleted(GtkWindow *window) { GtkWidget *dialog; gint response; dialog = gtk_message_dialog_new(window, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, "Really close window?"); response = gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog); return response == GTK_RESPONSE_NO; } int main(int argc, char *argv[]) { GtkWidget *window, *widget; gtk_init(&argc, &argv); window = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_window_set_default_size(GTK_WINDOW(window), 400, 300); widget = gtk_label_new("Try to close me"); gtk_container_add(GTK_CONTAINER(window), widget); gtk_widget_show_all(window); g_signal_connect(G_OBJECT(window), "delete-event", G_CALLBACK(deleted), NULL); g_signal_connect(G_OBJECT(window), "destroy", gtk_main_quit, NULL); gtk_main(); return 0; } ====================================================== does exactly what you describe, yet it does not raise any `force quit' dialog. While this is no hard proof, it still supports the theory if you let Gtk+ main loop run it properly responds to anything the window manager may want a response to. However, if one replaces the body of deleted() with sleep(3), metacity indeed starts complaininig about a non-responsive application with the `force quit' dialog. This is because the window does not respond to the ping sent after delete events in 2.25 second now (the timeout value seems to be hardwired in metacity). Usually there is no reason why a yes/no dialog construction should take several seconds. And even if there is, your application should not become non-responsive for such a long time, so do the necessary work in a way that lets Gtk+ main loop to run. Yeti -- http://gwyddion.net/ _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list