diff options
author | Matthias Clasen <mclasen@redhat.com> | 2005-07-21 04:33:37 +0000 |
---|---|---|
committer | Matthias Clasen <matthiasc@src.gnome.org> | 2005-07-21 04:33:37 +0000 |
commit | a5bc998bfd5361d1a105fc597d473adafebb7bde (patch) | |
tree | f72f377b7d287d2968f3639d5e4cf97c32a3fabf /gtk | |
parent | 9917173c411c02fc2091a6ce8582a80862fd3011 (diff) | |
download | gdk-pixbuf-a5bc998bfd5361d1a105fc597d473adafebb7bde.tar.gz |
Add hints on how to handle "no window" widgets. (#136347)
2005-07-21 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkwidget.c (gtk_widget_modify_bg, gtk_widget_modify_base):
Add hints on how to handle "no window" widgets. (#136347)
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkwidget.c | 33 |
1 files changed, 32 insertions, 1 deletions
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 413b13314..e45f24add 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -2343,6 +2343,18 @@ gtk_widget_realize (GtkWidget *widget) } } +static void +check_window (gpointer window, + gpointer widget) +{ + gpointer data; + + gdk_window_get_user_data (GDK_WINDOW (window), &data); + + if (data == widget) + g_warning ("Faulty widget implementation: unrealize failed to clear window"); +} + /** * gtk_widget_unrealize: * @widget: a #GtkWidget @@ -2367,6 +2379,11 @@ gtk_widget_unrealize (GtkWidget *widget) GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED | GTK_MAPPED); g_object_unref (widget); } + +#ifdef GDK_WINDOWING_X11 + gdk_x11_display_foreach_window (gtk_widget_get_display (widget), + check_window, widget); +#endif } /***************************************** @@ -4801,7 +4818,14 @@ gtk_widget_modify_fg (GtkWidget *widget, * * Sets the background color for a widget in a particular state. All * other style values are left untouched. See also - * gtk_widget_modify_style(). + * gtk_widget_modify_style(). + * + * Note that "no window" widgets (which have the %GTK_NO_WINDOW flag set) + * draw on their parent container's window and thus may not draw any background + * themselves. This is the case for e.g. #GtkLabel. To modify the background + * of such widgets, you have to set the background color on their parent; if you want + * to set the background of a rectangular area around a label, try placing the + * label in a #GtkEventBox widget and setting the background color on that. **/ void gtk_widget_modify_bg (GtkWidget *widget, @@ -4852,6 +4876,13 @@ gtk_widget_modify_text (GtkWidget *widget, * is the background color used along with the text color * (see gtk_widget_modify_text()) for widgets such as #GtkEntry * and #GtkTextView. See also gtk_widget_modify_style(). + * + * Note that "no window" widgets (which have the %GTK_NO_WINDOW flag set) + * draw on their parent container's window and thus may not draw any background + * themselves. This is the case for e.g. #GtkLabel. To modify the background + * of such widgets, you have to set the base color on their parent; if you want + * to set the background of a rectangular area around a label, try placing the + * label in a #GtkEventBox widget and setting the base color on that. **/ void gtk_widget_modify_base (GtkWidget *widget, |