[gnome-system-monitor] load-graph.cpp: Draw the background explicitly



commit ea09aebde6f71160cb7f02280a8369b48169d9f2
Author: Søren Sandmann <ssp redhat com>
Date:   Mon Dec 16 16:10:15 2013 -0500

    load-graph.cpp: Draw the background explicitly
    
    The gdk_window_set_background_pattern() function is a little dubious
    to use unless you are writing GTK+ code since the background may be
    overridden by gtkwidget.c whenever the style of the widget changes.
    
    So instead of relying on this function, just paint the cached pattern
    on every expose.
    
    This fixes
    
         https://bugzilla.redhat.com/show_bug.cgi?id=1015507
    
    in which the background grid would disappear when the
    gnome-system-monitor window was unfocused, then focused.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=720560

 src/load-graph.cpp |   16 +++++++++-------
 1 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/src/load-graph.cpp b/src/load-graph.cpp
index 02c2535..3a072fe 100644
--- a/src/load-graph.cpp
+++ b/src/load-graph.cpp
@@ -232,13 +232,6 @@ load_graph_draw (GtkWidget *widget,
 
     window = gtk_widget_get_window (graph->disp);
 
-    if (graph->background == NULL) {
-        draw_background(graph);
-        cairo_pattern_t * pattern = cairo_pattern_create_for_surface (graph->background);
-        gdk_window_set_background_pattern (window, pattern);
-        cairo_pattern_destroy (pattern);
-    }
-
     /* Number of pixels wide for one graph point */
     sample_width = (float)(graph->draw_width - graph->rmargin - graph->indent) / 
(float)LoadGraph::NUM_POINTS;
     /* General offset */
@@ -252,6 +245,15 @@ load_graph_draw (GtkWidget *widget,
 
     cr = gdk_cairo_create (window);
 
+    if (graph->background == NULL) {
+        draw_background(graph);
+    }
+
+    cairo_pattern_t * pattern = cairo_pattern_create_for_surface (graph->background);
+    cairo_set_source (cr, pattern);
+    cairo_paint (cr);
+    cairo_pattern_destroy (pattern);
+
     cairo_set_line_width (cr, 1);
     cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
     cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);


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