summaryrefslogtreecommitdiff
path: root/src/load-graph.cpp
diff options
context:
space:
mode:
authorSteve Zesch <[email protected]>2012-03-17 10:52:00 -0700
committerSteve Zesch <[email protected]>2012-03-17 10:52:00 -0700
commitd8f49f31e5d2987cf494e47a16efd298eeb1e17e (patch)
tree80bf8a5c44883ef5c6b3543f0dcc6ed52b0af308 /src/load-graph.cpp
parent7d89fc8a9fbe3d16bdbb3f5eaeeb978e212c4c83 (diff)
parent7b0f14e04533ae7cdb3689862e763f90c688dccf (diff)
downloadmate-system-monitor-971afe003771ea3a4a20018f4fa8313ac2b16f39.tar.bz2
mate-system-monitor-971afe003771ea3a4a20018f4fa8313ac2b16f39.tar.xz
Merge pull request #3 from benpicco/mastermate-system-monitor-1.2.1
sync with upstream
Diffstat (limited to 'src/load-graph.cpp')
-rw-r--r--src/load-graph.cpp30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/load-graph.cpp b/src/load-graph.cpp
index 79700d4..3cf8683 100644
--- a/src/load-graph.cpp
+++ b/src/load-graph.cpp
@@ -87,7 +87,7 @@ void draw_background(LoadGraph *g) {
allocation.height,
-1);
cr = gdk_cairo_create (g->background);
-
+
// set the background colour
GtkStyle *style = gtk_widget_get_style (ProcData::get_instance()->notebook);
gdk_cairo_set_source_color (cr, &style->bg[GTK_STATE_NORMAL]);
@@ -95,13 +95,13 @@ void draw_background(LoadGraph *g) {
/* draw frame */
cairo_translate (cr, FRAME_WIDTH, FRAME_WIDTH);
-
+
/* Draw background rectangle */
cairo_set_source_rgb (cr, 1.0, 1.0, 1.0);
cairo_rectangle (cr, g->rmargin + g->indent, 0,
g->draw_width - g->rmargin - g->indent, g->real_draw_height);
cairo_fill(cr);
-
+
cairo_set_line_width (cr, 1.0);
cairo_set_dash (cr, dash, 2, 0);
cairo_set_font_size (cr, g->fontsize);
@@ -191,10 +191,6 @@ load_graph_configure (GtkWidget *widget,
g->clear_background();
- if (g->gc == NULL) {
- g->gc = gdk_gc_new (GDK_DRAWABLE (gtk_widget_get_window (widget)));
- }
-
load_graph_draw (g);
return TRUE;
@@ -212,19 +208,14 @@ load_graph_expose (GtkWidget *widget,
guint i, j;
gdouble sample_width, x_offset;
+ window = gtk_widget_get_window (g->disp);
+ gtk_widget_get_allocation (g->disp, &allocation);
+
if (g->background == NULL) {
draw_background(g);
+ gdk_window_set_back_pixmap (window, g->background, FALSE);
}
- window = gtk_widget_get_window (g->disp);
- gtk_widget_get_allocation (g->disp, &allocation);
- gdk_draw_drawable (window,
- g->gc,
- g->background,
- 0, 0, 0, 0,
- allocation.width,
- allocation.height);
-
/* Number of pixels wide for one graph point */
sample_width = (float)(g->draw_width - g->rmargin - g->indent) / (float)LoadGraph::NUM_POINTS;
/* General offset */
@@ -252,7 +243,7 @@ load_graph_expose (GtkWidget *widget,
for (i = 1; i < LoadGraph::NUM_POINTS; ++i) {
if (g->data[i][j] == -1.0f)
continue;
- cairo_curve_to (cr,
+ cairo_curve_to (cr,
x_offset - ((i - 0.5f) * g->graph_delx),
(1.0f - g->data[i-1][j]) * g->real_draw_height + 3.5f,
x_offset - ((i - 0.5f) * g->graph_delx),
@@ -619,7 +610,6 @@ LoadGraph::LoadGraph(guint type)
graph_buffer_offset(0),
main_widget(NULL),
disp(NULL),
- gc(NULL),
background(NULL),
timer_index(0),
draw(FALSE),
@@ -676,9 +666,9 @@ LoadGraph::LoadGraph(guint type)
case LOAD_GRAPH_MEM:
g->colors[0] = ProcData::get_instance()->config.mem_color;
g->colors[1] = ProcData::get_instance()->config.swap_color;
- g->mem_color_picker = gsm_color_button_new (&g->colors[0],
+ g->mem_color_picker = gsm_color_button_new (&g->colors[0],
GSMCP_TYPE_PIE);
- g->swap_color_picker = gsm_color_button_new (&g->colors[1],
+ g->swap_color_picker = gsm_color_button_new (&g->colors[1],
GSMCP_TYPE_PIE);
break;
case LOAD_GRAPH_NET: