diff --git a/SOURCES/0001-Display-more-than-64-CPUs-correctly.patch b/SOURCES/0001-Display-more-than-64-CPUs-correctly.patch new file mode 100644 index 0000000..5a6ded4 --- /dev/null +++ b/SOURCES/0001-Display-more-than-64-CPUs-correctly.patch @@ -0,0 +1,200 @@ +From 8517b0284bfed75f82e9692b8543edaf42ba8a92 Mon Sep 17 00:00:00 2001 +From: David King +Date: Wed, 18 Dec 2013 14:51:51 +0000 +Subject: [PATCH] Display more than 64 CPUs correctly + +Add a scrolled window for the GtkGrid containing the CPU color +selectors, and randomize the color for each CPU, if it is not set in the +configuration. + +Adapted from an earlier patch by Cosimo Cecchi in commit +d5e323b5e2cfd47b47809f09d7dfee307f2eb378. + +https://bugzilla.redhat.com/show_bug.cgi?id=1040501 +--- + src/interface.cpp | 12 +++++-- + src/procman-app.cpp | 2 +- + src/util.cpp | 102 +++++++++++++++++++++++++++++++++++++++++++++++++++- + src/util.h | 2 ++ + 4 files changed, 114 insertions(+), 4 deletions(-) + +diff --git a/src/interface.cpp b/src/interface.cpp +index c116cf5..720bcb2 100644 +--- a/src/interface.cpp ++++ b/src/interface.cpp +@@ -169,7 +169,7 @@ create_sys_view (ProcmanApp *app, GtkBuilder * builder) + GtkWidget *picker_alignment; + LoadGraph *cpu_graph, *mem_graph, *net_graph; + +- gint i; ++ gint i, rows_n; + gchar *title_text; + gchar *label_text; + gchar *title_template; +@@ -188,8 +188,16 @@ create_sys_view (ProcmanApp *app, GtkBuilder * builder) + TRUE, + 0); + +- GtkWidget* cpu_table = GTK_WIDGET (gtk_builder_get_object (builder, "cpu_table")); + gint cols = 4; ++ rows_n = std::max(app->config.num_cpus / cols, 1); ++ ++ GtkWidget* cpu_table = GTK_WIDGET (gtk_builder_get_object (builder, "cpu_table")); ++ if (rows_n > 2) { ++ GtkWidget *scrolled_window = gtk_scrolled_window_new(NULL, NULL); ++ gtk_widget_reparent(cpu_table, scrolled_window); ++ gtk_box_pack_end (GTK_BOX (cpu_graph_box), scrolled_window, TRUE, TRUE, 0); ++ } ++ + for (i=0;iconfig.num_cpus; i++) { + GtkWidget *temp_hbox; + +diff --git a/src/procman-app.cpp b/src/procman-app.cpp +index 6ce08b9..83f6975 100644 +--- a/src/procman-app.cpp ++++ b/src/procman-app.cpp +@@ -174,7 +174,7 @@ apply_cpu_color_settings(GSettings *settings, gpointer data) + g_variant_builder_add_value ( &builder, child); + g_variant_unref (child); + } else { +- color = g_strdup ("#f25915e815e8"); ++ color = procman::generate_random_color(); + g_variant_builder_add(&builder, "(us)", i, color); + } + gdk_rgba_parse(&app->config.cpu_color[i], color); +diff --git a/src/util.cpp b/src/util.cpp +index f06745b..2af00db 100644 +--- a/src/util.cpp ++++ b/src/util.cpp +@@ -365,7 +365,85 @@ procman_debug_real(const char *file, int line, const char *func, + g_free(msg); + } + +- ++/* taken from gtk+/gtk/gtkstyle.c */ ++static void ++hls_to_rgb (gdouble *h, ++ gdouble *l, ++ gdouble *s) ++{ ++ gdouble hue; ++ gdouble lightness; ++ gdouble saturation; ++ gdouble m1, m2; ++ gdouble r, g, b; ++ ++ lightness = *l; ++ saturation = *s; ++ ++ if (lightness <= 0.5) ++ m2 = lightness * (1 + saturation); ++ else ++ m2 = lightness + saturation - lightness * saturation; ++ m1 = 2 * lightness - m2; ++ ++ if (saturation == 0) ++ { ++ *h = lightness; ++ *l = lightness; ++ *s = lightness; ++ } ++ else ++ { ++ hue = *h + 120; ++ while (hue > 360) ++ hue -= 360; ++ while (hue < 0) ++ hue += 360; ++ ++ if (hue < 60) ++ r = m1 + (m2 - m1) * hue / 60; ++ else if (hue < 180) ++ r = m2; ++ else if (hue < 240) ++ r = m1 + (m2 - m1) * (240 - hue) / 60; ++ else ++ r = m1; ++ ++ hue = *h; ++ while (hue > 360) ++ hue -= 360; ++ while (hue < 0) ++ hue += 360; ++ ++ if (hue < 60) ++ g = m1 + (m2 - m1) * hue / 60; ++ else if (hue < 180) ++ g = m2; ++ else if (hue < 240) ++ g = m1 + (m2 - m1) * (240 - hue) / 60; ++ else ++ g = m1; ++ ++ hue = *h - 120; ++ while (hue > 360) ++ hue -= 360; ++ while (hue < 0) ++ hue += 360; ++ ++ if (hue < 60) ++ b = m1 + (m2 - m1) * hue / 60; ++ else if (hue < 180) ++ b = m2; ++ else if (hue < 240) ++ b = m1 + (m2 - m1) * (240 - hue) / 60; ++ else ++ b = m1; ++ ++ *h = r; ++ *l = g; ++ *s = b; ++ } ++} + + namespace procman + { +@@ -649,6 +727,28 @@ namespace procman + return procman::format_rate(rate, max_rate, ProcmanApp::get()->config.network_in_bits); + } + ++ ++ gchar *generate_random_color (void) ++ { ++ GdkColor color; ++ gdouble h, l, s; ++ ++ h = g_random_int_range(0, 255); ++ /* Clip luma, as we don't want colors too light (unreadable on a white ++ * bg. */ ++ l = g_random_int_range(0, 224); ++ s = g_random_int_range(0, 255); ++ ++ hls_to_rgb(&h, &l, &s); ++ ++ color.red = h * 255; ++ color.green = l * 255; ++ color.blue = s * 255; ++ ++ return gdk_color_to_string(&color); ++ } ++ ++ + } + + +diff --git a/src/util.h b/src/util.h +index f55f821..43d0001 100644 +--- a/src/util.h ++++ b/src/util.h +@@ -165,6 +165,8 @@ namespace procman + + std::string format_network(guint64 rate, guint64 max_rate = 0); + std::string format_network_rate(guint64 rate, guint64 max_rate = 0); ++ ++ gchar *generate_random_color (void); + } + + +-- +1.8.3.1 + diff --git a/SPECS/gnome-system-monitor.spec b/SPECS/gnome-system-monitor.spec index 554cd98..420cfae 100644 --- a/SPECS/gnome-system-monitor.spec +++ b/SPECS/gnome-system-monitor.spec @@ -10,12 +10,15 @@ Summary: Process and resource monitor Name: gnome-system-monitor Version: 3.8.2.1 -Release: 2%{?dist} +Release: 6%{?dist} License: GPLv2+ Group: Applications/System URL: http://www.gnome.org/ #VCS: git:git://git.gnome.org/gnome-system-monitor Source: http://download.gnome.org/sources/gnome-system-monitor/3.8/%{name}-%{version}.tar.xz +Patch0: 0001-load-graph.cpp-Draw-the-background-explicitly.patch +Patch1: translations.patch +Patch2: 0001-Display-more-than-64-CPUs-correctly.patch BuildRequires: libgtop2-devel >= %{libgtop2_version} BuildRequires: libwnck3-devel >= %{libwnck_version} @@ -31,8 +34,6 @@ BuildRequires: systemd-devel BuildRequires: librsvg2-devel BuildRequires: libxml2-devel BuildRequires: itstool -Patch0: 0001-load-graph.cpp-Draw-the-background-explicitly.patch -Patch1: translations.patch %description gnome-system-monitor allows to graphically view and manipulate the running @@ -41,8 +42,9 @@ such as CPU and memory. %prep %setup -q -%patch0 -p1 -b .background +%patch0 -p1 -b .background %patch1 -p2 -b .translations +%patch2 -p1 -b .CPUs %build %configure --enable-systemd @@ -78,6 +80,21 @@ glib-compile-schemas %{_datadir}/glib-2.0/schemas &>/dev/null || : %{_libexecdir}/gnome-system-monitor/gsm-* %changelog +* Thu Aug 21 2014 David King - 3.8.2.1-6 +- Rebuild for libgtop2 soversion change (#1040501) + +* Fri Jan 24 2014 Daniel Mach - 3.8.2.1-5 +- Mass rebuild 2014-01-24 + +* Fri Jan 03 2014 David King - 3.8.2.1-4 +- Fix compiler warning in > 64 CPUs patch (#1048289) + +* Fri Dec 27 2013 Daniel Mach - 3.8.2.1-3 +- Mass rebuild 2013-12-27 + +* Tue Dec 24 2013 David King - 3.8.2.1-2 +- Display more than 64 CPUs correctly (#1040501) + * Tue Dec 17 2013 Soren Sandmann - 3.8.2.1-2 - Translation fixes (rhbz 1030351)