gnome-system-monitor/more-than-4-cpus.patch
2011-03-26 18:43:17 -04:00

51 lines
1.8 KiB
Diff

From 9f6a52fa2b1a9e423808959a2ce7fea37f67656c Mon Sep 17 00:00:00 2001
From: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
Date: Fri, 25 Mar 2011 18:11:21 +0100
Subject: [PATCH] Temporary workaround for CPU with more than 4 cores
We do not provide colors after cpu-color3 in the schema
Use only the 4 colors from the scheme for now
---
src/callbacks.cpp | 2 +-
src/procman.cpp | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/callbacks.cpp b/src/callbacks.cpp
index 88d1f3d..7c7e6e3 100644
--- a/src/callbacks.cpp
+++ b/src/callbacks.cpp
@@ -235,7 +235,7 @@ cb_cpu_color_changed (GSMColorButton *cp, gpointer data)
gint i = GPOINTER_TO_INT (data);
GSettings *settings = g_settings_new (GSM_GSETTINGS_SCHEMA);
- g_snprintf(key, sizeof key, "cpu-color%d", i);
+ g_snprintf(key, sizeof key, "cpu-color%d", i%4);
change_settings_color(settings, key, cp);
}
diff --git a/src/procman.cpp b/src/procman.cpp
index 9b9292a..daebdc7 100644
--- a/src/procman.cpp
+++ b/src/procman.cpp
@@ -181,7 +181,7 @@ color_changed_cb (GSettings *settings, const gchar *key, gpointer data)
if (g_str_has_prefix (key, "cpu-color")) {
for (int i = 0; i < procdata->config.num_cpus; i++) {
- string cpu_key = make_string(g_strdup_printf("cpu-color%d", i));
+ string cpu_key = make_string(g_strdup_printf("cpu-color%d", i%4));
if (cpu_key == key) {
gdk_color_parse (color, &procdata->config.cpu_color[i]);
procdata->cpu_graph->colors.at(i) = procdata->config.cpu_color[i];
@@ -279,7 +279,7 @@ procman_data_new (GSettings *settings)
for (int i = 0; i < pd->config.num_cpus; i++) {
gchar *key;
- key = g_strdup_printf ("cpu-color%d", i);
+ key = g_strdup_printf ("cpu-color%d", i%4);
color = g_settings_get_string (settings, key);
if (!color)
--
1.7.4.1.433.gcd306.dirty