[gtk+] scrolledwindow: Only render background/frame on the widget window



commit 6d5f2ff87ebdf9abcbf70c7fb26348fca2a612ae
Author: Carlos Garnacho <carlosg gnome org>
Date:   Mon Nov 17 14:47:57 2014 +0100

    scrolledwindow: Only render background/frame on the widget window
    
    Otherwise it is rendered too on each indicator window, possibly bringing
    in an unintended opaque background there. Better seen with git show -b.

 gtk/gtkscrolledwindow.c |   81 ++++++++++++++++++++++++----------------------
 1 files changed, 42 insertions(+), 39 deletions(-)
---
diff --git a/gtk/gtkscrolledwindow.c b/gtk/gtkscrolledwindow.c
index afaf69f..3d33d60 100644
--- a/gtk/gtkscrolledwindow.c
+++ b/gtk/gtkscrolledwindow.c
@@ -1832,47 +1832,50 @@ gtk_scrolled_window_draw (GtkWidget *widget,
   GtkStyleContext *context;
   gboolean scrollbars_within_bevel;
 
-  context = gtk_widget_get_style_context (widget);
-  gtk_scrolled_window_relative_allocation (widget, &relative_allocation);
+  if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
+    {
+      context = gtk_widget_get_style_context (widget);
+      gtk_scrolled_window_relative_allocation (widget, &relative_allocation);
 
-  gtk_render_background (context, cr,
-                         0, 0,
-                         gtk_widget_get_allocated_width (widget),
-                         gtk_widget_get_allocated_height (widget));
+      gtk_render_background (context, cr,
+                             0, 0,
+                             gtk_widget_get_allocated_width (widget),
+                             gtk_widget_get_allocated_height (widget));
 
-  if (priv->hscrollbar_visible &&
-      priv->vscrollbar_visible)
-    gtk_scrolled_window_draw_scrollbars_junction (scrolled_window, cr);
+      if (priv->hscrollbar_visible &&
+          priv->vscrollbar_visible)
+        gtk_scrolled_window_draw_scrollbars_junction (scrolled_window, cr);
 
-  gtk_widget_style_get (widget, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL);
+      gtk_widget_style_get (widget, "scrollbars-within-bevel", &scrollbars_within_bevel, NULL);
 
-  if (!scrollbars_within_bevel)
-    {
-      GtkStateFlags state;
-      GtkBorder padding, border;
+      if (!scrollbars_within_bevel)
+        {
+          GtkStateFlags state;
+          GtkBorder padding, border;
 
-      state = gtk_widget_get_state_flags (widget);
-      gtk_style_context_get_padding (context, state, &padding);
-      gtk_style_context_get_border (context, state, &border);
+          state = gtk_widget_get_state_flags (widget);
+          gtk_style_context_get_padding (context, state, &padding);
+          gtk_style_context_get_border (context, state, &border);
 
-      relative_allocation.x -= padding.left + border.left;
-      relative_allocation.y -= padding.top + border.top;
-      relative_allocation.width += padding.left + padding.right + border.left + border.right;
-      relative_allocation.height += padding.top + padding.bottom + border.top + border.bottom;
-    }
-  else
-    {
-      relative_allocation.x = 0;
-      relative_allocation.y = 0;
-      relative_allocation.width = gtk_widget_get_allocated_width (widget);
-      relative_allocation.height = gtk_widget_get_allocated_height (widget);
-    }
+          relative_allocation.x -= padding.left + border.left;
+          relative_allocation.y -= padding.top + border.top;
+          relative_allocation.width += padding.left + padding.right + border.left + border.right;
+          relative_allocation.height += padding.top + padding.bottom + border.top + border.bottom;
+        }
+      else
+        {
+          relative_allocation.x = 0;
+          relative_allocation.y = 0;
+          relative_allocation.width = gtk_widget_get_allocated_width (widget);
+          relative_allocation.height = gtk_widget_get_allocated_height (widget);
+        }
 
-  gtk_render_frame (context, cr,
-                    relative_allocation.x,
-                    relative_allocation.y,
-                   relative_allocation.width,
-                   relative_allocation.height);
+      gtk_render_frame (context, cr,
+                        relative_allocation.x,
+                        relative_allocation.y,
+                        relative_allocation.width,
+                        relative_allocation.height);
+    }
 
   GTK_WIDGET_CLASS (gtk_scrolled_window_parent_class)->draw (widget, cr);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]