Use gtk_widget_get_toplevel() to get to a display's "iconified" state

Don't assume that shell->window is the toplevel GdkWindow, go thorugh
gtk_widget_get_toplevel() instead.
This commit is contained in:
Michael Natterer 2009-09-23 15:14:53 +02:00
parent 90ef404d98
commit 639c427429
2 changed files with 6 additions and 4 deletions

View File

@ -246,8 +246,9 @@ gimp_displays_get_num_visible (Gimp *gimp)
if (GTK_WIDGET_DRAWABLE (display->shell))
{
GdkWindow *window = gtk_widget_get_window (display->shell);
GdkWindowState state = gdk_window_get_state (window);
GtkWidget *toplevel = gtk_widget_get_toplevel (display->shell);
GdkWindow *window = gtk_widget_get_window (toplevel);
GdkWindowState state = gdk_window_get_state (window);
if ((state & (GDK_WINDOW_STATE_WITHDRAWN |
GDK_WINDOW_STATE_ICONIFIED)) == 0)

View File

@ -162,10 +162,11 @@ gimp_display_shell_progress_message (GimpProgress *progress,
static gboolean
gimp_display_shell_is_iconified (GimpDisplayShell *shell)
{
GtkWidget *widget = GTK_WIDGET (shell);
GtkWidget *widget = GTK_WIDGET (shell);
GtkWidget *toplevel = gtk_widget_get_toplevel (widget);
return (GTK_WIDGET_DRAWABLE (widget) &&
gdk_window_get_state (gtk_widget_get_window (widget)) ==
gdk_window_get_state (gtk_widget_get_window (toplevel)) ==
GDK_WINDOW_STATE_ICONIFIED);
}