scrolledwindow: Use the child widget's window bg color for the overshoot area

This makes the overshoot area seamless, if the child plays along.
This commit is contained in:
Carlos Garnacho
2012-01-12 02:53:47 +01:00
parent 0f03962185
commit 49daf22cf1

View File

@@ -1406,14 +1406,32 @@ gtk_scrolled_window_draw (GtkWidget *widget,
GtkScrolledWindow *scrolled_window = GTK_SCROLLED_WINDOW (widget);
GtkScrolledWindowPrivate *priv = scrolled_window->priv;
GtkAllocation relative_allocation;
cairo_pattern_t *pattern = NULL;
GtkStyleContext *context;
GtkWidget *child;
context = gtk_widget_get_style_context (widget);
gtk_scrolled_window_relative_allocation (widget, &relative_allocation);
gtk_render_background (context, cr,
relative_allocation.x, relative_allocation.y,
relative_allocation.width, relative_allocation.height);
/* Use child's background if possible */
child = gtk_bin_get_child (GTK_BIN (widget));
if (child && gtk_widget_get_has_window (child))
pattern = gdk_window_get_background_pattern (gtk_widget_get_window (child));
if (pattern &&
cairo_pattern_get_type (pattern) == CAIRO_PATTERN_TYPE_SOLID)
{
cairo_set_source (cr, pattern);
cairo_rectangle (cr, relative_allocation.x, relative_allocation.y,
relative_allocation.width, relative_allocation.height);
cairo_fill (cr);
}
else
gtk_render_background (context, cr,
relative_allocation.x, relative_allocation.y,
relative_allocation.width, relative_allocation.height);
if (priv->shadow_type != GTK_SHADOW_NONE)
{