[Xfce4-commits] <libxfce4ui:nick/gtk3-optional> Fix background color in gtk2 header code.
Nick Schermer
noreply at xfce.org
Thu Sep 20 19:34:01 CEST 2012
Updating branch refs/heads/nick/gtk3-optional
to f402feef9036ef353ebe336d528768999ad581bd (commit)
from 450c187bfd00a18f2686dce5a832b52a90a7815e (commit)
commit f402feef9036ef353ebe336d528768999ad581bd
Author: Nick Schermer <nick at xfce.org>
Date: Thu Sep 20 19:33:20 2012 +0200
Fix background color in gtk2 header code.
Removed a bit too much code.
libxfce4ui/xfce-heading.c | 18 ++++++++++++++++++
1 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/libxfce4ui/xfce-heading.c b/libxfce4ui/xfce-heading.c
index 83e1de7..afcfff5 100644
--- a/libxfce4ui/xfce-heading.c
+++ b/libxfce4ui/xfce-heading.c
@@ -156,20 +156,38 @@ _xfce_heading_realize (GtkWidget *widget)
attributes.y = allocation.y;
attributes.width = allocation.width;
attributes.height = allocation.height;
+#if !GTK_CHECK_VERSION (3, 0, 0)
+ attributes.colormap = gtk_widget_get_colormap (widget);
+#endif
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.window_type = GDK_WINDOW_CHILD;
attributes.visual = gtk_widget_get_visual (widget);
attributes.event_mask = gtk_widget_get_events (widget)
| GDK_EXPOSURE_MASK;
+#if GTK_CHECK_VERSION (3, 0, 0)
/* allocate the widget window */
window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL);
gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, widget);
+#else
+ /* allocate the widget window */
+ window = gdk_window_new (gtk_widget_get_parent_window (widget), &attributes,
+ GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP);
+ gtk_widget_set_window (widget, window);
+ gdk_window_set_user_data (window, widget);
+
+ /* connect the style to the window */
+ widget->style = gtk_style_attach (widget->style, widget->window);
+
+ /* set background color (using the base color) */
+ gdk_window_set_background (widget->window, &widget->style->base[GTK_STATE_NORMAL]);
+#endif
}
+
#if GTK_CHECK_VERSION (3, 0, 0)
static void
_xfce_heading_get_preferred_width (GtkWidget *widget,
More information about the Xfce4-commits
mailing list