diff options
author | Ulf Lamping <ulf.lamping@web.de> | 2004-05-16 18:42:55 +0000 |
---|---|---|
committer | Ulf Lamping <ulf.lamping@web.de> | 2004-05-16 18:42:55 +0000 |
commit | 82ca4cc6b5c7aa637aaca144206634f591d6ba48 (patch) | |
tree | 9e360d9eaa08adef0194cbe7c4be6e379f67e052 /gtk/simple_dialog.c | |
parent | 69df78b341d4a552ff6acf7e91fede6cd1eab78a (diff) |
don't show simple_dialogs, if main window iconified (minimized),
this would lead to an unresponsive program.
Simply discard the messages, as we don't have a way to queue and show this
message if the main window is becoming "visible" again.
svn path=/trunk/; revision=10910
Diffstat (limited to 'gtk/simple_dialog.c')
-rw-r--r-- | gtk/simple_dialog.c | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/gtk/simple_dialog.c b/gtk/simple_dialog.c index 004dbb61fd..3f19eff5c8 100644 --- a/gtk/simple_dialog.c +++ b/gtk/simple_dialog.c @@ -1,7 +1,7 @@ /* simple_dialog.c * Simple message dialog box routines. * - * $Id: simple_dialog.c,v 1.32 2004/05/01 22:55:22 obiot Exp $ + * $Id: simple_dialog.c,v 1.33 2004/05/16 18:42:55 ulfl Exp $ * * Ethereal - Network traffic analyzer * By Gerald Combs <gerald@ethereal.com> @@ -261,10 +261,34 @@ vsimple_dialog(gint type, gint btn_mask, const gchar *msg_format, va_list ap) gchar *message; queued_message_t *queued_message; GtkWidget *win; +#if GTK_MAJOR_VERSION >= 2 + GdkWindowState state = 0; +#endif /* Format the message. */ message = g_strdup_vprintf(msg_format, ap); +#if GTK_MAJOR_VERSION >= 2 + if (top_level != NULL) { + state = gdk_window_get_state(top_level->window); + } + + /* If the main window is iconified, don't show the dialog, and don't + queue up the message for later display. If showing up a dialog, + while main window is iconified, program will become unresponsive! + If it would be queued, there's no point to show the dialog. So it's not + shown until another one is shown, which will be very confusing. + + XXX - get a callback when main window is shown again and call + display_queued_messages() in this callback. And of course, queue up + the message for display until this happens */ + if (state & GDK_WINDOW_STATE_ICONIFIED) { + g_log(G_LOG_DOMAIN, G_LOG_LEVEL_DEBUG, "Discarded message, while main window iconified:\n%s", message); + g_free(message); + return NULL; + } +#endif + /* If we don't yet have a main window, queue up the message for later display. */ if (top_level == NULL) { |