]> Pileus Git - ~andy/gtk/commitdiff
Add hints on how to handle "no window" widgets. (#136347)
authorMatthias Clasen <mclasen@redhat.com>
Thu, 21 Jul 2005 04:33:37 +0000 (04:33 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Thu, 21 Jul 2005 04:33:37 +0000 (04:33 +0000)
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)

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-8
gtk/gtkwidget.c

index 2ce4f300e745ecfaeaeea72468098514a90b3ea6..10c8686a8d78ae69535ef8d5fabdfc70ebfdc3c6 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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):
index 2ce4f300e745ecfaeaeea72468098514a90b3ea6..10c8686a8d78ae69535ef8d5fabdfc70ebfdc3c6 100644 (file)
@@ -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):
index 2ce4f300e745ecfaeaeea72468098514a90b3ea6..10c8686a8d78ae69535ef8d5fabdfc70ebfdc3c6 100644 (file)
@@ -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):
index 413b133142d419d716b5716cd2955d65c7393838..e45f24add446292b34eb12e503cd9c28a40e37c3 100644 (file)
@@ -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,