[gtk+/multitouch-for-3.4: 76/89] scrolledwindow: Use the child widget's window bg color for the overshoot area
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/multitouch-for-3.4: 76/89] scrolledwindow: Use the child widget's window bg color for the overshoot area
- Date: Thu, 23 Feb 2012 12:32:18 +0000 (UTC)
commit 49daf22cf1ff94bec4a4c299caf1037240946794
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Jan 12 02:53:47 2012 +0100
scrolledwindow: Use the child widget's window bg color for the overshoot area
This makes the overshoot area seamless, if the child plays along.
gtk/gtkscrolledwindow.c | 24 +++++++++++++++++++++---
1 files changed, 21 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index d0bde13..af5923c 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -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)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]