diff options
author | Owen W. Taylor <otaylor@fishsoup.net> | 2010-10-09 22:29:20 -0400 |
---|---|---|
committer | Owen W. Taylor <otaylor@fishsoup.net> | 2010-10-11 14:06:03 -0400 |
commit | 519d7587117269773c1bd85887779b80fca04b81 (patch) | |
tree | 94bf853d0b1cb1e8e95b4f71317a7aef82e2b480 /gtk | |
parent | 88cf5470290cd03ada031641cb6ee1c90df75e7d (diff) | |
download | gtk+-519d7587117269773c1bd85887779b80fca04b81.tar.gz |
Warn when calling gtk_window_parse_geometry() on an empty window
gtk_window_parse_geometry() gets the size of the window in order
to interpret the position of the window; calling it before, say,
calling gtk_widget_show_all() on a window is a subtle trap, so
add a warning in the case we can easily detect.
https://bugzilla.gnome.org/show_bug.cgi?id=631794
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkwindow.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/gtk/gtkwindow.c b/gtk/gtkwindow.c index 571484eb9e..0c6dbe1f25 100644 --- a/gtk/gtkwindow.c +++ b/gtk/gtkwindow.c @@ -8820,6 +8820,7 @@ gtk_window_parse_geometry (GtkWindow *window, { gint result, x = 0, y = 0; guint w, h; + GtkWidget *child; GdkGravity grav; gboolean size_set, pos_set; GdkScreen *screen; @@ -8827,6 +8828,12 @@ gtk_window_parse_geometry (GtkWindow *window, g_return_val_if_fail (GTK_IS_WINDOW (window), FALSE); g_return_val_if_fail (geometry != NULL, FALSE); + child = gtk_bin_get_child (GTK_BIN (window)); + if (!child || !gtk_widget_get_visible (child)) + g_warning ("gtk_window_parse_geometry() called on a window with no " + "visible children; the window should be set up before " + "gtk_window_parse_geometry() is called."); + screen = gtk_window_check_screen (window); result = gtk_XParseGeometry (geometry, &x, &y, &w, &h); |