6bdd276d05
Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
85 lines
3.5 KiB
Diff
85 lines
3.5 KiB
Diff
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
|
|
index 02920ce..3999d7d 100644
|
|
--- a/gtk/gtkscrolledwindow.c
|
|
+++ b/gtk/gtkscrolledwindow.c
|
|
@@ -442,6 +442,13 @@ gtk_scrolled_window_class_init (GtkScrolledWindowClass *class)
|
|
GTK_PARAM_READABLE));
|
|
|
|
gtk_widget_class_install_style_property (widget_class,
|
|
+ g_param_spec_boolean ("draw-child-bg",
|
|
+ P_("Draw Child Background"),
|
|
+ P_("Fill window with child background color"),
|
|
+ FALSE,
|
|
+ GTK_PARAM_READABLE));
|
|
+
|
|
+ gtk_widget_class_install_style_property (widget_class,
|
|
g_param_spec_int ("scrollbar-spacing",
|
|
P_("Scrollbar spacing"),
|
|
P_("Number of pixels between the scrollbars and the scrolled window"),
|
|
@@ -1296,8 +1303,10 @@ gtk_scrolled_window_paint (GtkWidget *widget,
|
|
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
|
|
GdkRectangle *area = &event->area;
|
|
GtkAllocation relative_allocation;
|
|
+ gboolean draw_child_bg;
|
|
+ gtk_widget_style_get (widget, "draw-child-bg", &draw_child_bg, NULL);
|
|
|
|
- if (scrolled_window->shadow_type != GTK_SHADOW_NONE)
|
|
+ if (draw_child_bg || scrolled_window->shadow_type != GTK_SHADOW_NONE)
|
|
{
|
|
gboolean scrollbars_within_bevel;
|
|
|
|
@@ -1322,13 +1331,47 @@ gtk_scrolled_window_paint (GtkWidget *widget,
|
|
relative_allocation.height = widget->allocation.height - 2 * container->border_width;
|
|
}
|
|
|
|
- gtk_paint_shadow (widget->style, widget->window,
|
|
- GTK_STATE_NORMAL, scrolled_window->shadow_type,
|
|
- area, widget, "scrolled_window",
|
|
- widget->allocation.x + relative_allocation.x,
|
|
- widget->allocation.y + relative_allocation.y,
|
|
- relative_allocation.width,
|
|
- relative_allocation.height);
|
|
+ if (draw_child_bg)
|
|
+ {
|
|
+ GtkWidget *child = gtk_bin_get_child (GTK_BIN (widget));
|
|
+ if (child != NULL)
|
|
+ {
|
|
+ GdkColor *bgcolor = NULL;
|
|
+ if (GTK_IS_TREE_VIEW (child))
|
|
+ {
|
|
+ gtk_widget_style_get (child, "even-row-color", &bgcolor, NULL);
|
|
+ if (!bgcolor)
|
|
+ bgcolor = &child->style->base[child->state];
|
|
+ } else
|
|
+ bgcolor = &child->style->bg[child->state];
|
|
+
|
|
+ if (bgcolor)
|
|
+ {
|
|
+ cairo_t *cr = gdk_cairo_create (widget->window);
|
|
+ cairo_rectangle (cr,
|
|
+ widget->allocation.x + relative_allocation.x,
|
|
+ widget->allocation.y + relative_allocation.y,
|
|
+ relative_allocation.width,
|
|
+ relative_allocation.height);
|
|
+ cairo_clip_preserve (cr);
|
|
+ gdk_cairo_set_source_color (cr, bgcolor);
|
|
+ cairo_fill (cr);
|
|
+ cairo_destroy (cr);
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+
|
|
+ if (scrolled_window->shadow_type != GTK_SHADOW_NONE)
|
|
+ {
|
|
+
|
|
+ gtk_paint_shadow (widget->style, widget->window,
|
|
+ GTK_STATE_NORMAL, scrolled_window->shadow_type,
|
|
+ area, widget, "scrolled_window",
|
|
+ widget->allocation.x + relative_allocation.x,
|
|
+ widget->allocation.y + relative_allocation.y,
|
|
+ relative_allocation.width,
|
|
+ relative_allocation.height);
|
|
+ }
|
|
}
|
|
}
|