commit xfce4-cpugraph-plugin for openSUSE:Factory
Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package xfce4-cpugraph-plugin for openSUSE:Factory checked in at 2021-02-26 22:02:32 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/xfce4-cpugraph-plugin (Old) and /work/SRC/openSUSE:Factory/.xfce4-cpugraph-plugin.new.2378 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "xfce4-cpugraph-plugin" Fri Feb 26 22:02:32 2021 rev:5 rq:875511 version:1.2.3 Changes: -------- --- /work/SRC/openSUSE:Factory/xfce4-cpugraph-plugin/xfce4-cpugraph-plugin.changes 2021-02-15 23:23:08.640009103 +0100 +++ /work/SRC/openSUSE:Factory/.xfce4-cpugraph-plugin.new.2378/xfce4-cpugraph-plugin.changes 2021-02-26 22:02:58.396006403 +0100 @@ -1,0 +2,18 @@ +Wed Feb 24 18:20:06 UTC 2021 - Marcel Kuehlhorn <tux93@opensuse.org> + +- Update to version 1.2.3 + * Add support for per-core history graphs + * Enable user-defined spacing between per-core history graphs + * Use an exponential function when painting the grid + in non-linear mode + * Improve performance of current CPU usage bars + * Improve LED rendering performance + * Improve grid rendering performance + * Enumerate CPU cores from 0 (instead of 1) to match Linux + command-line tools + * Ensure that the bars and the history cannot be disabled at + the same time + * Slightly better handling of colors + * Translation Updates + +------------------------------------------------------------------- Old: ---- xfce4-cpugraph-plugin-1.2.2.tar.bz2 New: ---- xfce4-cpugraph-plugin-1.2.3.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ xfce4-cpugraph-plugin.spec ++++++ --- /var/tmp/diff_new_pack.oFjDcD/_old 2021-02-26 22:02:59.064006989 +0100 +++ /var/tmp/diff_new_pack.oFjDcD/_new 2021-02-26 22:02:59.064006989 +0100 @@ -20,7 +20,7 @@ %define plugin cpugraph %bcond_with git Name: xfce4-%{plugin}-plugin -Version: 1.2.2 +Version: 1.2.3 Release: 0 Summary: CPU Graph Plugin for the Xfce Panel License: GPL-2.0-or-later ++++++ xfce4-cpugraph-plugin-1.2.2.tar.bz2 -> xfce4-cpugraph-plugin-1.2.3.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xfce4-cpugraph-plugin-1.2.2/ChangeLog new/xfce4-cpugraph-plugin-1.2.3/ChangeLog --- old/xfce4-cpugraph-plugin-1.2.2/ChangeLog 2021-02-14 18:50:14.000000000 +0100 +++ new/xfce4-cpugraph-plugin-1.2.3/ChangeLog 2021-02-23 19:06:41.000000000 +0100 @@ -1,3 +1,142 @@ +commit 67a3ddbdd194b8483b484679974796f321a4feb8 +Author: Jan Ziak <0xe2.0x9a.0x9b@gmail.com> +Date: Tue Feb 23 18:37:22 2021 +0100 + + Add NetBeans project directory to .gitignore + +commit 775adfbaa2cfed889f69de896f47c7c3b1023a7c +Author: Jan Ziak <0xe2.0x9a.0x9b@gmail.com> +Date: Tue Feb 23 17:41:09 2021 +0100 + + Enable user-defined spacing between per-core history graphs + + The default value of the spacing is 1 pixel, maximum is 3 pixels. The + maximum spacing might need to be increased, or computed in a different way, + when 8K displays with DPI 300 become more common. The color of the spacing + is the Xfce panel background color. + + See also: https://gitlab.xfce.org/panel-plugins/xfce4-cpugraph-plugin/-/issues/15 + +commit 0da6b7b619a6be8aced7393795769aff737ed771 +Author: Jan Ziak <0xe2.0x9a.0x9b@gmail.com> +Date: Tue Feb 23 16:36:54 2021 +0100 + + Improve performance of current CPU usage bars + +commit af1beaa1999e2a382c55dcc950be7a9eace6a7db +Author: Jan Ziak <0xe2.0x9a.0x9b@gmail.com> +Date: Tue Feb 23 16:28:30 2021 +0100 + + Improve LED rendering performance + +commit b3992bb475ef7f202d1a31030777270a0b334f81 +Author: Jan Ziak <0xe2.0x9a.0x9b@gmail.com> +Date: Tue Feb 23 16:14:09 2021 +0100 + + Improve grid rendering performance + +commit f0c62e9dae9f6e70b96891dbe704ef07fa7b0a7f +Author: Jan Ziak <0xe2.0x9a.0x9b@gmail.com> +Date: Tue Feb 23 03:35:06 2021 +0100 + + Add support for per-core history graphs + + This patch enables the plugin to display the histories of all CPU cores + next to each other. + + The amount of spacing between the history graphs currently depends on + the "Show border" setting: if "Show border" is enabled then the spacing + between cores is 1 pixel, otherwise it is zero. + + For core counts higher than 4, this can make the plugin take a lot of space + in the panel (depending on the size of displayed history). + + The implementation internally stores the histories of all CPU cores + irrespective of whether "Per-core history graphs" setting is enabled or + disabled. This has almost no negative performance impact, but it can + increase the plugin's memory consumption on many-core CPUs if the history + size is large. + + Closes: https://gitlab.xfce.org/panel-plugins/xfce4-cpugraph-plugin/-/issues/15 + +commit a2a30f2b4e5d3877a3dbf42ab3ba53984e9c7c0a +Author: Jan Ziak <0xe2.0x9a.0x9b@gmail.com> +Date: Tue Feb 23 02:03:29 2021 +0100 + + Enumerate CPU cores from 0 (instead of 1) to match Linux command-line tools + +commit f0f48bf485bd0c7af1c2c34b2fb8a1bd52cd150a +Author: Jan Ziak <0xe2.0x9a.0x9b@gmail.com> +Date: Mon Feb 22 22:09:31 2021 +0100 + + Use 0 or 1 when storing single-bit boolean settings as integers + + If gboolean:1 is true, it is converted to -1 during implicit conversion to + an integer. + +commit 4b6b70a30c77b864f5f4c1eb468f395e4e5d2ad3 +Author: Jan Ziak <0xe2.0x9a.0x9b@gmail.com> +Date: Mon Feb 22 21:40:37 2021 +0100 + + Code cleanup: Use a single bit per boolean setting + + Before: 8*sizeof(gboolean) = 8*4 = 32 bytes + After: 8*(1 bit) = 1 byte + +commit 348b3ec74755810a7fcf70adba0cfefe5eba6593 +Author: Arnold Marko <arnold.marko@gmail.com> +Date: Mon Feb 22 12:50:14 2021 +0100 + + I18n: Update translation sl (100%). + + 54 translated messages. + + Transifex (https://www.transifex.com/xfce/public/). + +commit 5df798492a46ba9495b55584efadcd5e89d7d76b +Author: Yannick Le Guen <leguen.yannick@gmail.com> +Date: Fri Feb 19 00:47:57 2021 +0100 + + I18n: Update translation fr (100%). + + 54 translated messages. + + Transifex (https://www.transifex.com/xfce/public/). + +commit 21c67ad20a2b81c7f1952bb46be9f62d8384a875 +Author: Jan Ziak <0xe2.0x9a.0x9b@gmail.com> +Date: Sun Feb 14 21:59:33 2021 +0100 + + Ensure that the bars and the history cannot be disabled at the same time + +commit e818c260e6e91fc86cdb34ce886b98904d46dd4a +Author: Jan Ziak <0xe2.0x9a.0x9b@gmail.com> +Date: Sun Feb 14 21:13:24 2021 +0100 + + Slightly better handling of colors + + This patch removes obsoleted code, improves responsiveness to color + changes, and avoids calls to Cairo if the background color is fully + transparent. + +commit 9faa15d8ca4849e6e995b58c45b92a18344ad85d +Author: Jan Ziak <0xe2.0x9a.0x9b@gmail.com> +Date: Sun Feb 14 20:46:59 2021 +0100 + + Use an exponential function when painting the grid in non-linear mode + +commit 01331d163d770f753167e7fe41b9688477b913a4 +Author: Jan Ziak <0xe2.0x9a.0x9b@gmail.com> +Date: Sun Feb 14 18:57:54 2021 +0100 + + Back to development + +commit 0bbc430356313d0e627b3127f77b1d2b25ae595b +Author: Jan Ziak <0xe2.0x9a.0x9b@gmail.com> +Date: Sun Feb 14 18:50:26 2021 +0100 + + Updates for release + commit ff5c8db0b3f095f18c5a40f781f0947bea4f72c6 Author: Jan Ziak <0xe2.0x9a.0x9b@gmail.com> Date: Sun Feb 14 18:25:59 2021 +0100 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xfce4-cpugraph-plugin-1.2.2/NEWS new/xfce4-cpugraph-plugin-1.2.3/NEWS --- old/xfce4-cpugraph-plugin-1.2.2/NEWS 2021-02-14 18:50:05.000000000 +0100 +++ new/xfce4-cpugraph-plugin-1.2.3/NEWS 2021-02-23 19:06:35.000000000 +0100 @@ -1,3 +1,19 @@ +1.2.3 (2021-02-23) +===== +- Add support for per-core history graphs +- Enable user-defined spacing between per-core history graphs +- Use an exponential function when painting the grid in non-linear mode +- Improve performance of current CPU usage bars +- Improve LED rendering performance +- Improve grid rendering performance +- Enumerate CPU cores from 0 (instead of 1) to match Linux command-line + tools +- Ensure that the bars and the history cannot be disabled at the same + time +- Slightly better handling of colors +- Translation Updates: + French, Slovenian + 1.2.2 (2021-02-14) ===== - Record CPU load data even if the chart is currently disabled diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xfce4-cpugraph-plugin-1.2.2/configure new/xfce4-cpugraph-plugin-1.2.3/configure --- old/xfce4-cpugraph-plugin-1.2.2/configure 2021-02-14 18:50:12.000000000 +0100 +++ new/xfce4-cpugraph-plugin-1.2.3/configure 2021-02-23 19:06:40.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for xfce4-cpugraph-plugin 1.2.2. +# Generated by GNU Autoconf 2.69 for xfce4-cpugraph-plugin 1.2.3. # # Report bugs to <https://gitlab.xfce.org/panel-plugins/xfce4-cpugraph-plugin/>. # @@ -591,8 +591,8 @@ # Identity of this package. PACKAGE_NAME='xfce4-cpugraph-plugin' PACKAGE_TARNAME='xfce4-cpugraph-plugin' -PACKAGE_VERSION='1.2.2' -PACKAGE_STRING='xfce4-cpugraph-plugin 1.2.2' +PACKAGE_VERSION='1.2.3' +PACKAGE_STRING='xfce4-cpugraph-plugin 1.2.3' PACKAGE_BUGREPORT='https://gitlab.xfce.org/panel-plugins/xfce4-cpugraph-plugin/' PACKAGE_URL='' @@ -1399,7 +1399,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures xfce4-cpugraph-plugin 1.2.2 to adapt to many kinds of systems. +\`configure' configures xfce4-cpugraph-plugin 1.2.3 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1471,7 +1471,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of xfce4-cpugraph-plugin 1.2.2:";; + short | recursive ) echo "Configuration of xfce4-cpugraph-plugin 1.2.3:";; esac cat <<\_ACEOF @@ -1596,7 +1596,7 @@ test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -xfce4-cpugraph-plugin configure 1.2.2 +xfce4-cpugraph-plugin configure 1.2.3 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -1965,7 +1965,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by xfce4-cpugraph-plugin $as_me 1.2.2, which was +It was created by xfce4-cpugraph-plugin $as_me 1.2.3, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2830,7 +2830,7 @@ # Define the identity of the package. PACKAGE='xfce4-cpugraph-plugin' - VERSION='1.2.2' + VERSION='1.2.3' cat >>confdefs.h <<_ACEOF @@ -15115,7 +15115,7 @@ # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by xfce4-cpugraph-plugin $as_me 1.2.2, which was +This file was extended by xfce4-cpugraph-plugin $as_me 1.2.3, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15181,7 +15181,7 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -xfce4-cpugraph-plugin config.status 1.2.2 +xfce4-cpugraph-plugin config.status 1.2.3 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xfce4-cpugraph-plugin-1.2.2/configure.ac new/xfce4-cpugraph-plugin-1.2.3/configure.ac --- old/xfce4-cpugraph-plugin-1.2.2/configure.ac 2021-02-14 18:50:09.000000000 +0100 +++ new/xfce4-cpugraph-plugin-1.2.3/configure.ac 2021-02-23 19:06:38.000000000 +0100 @@ -14,8 +14,8 @@ AC_CONFIG_MACRO_DIRS([m4]) m4_define([cpugraph_version_major], [1]) m4_define([cpugraph_version_minor], [2]) -m4_define([cpugraph_version_micro], [2]) -m4_define([cpugraph_version_build], [ff5c8db]) +m4_define([cpugraph_version_micro], [3]) +m4_define([cpugraph_version_build], [67a3ddb]) m4_define([cpugraph_version_tag], []) m4_define([cpugraph_version], [cpugraph_version_major().cpugraph_version_minor().cpugraph_version_micro()ifelse(cpugraph_version_tag(), [git], [cpugraph_version_tag()-cpugraph_version_build()], [cpugraph_version_tag()])]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xfce4-cpugraph-plugin-1.2.2/panel-plugin/cpu.c new/xfce4-cpugraph-plugin-1.2.3/panel-plugin/cpu.c --- old/xfce4-cpugraph-plugin-1.2.2/panel-plugin/cpu.c 2021-02-14 18:45:27.000000000 +0100 +++ new/xfce4-cpugraph-plugin-1.2.3/panel-plugin/cpu.c 2021-02-23 18:36:00.000000000 +0100 @@ -134,6 +134,7 @@ base->has_barcolor = FALSE; base->bars.orientation = orientation; base->highlight_smt = HIGHLIGHT_SMT_BY_DEFAULT; + base->per_core_spacing = PER_CORE_SPACING_DEFAULT; mode_cb (plugin, (XfcePanelPluginMode) orientation, base); gtk_widget_show_all (ebox); @@ -218,12 +219,27 @@ gtk_widget_destroy (base->tooltip_text); if (base->timeout_id) g_source_remove (base->timeout_id); - g_free (base->history.data); + if (base->history.data) + { + guint core; + for (core = 0; core < base->nr_cores+1; core++) + g_free (base->history.data[core]); + g_free (base->history.data); + } g_free (base->command); g_free (base); } static void +queue_draw (CPUGraph *base) +{ + if (base->mode != MODE_DISABLED) + gtk_widget_queue_draw (base->draw_area); + if (base->bars.draw_area) + gtk_widget_queue_draw (base->bars.draw_area); +} + +static void delete_bars (CPUGraph *base) { if (base->bars.frame) @@ -235,23 +251,12 @@ } static void -clear_history (CPUGraph *base) -{ - gssize i; - for (i = 0; i < base->history.cap_pow2; i++) - base->history.data[i] = (CpuLoad) {}; - - if (base->mode != MODE_DISABLED) - gtk_widget_queue_draw (base->draw_area); -} - -static void resize_history (CPUGraph *base, gssize history_size) { const guint fastest = get_update_interval_ms (RATE_FASTEST); const guint slowest = get_update_interval_ms (RATE_SLOWEST); gssize cap_pow2, old_cap_pow2, old_mask, old_offset; - CpuLoad *old_data; + CpuLoad **old_data; old_cap_pow2 = base->history.cap_pow2; old_data = base->history.data; @@ -266,41 +271,58 @@ if (cap_pow2 != old_cap_pow2) { + guint core; gssize i; base->history.cap_pow2 = cap_pow2; - base->history.data = (CpuLoad*) g_malloc0 (cap_pow2 * sizeof (CpuLoad)); + base->history.data = (CpuLoad**) g_malloc0 ((base->nr_cores + 1) * sizeof (CpuLoad*)); + for (core = 0; core < base->nr_cores + 1; core++) + base->history.data[core] = (CpuLoad*) g_malloc0 (cap_pow2 * sizeof (CpuLoad)); base->history.mask = cap_pow2 - 1; base->history.offset = 0; if (old_data != NULL) - for (i = 0; i < old_cap_pow2 && i < cap_pow2; i++) - base->history.data[i] = old_data[(old_offset + i) & old_mask]; - g_free (old_data); + { + for (core = 0; core < base->nr_cores+1; core++) + { + for (i = 0; i < old_cap_pow2 && i < cap_pow2; i++) + base->history.data[core][i] = old_data[core][(old_offset + i) & old_mask]; + g_free (old_data[core]); + } + g_free (old_data); + } } base->history.size = history_size; } static gboolean -size_cb (XfcePanelPlugin *plugin, guint size, CPUGraph *base) +size_cb (XfcePanelPlugin *plugin, guint plugin_size, CPUGraph *base) { - gint frame_h, frame_v; + gint frame_h, frame_v, size; gssize history; GtkOrientation orientation; - gint shadow_width = base->has_frame ? 2*1 : 0; + guint border_width; + const gint shadow_width = base->has_frame ? 2*1 : 0; + + size = base->size; + if (base->per_core && base->nr_cores >= 2) + { + size *= base->nr_cores; + size += (base->nr_cores - 1) * base->per_core_spacing; + } orientation = xfce_panel_plugin_get_orientation (plugin); if (orientation == GTK_ORIENTATION_HORIZONTAL) { - frame_h = base->size + shadow_width; - frame_v = size; + frame_h = size + shadow_width; + frame_v = plugin_size; history = base->size; } else { - frame_h = size; - frame_v = base->size + shadow_width; - history = size; + frame_h = plugin_size; + frame_v = size + shadow_width; + history = plugin_size; } /* Expand history size for the non-linear time-scale mode. @@ -321,6 +343,13 @@ base->bars.orientation = orientation; set_bars_size (base); } + + if (base->has_border) + border_width = (xfce_panel_plugin_get_size (base->plugin) > 26 ? 2 : 1); + else + border_width = 0; + gtk_container_set_border_width (GTK_CONTAINER (base->box), border_width); + set_border (base, base->has_border); return TRUE; @@ -580,29 +609,25 @@ detect_smt_issues (base); - if (base->tracked_core > base->nr_cores) - base->cpu_data[0].load = 0; - else if (base->tracked_core != 0 && G_LIKELY (base->tracked_core < base->nr_cores + 1)) - base->cpu_data[0].load = base->cpu_data[base->tracked_core].load; - if (base->history.data != NULL) { - CpuLoad load; + const gint64 timestamp = g_get_real_time (); + guint core; - /* Prepend a datapoint to the history */ + /* Prepend the current CPU load to the history */ base->history.offset = (base->history.offset - 1) & base->history.mask; - load.timestamp = g_get_real_time (); - load.value = base->cpu_data[0].load; - base->history.data[base->history.offset] = load; + for (core = 0; core < base->nr_cores+1; core++) + { + CpuLoad load; + load.timestamp = timestamp; + load.value = base->cpu_data[core].load; + base->history.data[core][base->history.offset] = load; + } } + queue_draw (base); update_tooltip (base); - if (base->mode != MODE_DISABLED) - gtk_widget_queue_draw (base->draw_area); - if (base->bars.draw_area) - gtk_widget_queue_draw (base->bars.draw_area); - return TRUE; } @@ -628,32 +653,89 @@ CPUGraph *base = (CPUGraph *) data; GtkAllocation alloc; gint w, h; + void (*draw) (CPUGraph *base, cairo_t *cr, gint w, gint h, guint core) = NULL; gtk_widget_get_allocation (base->draw_area, &alloc); w = alloc.width; h = alloc.height; - gdk_cairo_set_source_rgba (cr, &base->colors[BG_COLOR]); - cairo_rectangle (cr, 0, 0, w, h); - cairo_fill (cr); - switch (base->mode) { case MODE_DISABLED: break; case MODE_NORMAL: - draw_graph_normal (base, cr, w, h); + draw = draw_graph_normal; break; case MODE_LED: - draw_graph_LED (base, cr, w, h); + draw = draw_graph_LED; break; case MODE_NO_HISTORY: - draw_graph_no_history (base, cr, w, h); + draw = draw_graph_no_history; break; case MODE_GRID: - draw_graph_grid (base, cr, w, h); + draw = draw_graph_grid; break; } + + if (draw) + { + if (!base->per_core || base->nr_cores == 1) + { + guint core; + + if (base->colors[BG_COLOR].alpha != 0) + { + gdk_cairo_set_source_rgba (cr, &base->colors[BG_COLOR]); + cairo_rectangle (cr, 0, 0, w, h); + cairo_fill (cr); + } + + core = base->tracked_core; + if (G_UNLIKELY (core > base->nr_cores+1)) + core = 0; + draw (base, cr, w, h, core); + } + else + { + guint core; + gboolean horizontal; + gint w1, h1; + + horizontal = (xfce_panel_plugin_get_orientation (base->plugin) == GTK_ORIENTATION_HORIZONTAL); + if (horizontal) + { + w1 = base->size; + h1 = h; + } + else + { + w1 = w; + h1 = base->size; + } + + for (core = 0; core < base->nr_cores; core++) + { + cairo_save (cr); + { + cairo_rectangle_t translation = {}; + *(horizontal ? &translation.x : &translation.y) = core * (base->size + base->per_core_spacing); + cairo_translate (cr, translation.x, translation.y); + + if (base->colors[BG_COLOR].alpha != 0) + { + gdk_cairo_set_source_rgba (cr, &base->colors[BG_COLOR]); + cairo_rectangle (cr, 0, 0, w1, h1); + cairo_fill (cr); + } + + cairo_rectangle (cr, 0, 0, w1, h1); + cairo_clip (cr); + draw (base, cr, w1, h1, core+1); + } + cairo_restore (cr); + } + } + } } static void @@ -666,9 +748,12 @@ gtk_widget_get_allocation (base->bars.draw_area, &alloc); - gdk_cairo_set_source_rgba (cr, &base->colors[BG_COLOR]); - cairo_rectangle (cr, 0, 0, alloc.width, alloc.height); - cairo_fill (cr); + if (base->colors[BG_COLOR].alpha != 0) + { + gdk_cairo_set_source_rgba (cr, &base->colors[BG_COLOR]); + cairo_rectangle (cr, 0, 0, alloc.width, alloc.height); + cairo_fill (cr); + } size = (horizontal ? alloc.height : alloc.width); if (base->tracked_core != 0 || base->nr_cores == 1) @@ -687,9 +772,12 @@ } else { + const GdkRGBA *active_color = NULL; + gboolean fill = FALSE; guint i; for (i = 0; i < base->nr_cores; i++) { + const GdkRGBA *color; const gboolean highlight = base->highlight_smt && base->cpu_data[i+1].smt_highlight; gfloat usage; @@ -699,14 +787,26 @@ usage *= size; /* Suboptimally placed threads on SMT CPUs are optionally painted using a different color. */ - gdk_cairo_set_source_rgba (cr, &base->colors[highlight ? SMT_ISSUES_COLOR : BARS_COLOR]); + color = &base->colors[highlight ? SMT_ISSUES_COLOR : BARS_COLOR]; + if (active_color != color) + { + if (fill) + { + cairo_fill (cr); + fill = FALSE; + } + gdk_cairo_set_source_rgba (cr, color); + active_color = color; + } if (horizontal) cairo_rectangle (cr, 6*i, size-usage, 4, usage); else cairo_rectangle (cr, 0, 6*i, usage, 4); - cairo_fill (cr); + fill = TRUE; } + if (fill) + cairo_fill (cr); } } @@ -750,8 +850,8 @@ if (base->command) { command = base->command; - in_terminal = base->in_terminal; - startup_notification = base->startup_notification; + in_terminal = base->command_in_terminal; + startup_notification = base->command_startup_notification; } else { @@ -793,13 +893,13 @@ void set_startup_notification (CPUGraph *base, gboolean startup_notification) { - base->startup_notification = startup_notification; + base->command_startup_notification = startup_notification; } void set_in_terminal (CPUGraph *base, gboolean in_terminal) { - base->in_terminal = in_terminal; + base->command_in_terminal = in_terminal; } void @@ -834,11 +934,11 @@ void set_border (CPUGraph *base, gboolean border) { - int border_width = (xfce_panel_plugin_get_size (base->plugin) > 26 ? 2 : 1); - base->has_border = border; - if (!base->has_border) - border_width = 0; - gtk_container_set_border_width (GTK_CONTAINER (base->box), border_width); + if (base->has_border != border) + { + base->has_border = border; + size_cb (base->plugin, xfce_panel_plugin_get_size (base->plugin), base); + } } void @@ -857,8 +957,32 @@ if (base->non_linear != nonlinear) { base->non_linear = nonlinear; - if (base->mode != MODE_DISABLED) - gtk_widget_queue_draw (base->draw_area); + queue_draw (base); + } +} + +void +set_per_core (CPUGraph *base, gboolean per_core) +{ + if (base->per_core != per_core) + { + base->per_core = per_core; + size_cb (base->plugin, xfce_panel_plugin_get_size (base->plugin), base); + } +} + +void +set_per_core_spacing (CPUGraph *base, guint spacing) +{ + if (G_UNLIKELY (spacing < PER_CORE_SPACING_MIN)) + spacing = PER_CORE_SPACING_MIN; + if (G_UNLIKELY (spacing > PER_CORE_SPACING_MAX)) + spacing = PER_CORE_SPACING_MAX; + + if (base->per_core_spacing != spacing) + { + base->per_core_spacing = spacing; + size_cb (base->plugin, xfce_panel_plugin_get_size (base->plugin), base); } } @@ -884,8 +1008,7 @@ base->timeout_id = g_timeout_add (interval, update_cb, base); if (change && !init) - if (base->mode != MODE_DISABLED) - gtk_widget_queue_draw (base->draw_area); + queue_draw (base); } } @@ -904,7 +1027,11 @@ void set_color_mode (CPUGraph *base, guint color_mode) { - base->color_mode = color_mode; + if (base->color_mode != color_mode) + { + base->color_mode = color_mode; + queue_draw (base); + } } void @@ -926,20 +1053,19 @@ void set_color (CPUGraph *base, guint number, GdkRGBA color) { - base->colors[number] = color; - - if (number == BG_COLOR) + if (!gdk_rgba_equal (&base->colors[number], &color)) { -G_GNUC_BEGIN_IGNORE_DEPRECATIONS - gtk_widget_override_background_color (base->draw_area, GTK_STATE_FLAG_INSENSITIVE, &base->colors[BG_COLOR]); - gtk_widget_override_background_color (base->draw_area, GTK_STATE_FLAG_NORMAL, &base->colors[BG_COLOR]); -G_GNUC_END_IGNORE_DEPRECATIONS + base->colors[number] = color; + queue_draw (base); } } void set_tracked_core (CPUGraph *base, guint core) { + if (G_UNLIKELY (core > base->nr_cores+1)) + core = 0; + if (base->tracked_core != core) { gboolean has_bars = base->has_bars; @@ -948,8 +1074,6 @@ base->tracked_core = core; if (has_bars) set_bars (base, TRUE); - - clear_history (base); } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xfce4-cpugraph-plugin-1.2.2/panel-plugin/cpu.h new/xfce4-cpugraph-plugin-1.2.3/panel-plugin/cpu.h --- old/xfce4-cpugraph-plugin-1.2.2/panel-plugin/cpu.h 2021-02-14 18:45:27.000000000 +0100 +++ new/xfce4-cpugraph-plugin-1.2.3/panel-plugin/cpu.h 2021-02-23 18:36:00.000000000 +0100 @@ -39,6 +39,9 @@ #define MAX_SIZE 128 #define MIN_SIZE 10 #define NONLINEAR_MODE_BASE 1.04 +#define PER_CORE_SPACING_DEFAULT 1 +#define PER_CORE_SPACING_MAX 3 +#define PER_CORE_SPACING_MIN 0 typedef enum { @@ -95,21 +98,25 @@ /* Settings */ CPUGraphUpdateRate update_interval; - gboolean non_linear; guint size; CPUGraphMode mode; guint color_mode; - gboolean has_frame; - gboolean has_border; - gboolean has_bars; - gboolean has_barcolor; - gboolean highlight_smt; gchar *command; - gboolean in_terminal; - gboolean startup_notification; GdkRGBA colors[NUM_COLORS]; - guint tracked_core; + guint tracked_core; /* 0 means "all CPU cores", an x >= 1 means "CPU core x-1" */ gfloat load_threshold; /* Range: from 0.0 to MAX_LOAD_THRESHOLD */ + guint per_core_spacing; + + /* Boolean settings */ + gboolean command_in_terminal:1; + gboolean command_startup_notification:1; + gboolean has_barcolor:1; + gboolean has_bars:1; + gboolean has_border:1; + gboolean has_frame:1; + gboolean highlight_smt:1; + gboolean non_linear:1; + gboolean per_core:1; /* Runtime data */ guint nr_cores; @@ -119,7 +126,7 @@ gssize size; /* size <= cap_pow2 */ gssize mask; /* Equals to (cap_pow2 - 1) */ gssize offset; /* Circular buffer position. Range: from 0 to (cap_pow2 - 1) */ - CpuLoad *data; /* Circular buffer */ + CpuLoad **data; /* Circular buffers */ } history; CpuData *cpu_data; Topology *topology; @@ -137,6 +144,8 @@ void set_load_threshold (CPUGraph *base, gfloat threshold); void set_mode (CPUGraph *base, CPUGraphMode mode); void set_nonlinear_time (CPUGraph *base, gboolean nonlinear); +void set_per_core (CPUGraph *base, gboolean per_core); +void set_per_core_spacing (CPUGraph *base, guint spacing); void set_size (CPUGraph *base, guint width); void set_smt (CPUGraph * base, gboolean highlight_smt); void set_startup_notification (CPUGraph *base, gboolean startup_notification); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xfce4-cpugraph-plugin-1.2.2/panel-plugin/mode.c new/xfce4-cpugraph-plugin-1.2.3/panel-plugin/mode.c --- old/xfce4-cpugraph-plugin-1.2.2/panel-plugin/mode.c 2021-02-14 18:45:27.000000000 +0100 +++ new/xfce4-cpugraph-plugin-1.2.3/panel-plugin/mode.c 2021-02-23 18:36:00.000000000 +0100 @@ -60,10 +60,10 @@ * The timestampts range from 'timestamp' to timestamp+step*(count-1). */ static void -nearest_loads (const CPUGraph *base, gint64 start, gint64 step, gssize count, gfloat *out) +nearest_loads (const CPUGraph *base, guint core, gint64 start, gint64 step, gssize count, gfloat *out) { const gssize history_cap_pow2 = base->history.cap_pow2; - const CpuLoad *history_data = base->history.data; + const CpuLoad *history_data = base->history.data[core]; const gssize history_mask = base->history.mask; const gssize history_offset = base->history.offset; @@ -175,7 +175,7 @@ } void -draw_graph_normal (CPUGraph *base, cairo_t *cr, gint w, gint h) +draw_graph_normal (CPUGraph *base, cairo_t *cr, gint w, gint h, guint core) { gint x, y; gint tmp; @@ -189,8 +189,8 @@ if (base->color_mode == 0) gdk_cairo_set_source_rgba (cr, &base->colors[FG_COLOR1]); - t0 = base->history.data[base->history.offset].timestamp; - nearest_loads (base, t0, -step, w, nearest); + t0 = base->history.data[core][base->history.offset].timestamp; + nearest_loads (base, core, t0, -step, w, nearest); for (x = 0; x < w; x++) { @@ -227,11 +227,12 @@ } void -draw_graph_LED (CPUGraph *base, cairo_t *cr, gint w, gint h) +draw_graph_LED (CPUGraph *base, cairo_t *cr, gint w, gint h, guint core) { const gint nrx = (w + 2) / 3; const gint nry = (h + 1) / 2; gint x, y; + const GdkRGBA *active_color = NULL; const gint64 step = 1000 * (gint64) get_update_interval_ms (base->update_interval); gint64 t0; gfloat nearest[nrx]; @@ -239,8 +240,8 @@ if (G_UNLIKELY (base->history.data == NULL)) return; - t0 = base->history.data[base->history.offset].timestamp; - nearest_loads (base, t0, -step, nrx, nearest); + t0 = base->history.data[core][base->history.offset].timestamp; + nearest_loads (base, core, t0, -step, nrx, nearest); for (x = 0; x * 3 < w; x++) { @@ -263,10 +264,16 @@ { gfloat t = y / (gfloat) (base->color_mode == 1 ? nry : limit); mix_colors (t, &base->colors[FG_COLOR3], &base->colors[FG_COLOR2], cr); + active_color = NULL; } else { - gdk_cairo_set_source_rgba (cr, y >= limit ? &base->colors[FG_COLOR1] : &base->colors[FG_COLOR2]); + const GdkRGBA *color = (y >= limit ? &base->colors[FG_COLOR1] : &base->colors[FG_COLOR2]); + if (active_color != color) + { + gdk_cairo_set_source_rgba (cr, color); + active_color = color; + } } /* draw rectangle */ @@ -277,14 +284,14 @@ } void -draw_graph_no_history (CPUGraph *base, cairo_t *cr, gint w, gint h) +draw_graph_no_history (CPUGraph *base, cairo_t *cr, gint w, gint h, guint core) { gfloat usage; if (G_UNLIKELY (base->history.data == NULL)) return; - usage = base->history.data[base->history.offset].value; + usage = base->history.data[core][base->history.offset].value; if (usage < base->load_threshold) usage = 0; @@ -314,11 +321,9 @@ } void -draw_graph_grid (CPUGraph *base, cairo_t *cr, gint w, gint h) +draw_graph_grid (CPUGraph *base, cairo_t *cr, gint w, gint h, guint core) { const gfloat thickness = 1.75f; - gint x, y; - point last; const gint64 step = 1000 * (gint64) get_update_interval_ms (base->update_interval); gint64 t0; gfloat nearest[w]; @@ -326,54 +331,72 @@ if (G_UNLIKELY (base->history.data == NULL)) return; - t0 = base->history.data[base->history.offset].timestamp; - nearest_loads (base, t0, -step, w, nearest); + t0 = base->history.data[core][base->history.offset].timestamp; + nearest_loads (base, core, t0, -step, w, nearest); - gdk_cairo_set_source_rgba (cr, &base->colors[FG_COLOR1]); cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE); - cairo_set_line_width (cr, 1); - for (x = 0; x < w; x += 6) - { - /* draw vertical line */ - cairo_move_to (cr, x + 0.5, 0.5); - cairo_line_to (cr, x + 0.5, h - 1 + 0.5); - cairo_stroke (cr); - } + /* Paint the grid using a single call to cairo_stroke() */ + if (G_LIKELY (base->colors[FG_COLOR1].alpha != 0.0)) { + gint x, y; - for (y = 0; y < h; y += 4) - { - /* draw horizontal line */ - cairo_move_to (cr, 0.5, y + 0.5); - cairo_line_to (cr, w - 1 + 0.5, y + 0.5); + cairo_save (cr); + cairo_set_line_width (cr, 1); + gdk_cairo_set_source_rgba (cr, &base->colors[FG_COLOR1]); + for (x = 0; x < w; x += 6) + { + gint x1 = x; + + if (base->non_linear) + { + x1 *= pow (1.02, x1); + if (x1 >= w) + break; + } + + /* draw vertical line */ + cairo_move_to (cr, w - 1 - x1 + 0.5, 0.5); + cairo_line_to (cr, w - 1 - x1 + 0.5, h - 1 + 0.5); + } + for (y = 0; y < h; y += 4) + { + /* draw horizontal line */ + cairo_move_to (cr, 0.5, h - 1 - y + 0.5); + cairo_line_to (cr, w - 1 + 0.5, h - 1 - y + 0.5); + } cairo_stroke (cr); + cairo_restore (cr); } - gdk_cairo_set_source_rgba (cr, &base->colors[2]); + /* Paint a line on top of the grid, using a single call to cairo_stroke() */ + if (G_LIKELY (base->colors[2].alpha != 0.0)) { + point last = {}; + gint x; + + cairo_save (cr); + cairo_set_line_width (cr, thickness); + gdk_cairo_set_source_rgba (cr, &base->colors[2]); + for (x = 0; x < w; x++) + { + gfloat load, usage; + point current; - cairo_save (cr); - cairo_set_line_width (cr, thickness); - last = (point) {}; - for (x = 0; x < w; x++) - { - gfloat load, usage; - point current; + load = nearest[w - 1 - x]; + if (load < base->load_threshold) + load = 0; + usage = h * load; - load = nearest[w - 1 - x]; - if (load < base->load_threshold) - load = 0; - usage = h * load; + current.x = x; + current.y = h + (thickness-1)/2 - usage; + if (x == 0) + last = current; - current.x = x; - current.y = h + (thickness-1)/2 - usage; - if (x == 0) + /* draw line */ + cairo_move_to (cr, last.x + 0.5, last.y + 0.5); + cairo_line_to (cr, current.x + 0.5, current.y + 0.5); last = current; - - /* draw line */ - cairo_move_to (cr, last.x + 0.5, last.y + 0.5); - cairo_line_to (cr, current.x + 0.5, current.y + 0.5); + } cairo_stroke (cr); - last = current; + cairo_restore (cr); } - cairo_restore (cr); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xfce4-cpugraph-plugin-1.2.2/panel-plugin/mode.h new/xfce4-cpugraph-plugin-1.2.3/panel-plugin/mode.h --- old/xfce4-cpugraph-plugin-1.2.2/panel-plugin/mode.h 2021-02-14 18:45:27.000000000 +0100 +++ new/xfce4-cpugraph-plugin-1.2.3/panel-plugin/mode.h 2021-02-23 18:36:00.000000000 +0100 @@ -26,9 +26,9 @@ #include "cpu.h" -void draw_graph_normal (CPUGraph *base, cairo_t *cr, gint w, gint h); -void draw_graph_LED (CPUGraph *base, cairo_t *cr, gint w, gint h); -void draw_graph_no_history (CPUGraph *base, cairo_t *cr, gint w, gint h); -void draw_graph_grid (CPUGraph *base, cairo_t *cr, gint w, gint h); +void draw_graph_normal (CPUGraph *base, cairo_t *cr, gint w, gint h, guint core); +void draw_graph_LED (CPUGraph *base, cairo_t *cr, gint w, gint h, guint core); +void draw_graph_no_history (CPUGraph *base, cairo_t *cr, gint w, gint h, guint core); +void draw_graph_grid (CPUGraph *base, cairo_t *cr, gint w, gint h, guint core); #endif /* !_XFCE_MODE_H_ */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xfce4-cpugraph-plugin-1.2.2/panel-plugin/properties.c new/xfce4-cpugraph-plugin-1.2.3/panel-plugin/properties.c --- old/xfce4-cpugraph-plugin-1.2.2/panel-plugin/properties.c 2021-02-14 18:45:27.000000000 +0100 +++ new/xfce4-cpugraph-plugin-1.2.3/panel-plugin/properties.c 2021-02-23 18:36:00.000000000 +0100 @@ -36,13 +36,17 @@ typedef struct { - CPUGraph *base; - GtkWidget *color_buttons[NUM_COLORS]; - GtkWidget *color_mode_combobox; - GtkBox *hbox_highlight_smt, *hbox_in_terminal, *hbox_startup_notification; - GtkLabel *smt_stats; - gchar *smt_stats_tooltip; - guint timeout_id; + CPUGraph *base; + GtkWidget *color_buttons[NUM_COLORS]; + GtkWidget *color_mode_combobox; + GtkBox *hbox_highlight_smt; + GtkBox *hbox_in_terminal; + GtkBox *hbox_per_core_spacing; + GtkBox *hbox_startup_notification; + GtkToggleButton *per_core, *show_bars_checkbox; + GtkLabel *smt_stats; + gchar *smt_stats_tooltip; + guint timeout_id; } CPUGraphOptions; static GtkBox *create_tab (void); @@ -57,7 +61,8 @@ const gchar *name, gboolean init, void (callback)(GtkToggleButton*, CPUGraphOptions*), - CPUGraphOptions *cb_data); + CPUGraphOptions *cb_data, + GtkToggleButton **out_checkbox); static GtkWidget* create_drop_down (GtkBox *tab, GtkSizeGroup *sg, const gchar *name, @@ -98,6 +103,9 @@ static void setup_load_threshold_option (GtkBox *vbox, GtkSizeGroup *sg, CPUGraph *base); +static GtkBox* setup_per_core_spacing_option (GtkBox *vbox, + GtkSizeGroup *sg, + CPUGraph *base); static void change_in_terminal (GtkToggleButton *button, CPUGraphOptions *data); @@ -131,7 +139,11 @@ CPUGraphOptions *data); static void change_bars (GtkToggleButton *button, CPUGraphOptions *data); -static void change_size (GtkSpinButton *sb, +static void change_per_core (GtkToggleButton *button, + CPUGraphOptions *data); +static void change_per_core_spacing (GtkSpinButton *button, + CPUGraph *base); +static void change_size (GtkSpinButton *button, CPUGraph *base); static void change_smt (GtkToggleButton *button, CPUGraphOptions *data); @@ -141,7 +153,7 @@ CPUGraphOptions *data); static void change_core (GtkComboBox *combo, CPUGraphOptions *data); -static void change_load_threshold (GtkSpinButton *sb, +static void change_load_threshold (GtkSpinButton *button, CPUGraph *base); static gboolean update_cb (CPUGraphOptions *data); @@ -179,14 +191,15 @@ setup_tracked_core_option (vbox, sg, dlg_data); setup_size_option (vbox, sg, plugin, base); setup_load_threshold_option (vbox, sg, base); - create_check_box (vbox, sg, _("Use non-linear time-scale"), base->non_linear, change_time_scale, dlg_data); gtk_box_pack_start (vbox, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, BORDER/2); setup_command_option (vbox, sg, dlg_data); dlg_data->hbox_in_terminal = create_check_box (vbox, sg, _("Run in terminal"), - base->in_terminal, change_in_terminal, dlg_data); + base->command_in_terminal, change_in_terminal, dlg_data, + NULL); dlg_data->hbox_startup_notification = create_check_box (vbox, sg, _("Use startup notification"), - base->startup_notification, change_startup_notification, dlg_data); + base->command_startup_notification, change_startup_notification, dlg_data, + NULL); smt_issues_tooltip = _("Color used to highlight potentially suboptimal\nplacement of threads on CPUs with SMT"); dlg_data->smt_stats_tooltip = g_strdup_printf("%s\n%s", @@ -195,9 +208,15 @@ gtk_box_pack_start (vbox, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, BORDER/2); dlg_data->hbox_highlight_smt = create_check_box (vbox, sg, _("Highlight suboptimal SMT scheduling"), - base->highlight_smt, change_smt, dlg_data); + base->highlight_smt, change_smt, dlg_data, + NULL); setup_color_option (vbox, sg, dlg_data, SMT_ISSUES_COLOR, _("SMT issues color:"), smt_issues_tooltip, change_color_5); + gtk_box_pack_start (vbox, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, BORDER/2); + create_check_box (vbox, sg, _("Use non-linear time-scale"), base->non_linear, change_time_scale, dlg_data, NULL); + create_check_box (vbox, sg, _("Per-core history graphs"), base->per_core, change_per_core, dlg_data, &dlg_data->per_core); + dlg_data->hbox_per_core_spacing = setup_per_core_spacing_option (vbox, sg, base); + vbox2 = create_tab (); setup_color_option (vbox2, sg, dlg_data, FG_COLOR1, _("Color 1:"), NULL, change_color_1); setup_color_option (vbox2, sg, dlg_data, FG_COLOR2, _("Color 2:"), NULL, change_color_2); @@ -207,11 +226,12 @@ setup_color_mode_option (vbox2, sg, dlg_data); gtk_box_pack_start (vbox2, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, BORDER/2); create_check_box (vbox2, sg, ngettext ("Show current usage bar", "Show current usage bars", base->nr_cores), - base->has_bars, change_bars, dlg_data); + base->has_bars, change_bars, dlg_data, + &dlg_data->show_bars_checkbox); setup_color_option (vbox2, sg, dlg_data, BARS_COLOR, _("Bars color:"), NULL, change_color_4); gtk_box_pack_start (vbox2, gtk_separator_new (GTK_ORIENTATION_HORIZONTAL), FALSE, FALSE, BORDER/2); - create_check_box (vbox2, sg, _("Show frame"), base->has_frame, change_frame, dlg_data); - create_check_box (vbox2, sg, _("Show border"), base->has_border, change_border, dlg_data); + create_check_box (vbox2, sg, _("Show frame"), base->has_frame, change_frame, dlg_data, NULL); + create_check_box (vbox2, sg, _("Show border"), base->has_border, change_border, dlg_data, NULL); vbox3 = create_tab (); dlg_data->smt_stats = create_label_line (vbox3, ""); @@ -291,7 +311,8 @@ static GtkBox* create_check_box (GtkBox *tab, GtkSizeGroup *sg, const gchar *name, gboolean init, - void (callback)(GtkToggleButton*, CPUGraphOptions*), CPUGraphOptions *cb_data) + void (callback)(GtkToggleButton*, CPUGraphOptions*), CPUGraphOptions *cb_data, + GtkToggleButton **out_checkbox) { GtkBox *hbox; GtkWidget *checkbox; @@ -303,6 +324,9 @@ gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (checkbox), FALSE, FALSE, 0); g_signal_connect (checkbox, "toggled", G_CALLBACK (callback), cb_data); + if (out_checkbox) + *out_checkbox = GTK_TOGGLE_BUTTON (checkbox); + return hbox; } @@ -363,7 +387,7 @@ items[0] = _("All"); for (i = 1; i < nb_items; i++) - items[i] = g_strdup_printf ("%u", i); + items[i] = g_strdup_printf ("%u", i-1); create_drop_down (vbox, sg, _("Tracked Core:"), (const gchar **) items, nb_items, data->base->tracked_core, change_core, data); @@ -402,6 +426,21 @@ g_signal_connect (threshold, "value-changed", G_CALLBACK (change_load_threshold), base); } +static GtkBox* +setup_per_core_spacing_option (GtkBox *vbox, GtkSizeGroup *sg, CPUGraph *base) +{ + GtkBox *hbox; + GtkWidget *spacing; + + hbox = create_option_line (vbox, sg, _("Spacing:"), NULL); + spacing = gtk_spin_button_new_with_range (PER_CORE_SPACING_MIN, PER_CORE_SPACING_MAX, 1); + gtk_spin_button_set_value (GTK_SPIN_BUTTON (spacing), base->per_core_spacing); + gtk_widget_set_tooltip_text (GTK_WIDGET (hbox), _("Spacing between per-core history graphs")); + gtk_box_pack_start (GTK_BOX (hbox), GTK_WIDGET (spacing), FALSE, FALSE, 0); + g_signal_connect (spacing, "value-changed", G_CALLBACK (change_per_core_spacing), base); + return hbox; +} + static void setup_command_option (GtkBox *vbox, GtkSizeGroup *sg, CPUGraphOptions *data) { @@ -556,11 +595,14 @@ { const CPUGraph *base = data->base; const gboolean default_command = (base->command == NULL); + const gboolean per_core = base->nr_cores > 1 && base->tracked_core == 0 && base->mode != MODE_DISABLED; gtk_widget_set_sensitive (GTK_WIDGET (data->hbox_highlight_smt), base->has_bars && base->topology && base->topology->smt); gtk_widget_set_sensitive (GTK_WIDGET (data->hbox_in_terminal), !default_command); gtk_widget_set_sensitive (GTK_WIDGET (data->hbox_startup_notification), !default_command); + gtk_widget_set_sensitive (GTK_WIDGET (data->per_core), per_core); + gtk_widget_set_sensitive (GTK_WIDGET (data->hbox_per_core_spacing), per_core && base->per_core); gtk_widget_set_sensitive (gtk_widget_get_parent (data->color_buttons[FG_COLOR2]), base->color_mode != 0 || base->mode == MODE_LED || base->mode == MODE_GRID); @@ -572,6 +614,7 @@ base->has_bars && base->highlight_smt && base->topology && base->topology->smt); gtk_widget_set_sensitive (gtk_widget_get_parent (data->color_mode_combobox), base->mode != MODE_GRID); + gtk_widget_set_sensitive (GTK_WIDGET (data->show_bars_checkbox), base->mode != MODE_DISABLED); } static void @@ -596,6 +639,8 @@ } set_mode (data->base, mode); + if (mode == MODE_DISABLED && !data->base->has_bars) + gtk_toggle_button_set_active (data->show_bars_checkbox, TRUE); update_sensitivity (data); } @@ -634,9 +679,22 @@ } static void -change_size (GtkSpinButton *sb, CPUGraph *base) +change_per_core (GtkToggleButton *button, CPUGraphOptions *data) +{ + set_per_core (data->base, gtk_toggle_button_get_active (button)); + update_sensitivity (data); +} + +static void +change_per_core_spacing (GtkSpinButton *button, CPUGraph *base) { - set_size (base, gtk_spin_button_get_value_as_int (sb)); + set_per_core_spacing (base, gtk_spin_button_get_value_as_int (button)); +} + +static void +change_size (GtkSpinButton *button, CPUGraph *base) +{ + set_size (base, gtk_spin_button_get_value_as_int (button)); } static void @@ -647,9 +705,9 @@ } static void -change_load_threshold (GtkSpinButton *sb, CPUGraph *base) +change_load_threshold (GtkSpinButton *button, CPUGraph *base) { - set_load_threshold (base, gtk_spin_button_get_value (sb) / 100); + set_load_threshold (base, gtk_spin_button_get_value (button) / 100); } static void change_time_scale (GtkToggleButton *button, CPUGraphOptions *data) @@ -665,6 +723,11 @@ static void change_core (GtkComboBox *combo, CPUGraphOptions *data) { set_tracked_core (data->base, gtk_combo_box_get_active (combo)); + if (data->base->tracked_core != 0) + set_per_core (data->base, FALSE); + else + set_per_core (data->base, gtk_toggle_button_get_active (data->per_core)); + update_sensitivity (data); } static gboolean diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xfce4-cpugraph-plugin-1.2.2/panel-plugin/settings.c new/xfce4-cpugraph-plugin-1.2.3/panel-plugin/settings.c --- old/xfce4-cpugraph-plugin-1.2.2/panel-plugin/settings.c 2021-02-14 18:45:27.000000000 +0100 +++ new/xfce4-cpugraph-plugin-1.2.3/panel-plugin/settings.c 2021-02-23 18:36:00.000000000 +0100 @@ -52,13 +52,15 @@ XfceRc *rc; CPUGraphUpdateRate rate = RATE_NORMAL; - gboolean nonlinear = FALSE; CPUGraphMode mode = MODE_NORMAL; guint color_mode = 0; - gboolean frame = FALSE; - gboolean border = TRUE; gboolean bars = TRUE; + gboolean border = TRUE; + gboolean frame = FALSE; gboolean highlight_smt = HIGHLIGHT_SMT_BY_DEFAULT; + gboolean nonlinear = FALSE; + gboolean per_core = FALSE; + guint per_core_spacing = PER_CORE_SPACING_DEFAULT; guint tracked_core = 0; GdkRGBA colors[NUM_COLORS]; @@ -93,6 +95,8 @@ border = xfce_rc_read_int_entry (rc, "Border", border); bars = xfce_rc_read_int_entry (rc, "Bars", bars); highlight_smt = xfce_rc_read_int_entry (rc, "SmtIssues", highlight_smt); + per_core = xfce_rc_read_int_entry (rc, "PerCore", per_core); + per_core_spacing = xfce_rc_read_int_entry (rc, "PerCoreSpacing", per_core_spacing); tracked_core = xfce_rc_read_int_entry (rc, "TrackedCore", tracked_core); load_threshold = xfce_rc_read_int_entry (rc, "LoadThreshold", load_threshold); @@ -128,6 +132,9 @@ mode = MODE_NORMAL; } + if (mode == MODE_DISABLED && !bars) + mode = MODE_NORMAL; + switch (rate) { case RATE_FASTEST: @@ -141,23 +148,25 @@ } } - set_update_rate (base, rate); - set_nonlinear_time (base, nonlinear); - set_size (base, size); - set_mode (base, mode); + set_bars (base, bars); + set_border (base, border); + for (i = 0; i < NUM_COLORS; i++) + set_color (base, i, colors[i]); set_color_mode (base, color_mode); - set_frame (base, frame); if (command) set_command (base, command); set_in_terminal (base, in_terminal); + set_frame (base, frame); + set_load_threshold (base, load_threshold * 0.01f); + set_mode (base, mode); + set_nonlinear_time (base, nonlinear); + set_per_core (base, per_core); + set_per_core_spacing (base, per_core_spacing); + set_size (base, size); + set_smt (base, highlight_smt); set_startup_notification (base, startup_notification); - set_border (base, border); set_tracked_core (base, tracked_core); - set_bars (base, bars); - set_smt (base, highlight_smt); - for (i = 0; i < NUM_COLORS; i++) - set_color (base, i, colors[i]); - set_load_threshold (base, load_threshold * 0.01f); + set_update_rate (base, rate); g_free (command); } @@ -178,19 +187,20 @@ return; xfce_rc_write_int_entry (rc, "UpdateInterval", base->update_interval); - xfce_rc_write_int_entry (rc, "TimeScale", base->non_linear); + xfce_rc_write_int_entry (rc, "TimeScale", base->non_linear ? 1 : 0); xfce_rc_write_int_entry (rc, "Size", base->size); xfce_rc_write_int_entry (rc, "Mode", base->mode); - xfce_rc_write_int_entry (rc, "Frame", base->has_frame); - xfce_rc_write_int_entry (rc, "Border", base->has_border); - xfce_rc_write_int_entry (rc, "Bars", base->has_bars); + xfce_rc_write_int_entry (rc, "Frame", base->has_frame ? 1 : 0); + xfce_rc_write_int_entry (rc, "Border", base->has_border ? 1 : 0); + xfce_rc_write_int_entry (rc, "Bars", base->has_bars ? 1 : 0); + xfce_rc_write_int_entry (rc, "PerCore", base->per_core ? 1 : 0); xfce_rc_write_int_entry (rc, "TrackedCore", base->tracked_core); if (base->command) xfce_rc_write_entry (rc, "Command", base->command); else xfce_rc_delete_entry (rc, "Command", FALSE); - xfce_rc_write_int_entry (rc, "InTerminal", base->in_terminal); - xfce_rc_write_int_entry (rc, "StartupNotification", base->startup_notification); + xfce_rc_write_int_entry (rc, "InTerminal", base->command_in_terminal ? 1 : 0); + xfce_rc_write_int_entry (rc, "StartupNotification", base->command_startup_notification ? 1 : 0); xfce_rc_write_int_entry (rc, "ColorMode", base->color_mode); if (base->load_threshold != 0) xfce_rc_write_int_entry (rc, "LoadThreshold", (gint) roundf (100 * base->load_threshold)); @@ -220,9 +230,14 @@ } if (base->highlight_smt != HIGHLIGHT_SMT_BY_DEFAULT) - xfce_rc_write_int_entry (rc, "SmtIssues", base->highlight_smt); + xfce_rc_write_int_entry (rc, "SmtIssues", base->highlight_smt ? 1 : 0); else xfce_rc_delete_entry (rc, "SmtIssues", FALSE); + if (base->per_core_spacing != PER_CORE_SPACING_DEFAULT) + xfce_rc_write_int_entry (rc, "PerCoreSpacing", base->per_core_spacing); + else + xfce_rc_delete_entry (rc, "PerCoreSpacing", FALSE); + xfce_rc_close (rc); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xfce4-cpugraph-plugin-1.2.2/po/fr.po new/xfce4-cpugraph-plugin-1.2.3/po/fr.po --- old/xfce4-cpugraph-plugin-1.2.2/po/fr.po 2021-02-14 18:50:14.000000000 +0100 +++ new/xfce4-cpugraph-plugin-1.2.3/po/fr.po 2021-02-23 19:06:42.000000000 +0100 @@ -12,8 +12,8 @@ "Project-Id-Version: Xfce Panel Plugins\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-13 00:48+0100\n" -"PO-Revision-Date: 2021-01-12 23:48+0000\n" -"Last-Translator: Xfce Bot <transifex@xfce.org>\n" +"PO-Revision-Date: 2021-02-18 14:37+0000\n" +"Last-Translator: Yannick Le Guen <leguen.yannick@gmail.com>\n" "Language-Team: French (http://www.transifex.com/xfce/xfce-panel-plugins/language/fr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -27,7 +27,7 @@ #: ../panel-plugin/cpu.c:157 msgid "Copyright (c) 2003-2021\n" -msgstr "" +msgstr "Copyright (c) 2003-2021\n" #: ../panel-plugin/cpu.c:567 #, c-format diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/xfce4-cpugraph-plugin-1.2.2/po/sl.po new/xfce4-cpugraph-plugin-1.2.3/po/sl.po --- old/xfce4-cpugraph-plugin-1.2.2/po/sl.po 2021-02-14 18:50:14.000000000 +0100 +++ new/xfce4-cpugraph-plugin-1.2.3/po/sl.po 2021-02-23 19:06:42.000000000 +0100 @@ -3,14 +3,14 @@ # This file is distributed under the same license as the PACKAGE package. # # Translators: -# Arnold Marko <arnold.marko@gmail.com>, 2019-2020 +# Arnold Marko <arnold.marko@gmail.com>, 2019-2021 msgid "" msgstr "" "Project-Id-Version: Xfce Panel Plugins\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2021-01-13 00:48+0100\n" -"PO-Revision-Date: 2021-01-12 23:48+0000\n" -"Last-Translator: Xfce Bot <transifex@xfce.org>\n" +"PO-Revision-Date: 2021-02-22 11:47+0000\n" +"Last-Translator: Arnold Marko <arnold.marko@gmail.com>\n" "Language-Team: Slovenian (http://www.transifex.com/xfce/xfce-panel-plugins/language/sl/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -24,7 +24,7 @@ #: ../panel-plugin/cpu.c:157 msgid "Copyright (c) 2003-2021\n" -msgstr "" +msgstr "Avtorstvo (c) 2003-2021\n" #: ../panel-plugin/cpu.c:567 #, c-format @@ -51,26 +51,26 @@ msgid "" "Color used to highlight potentially suboptimal\n" "placement of threads on CPUs with SMT" -msgstr "" +msgstr "Barva, ki prikazuje mo��no neoptimalno\npostavitev niti na procesorjih s SMT" #: ../panel-plugin/properties.c:192 msgid "" "'Overall' is showing the impact on the overall performance of the machine." -msgstr "" +msgstr "'Celota' prikazuje vpliv na celotno zmogljivost ra��unalnika" #: ../panel-plugin/properties.c:193 msgid "" "'Hotspots' is showing the momentary performance impact on just the threads " "involved in suboptimal SMT scheduling decisions." -msgstr "" +msgstr "'��ari����a' prikazujejo vplive niti, ki so udele��ene v neoptimalno ��asovno razporejanje SMT, na trenutno zmanj��anje zmogljivosti." #: ../panel-plugin/properties.c:196 msgid "Highlight suboptimal SMT scheduling" -msgstr "" +msgstr "Osvetli neoptimalno SMT ��asovno razporejanje" #: ../panel-plugin/properties.c:198 msgid "SMT issues color:" -msgstr "" +msgstr "Barve za prikaz SMT te��av:" #: ../panel-plugin/properties.c:201 msgid "Color 1:" @@ -118,7 +118,7 @@ #: ../panel-plugin/properties.c:225 msgid "Stats" -msgstr "" +msgstr "Statistike" #: ../panel-plugin/properties.c:346 msgid "Fastest (~250ms)" @@ -214,35 +214,35 @@ #: ../panel-plugin/properties.c:679 msgid "SMT detected: Yes" -msgstr "" +msgstr "Zaznan SMT: da" #: ../panel-plugin/properties.c:679 msgid "SMT detected: No" -msgstr "" +msgstr "Zaznan SMT: ne" #: ../panel-plugin/properties.c:704 #, c-format msgid "Number of SMT scheduling incidents: %u" -msgstr "" +msgstr "��tevilo incidentov pri ��asovnem razporejanju SMT: %u" #: ../panel-plugin/properties.c:713 #, c-format msgid "Estimated performance impact:" -msgstr "" +msgstr "Predviden vpliv na zmogljivost:" #: ../panel-plugin/properties.c:714 #, c-format msgid "Overall: %.3g%%" -msgstr "" +msgstr "V celoti: %.3g%%" #: ../panel-plugin/properties.c:715 #, c-format msgid "Hotspots: %.3g%%" -msgstr "" +msgstr "��ari����a: %.3g%%" #: ../panel-plugin/properties.c:728 msgid "SMT detected: N/A" -msgstr "" +msgstr "Zaznan SMT: ni na voljo" #: ../panel-plugin/cpugraph.desktop.in.h:1 msgid "CPU Graph"
participants (1)
-
Source-Sync