diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | ChangeLog.pre-2-10 | 6 | ||||
-rw-r--r-- | ChangeLog.pre-2-8 | 6 | ||||
-rw-r--r-- | gtk/gtkwidget.c | 33 |
4 files changed, 50 insertions, 1 deletions
@@ -1,3 +1,9 @@ +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) + + 2005-07-20 Keith Packard <keithp@keithp.com> * gdk/x11/gdkdrawable-x11.c: (gdk_x11_ref_cairo_surface): diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 2ce4f300e7..10c8686a8d 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +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) + + 2005-07-20 Keith Packard <keithp@keithp.com> * gdk/x11/gdkdrawable-x11.c: (gdk_x11_ref_cairo_surface): diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 2ce4f300e7..10c8686a8d 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +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) + + 2005-07-20 Keith Packard <keithp@keithp.com> * gdk/x11/gdkdrawable-x11.c: (gdk_x11_ref_cairo_surface): diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index 413b133142..e45f24add4 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, |