[gtk+/touch-for-3.4: 12/65] scrolledwindow: Use the child widget's window bg color for the overshoot area
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/touch-for-3.4: 12/65] scrolledwindow: Use the child widget's window bg color for the overshoot area
- Date: Fri, 24 Feb 2012 15:25:51 +0000 (UTC)
commit 7f03de11ef303d0083d220eb159fa191ac156a98
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 969d527..884b80a 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1417,14 +1417,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]