[Xfce4-commits] [panel-plugins/xfce4-hardware-monitor-plugin] 01/01: Text overlay: On 2nd+ monitor type loop, only output text if text isnt fixed

noreply at xfce.org noreply at xfce.org
Fri Dec 22 17:19:31 CET 2017


This is an automated email from the git hooks/post-receive script.

o   m   e   g   a   p   h   i   l       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository panel-plugins/xfce4-hardware-monitor-plugin.

commit 0d8034f5a8c40fe6d61eb8856464045224c13ac2
Author: OmegaPhil <OmegaPhil at startmail.com>
Date:   Fri Dec 22 16:18:28 2017 +0000

    Text overlay: On 2nd+ monitor type loop, only output text if text isnt fixed
    
    Prevents fixed text being duplicated per monitor type when the user
    effectively just wants a label overlay
    Fixes https://bugzilla.xfce.org/show_bug.cgi?id=14065
---
 src/canvas-view.cpp | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/src/canvas-view.cpp b/src/canvas-view.cpp
index 73a952c..832b61c 100644
--- a/src/canvas-view.cpp
+++ b/src/canvas-view.cpp
@@ -177,11 +177,11 @@ std::list<std::pair<T*, double>> CanvasView::process_mon_maxes_text_overlay(
       monitor_data_needed = false, monitor_data_compact_needed = false,
       text_overlay_enabled = plugin->get_viewer_text_overlay_enabled();
 
-  /* Obtain maximum value of all curves/flames/bars etc in the view on a per monitor type basis
-   * but only when the user wants visualisations to be split by type,
-   * separately tracking fixed maxes incase all monitors are fixed. Graphs with
-   * fixed monitors are not supposed to be scaled, but the text overlay still
-   * needs to refer to a max if there are no normal monitors present
+  /* Obtain maximum value of all curves/flames/bars etc in the view on a per
+   * monitor type basis but only when the user wants visualisations to be split
+   * by type, separately tracking fixed maxes incase all monitors are fixed.
+   * Graphs with fixed monitors are not supposed to be scaled, but the text
+   * overlay still needs to refer to a max if there are no normal monitors present
    * Priority-wise, non-fixed monitor sources are always reported in preference
    * to fixed-max sources
    * On top of this, collect the curves together by monitor type so that they
@@ -326,8 +326,7 @@ std::list<std::pair<T*, double>> CanvasView::process_mon_maxes_text_overlay(
         }
       }
 
-      // Drawing the curves with the unified max value
-      //(*r)->draw(*canvas, width(), height(), max);
+      // Recording max per monitor
       elems_and_maxes.push_back(std::make_pair(*r, max));
     }
 
@@ -350,7 +349,13 @@ std::list<std::pair<T*, double>> CanvasView::process_mon_maxes_text_overlay(
                          max_formatted_compact);
       if (overlay_text.empty())
         overlay_text = per_type_overlay_text;
-      else
+
+      /* Overlay text is already present. If the user has only fixed text (i.e.
+       * no substitution variables), outputting the full text again per monitor
+       * type would result in the fixed text being duped - so in this case, make
+       * sure to only output once */
+      else if (monitor_data_needed || monitor_data_compact_needed
+               || graph_max_needed || graph_max_compact_needed)
         overlay_text += separator_string + per_type_overlay_text;
     }
   }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list