[gnome-system-monitor] Allow smooth drawing of memory and network graph to be disabled
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-system-monitor] Allow smooth drawing of memory and network graph to be disabled
- Date: Sat, 31 Oct 2020 18:40:27 +0000 (UTC)
commit 3de2c3d41e471ca5e0631dad4e55675749af0613
Author: ToMe25 <tome25 gmx de>
Date: Sat Oct 31 18:40:25 2020 +0000
Allow smooth drawing of memory and network graph to be disabled
Also reduce the rendering yOffset to 3 to prevent non smooth cpu graphs
to reach far enough up to no longer get fully rendered.
data/preferences.ui | 2 +-
src/application.cpp | 4 ++++
src/load-graph.cpp | 14 +++++++-------
src/org.gnome.gnome-system-monitor.gschema.xml.in | 4 ++--
4 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/data/preferences.ui b/data/preferences.ui
index a2676b3d..6f4b7b0b 100644
--- a/data/preferences.ui
+++ b/data/preferences.ui
@@ -399,7 +399,7 @@
</child>
<child>
<object class="GtkCheckButton" id="draw_smooth_button">
- <property name="label" translatable="yes">Draw CPU chart as s_mooth
graph</property>
+ <property name="label" translatable="yes">Draw charts as s_mooth
graphs</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
diff --git a/src/application.cpp b/src/application.cpp
index d8df911e..b08305c7 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -44,7 +44,11 @@ cb_draw_smooth_changed (Gio::Settings& settings, Glib::ustring key, GsmApplicati
{
app->config.draw_smooth = settings.get_boolean(key);
app->cpu_graph->clear_background();
+ app->mem_graph->clear_background();
+ app->net_graph->clear_background();
load_graph_reset(app->cpu_graph);
+ load_graph_reset(app->mem_graph);
+ load_graph_reset(app->net_graph);
}
static void
diff --git a/src/load-graph.cpp b/src/load-graph.cpp
index b70c7824..6656746c 100644
--- a/src/load-graph.cpp
+++ b/src/load-graph.cpp
@@ -298,11 +298,11 @@ load_graph_draw (GtkWidget *widget,
cairo_clip(cr);
bool drawStacked = graph->type == LOAD_GRAPH_CPU && GsmApplication::get()->config.draw_stacked;
- bool drawSmooth = graph->type != LOAD_GRAPH_CPU || GsmApplication::get()->config.draw_smooth;
+ bool drawSmooth = GsmApplication::get()->config.draw_smooth;
for (j = graph->n-1; j >= 0; j--) {
gdk_cairo_set_source_rgba (cr, &(graph->colors [j]));
// Start drawing on the right at the correct height.
- cairo_move_to (cr, x_offset, (1.0f - graph->data[0][j]) * graph->real_draw_height + 3.5f);
+ cairo_move_to (cr, x_offset, (1.0f - graph->data[0][j]) * graph->real_draw_height + 3);
// then draw the path of the line.
// Loop starts at 1 because the curve accesses the 0th data point.
for (i = 1; i < LoadGraph::NUM_POINTS; ++i) {
@@ -311,21 +311,21 @@ load_graph_draw (GtkWidget *widget,
if (drawSmooth) {
cairo_curve_to (cr,
x_offset - ((i - 0.5f) * graph->graph_delx),
- (1.0 - graph->data[i-1][j]) * graph->real_draw_height + 3.5,
+ (1.0 - graph->data[i-1][j]) * graph->real_draw_height + 3,
x_offset - ((i - 0.5f) * graph->graph_delx),
- (1.0 - graph->data[i][j]) * graph->real_draw_height + 3.5,
+ (1.0 - graph->data[i][j]) * graph->real_draw_height + 3,
x_offset - (i * graph->graph_delx),
- (1.0 - graph->data[i][j]) * graph->real_draw_height + 3.5);
+ (1.0 - graph->data[i][j]) * graph->real_draw_height + 3);
} else {
cairo_line_to (cr, x_offset - (i * graph->graph_delx),
- (1.0 - graph->data[i][j]) * graph->real_draw_height + 3.5);
+ (1.0 - graph->data[i][j]) * graph->real_draw_height + 3);
}
}
if (drawStacked) {
// Draw the remaining outline of the area:
// Left bottom corner
- cairo_rel_line_to (cr, 0, graph->real_draw_height + 3.5);
+ cairo_rel_line_to (cr, 0, graph->real_draw_height + 3);
// Right bottom corner. It's drawn far outside the visible area
// to avoid a weird bug where it's not filling the area it should completely.
cairo_rel_line_to (cr, x_offset * 2, 0);
diff --git a/src/org.gnome.gnome-system-monitor.gschema.xml.in
b/src/org.gnome.gnome-system-monitor.gschema.xml.in
index 1dcd152c..0c7a03d1 100644
--- a/src/org.gnome.gnome-system-monitor.gschema.xml.in
+++ b/src/org.gnome.gnome-system-monitor.gschema.xml.in
@@ -162,9 +162,9 @@
<key name="cpu-smooth-graph" type="b">
<default>true
</default>
- <summary>Show CPU chart as smooth graph using Bezier curves
+ <summary>Show CPU, Memory, and Network charts as smooth graphs using Bezier curves
</summary>
- <description>If TRUE, system-monitor shows the CPU chart as a smoothed graph, otherwise as a line
chart.
+ <description>If TRUE, system-monitor shows the CPU, Memory, and Network charts as smoothed graphs,
otherwise as line charts.
</description>
</key>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]