I noticed that if CPU(s) freq. are dropped to 1Ghz, the icon tray just displays: [1 GHz] but then on activity, governor pushes up Hz, so we get this: [1.67 GHz] OK, all well and good. But what this does is just make the panel keep resizing: [ ] [ ] [ ] [ ] etc. So, looking at the code (panel-plugins/xfce4-cpufreq-utils.c) if ((freq % div) == 0 || div == 1000) readable_freq = g_strdup_printf ("%d.2f %s", (freq/div), freq_unit); else readable_freq = g_strdup_printf ("%3.2f %s", ((gfloat)freq/div), freq_unit); g_free (freq_unit); return readable_freq; } ... isn't needed. Just: readable_freq = g_strdup_printf ("%3.2f %s", ((gfloat)freq/div), freq_unit); ... which now gives: [1.00 GHz] [1.66 GHz] [1.33 GHz] [1.00 GHz] and no 'panel' jumping resize. Nick
Bugger.... please ignore the: readable_freq = g_strdup_printf ("%d.2f %s", (freq/div), freq_unit); ^^^ that was me debugging and I forgot to remove it. It is: readable_freq = g_strdup_printf ("%d %s", (freq/div), freq_unit); Nick
Acknowledged. But while this solution may work in your case, I believe there can still be problems on other systems. What's more, that defeats the nice formatting for particular values. E.g. my thinkpad's lowest CPU freq would then be displayed as 800.00 MHz instead of 800 MHz, which wastes space and is harder to read, with no extra information gained. Maybe it would be better to calculate the max size needed and always request that. I'll look into this before the next release. Thanks for reporting.
Created attachment 5822 fix-panel-resizing-caused-by-freq-format-function.patch If you are still interested in or plagued by this bug, can you please try this patch? It makes the plugin keep the max label width, only resetting it on config or panel size changes. Unfortunately, I cannot test it for your exact problem because the cpus in my machines have no "problematic" frequencies, but the tests I did so far indicate it should fix this too.
Thanks for your time. This works a lot better, but it still resizes somewhat on the change from 1GHz to 1.66GHz - i.e. the max size doesn't seem to stick. Nick
Ok, thanks for testing. I think we are half-way there. I believe there is one logical error in my patch that might cause the max size not to stick. The patch added a line in cpufreq_set_size(): @@ -551,6 +566,7 @@ cpufreq_set_size (XfcePanelPlugin *plugin, gint size, CpuFreqPlugin *cpufreq) { cpuFreq->panel_size = size; cpuFreq->panel_rows = xfce_panel_plugin_get_nrows (plugin); + cpuFreq->label_max_width = -1; cpuFreq->layout_changed = TRUE; cpufreq_update_icon (cpufreq); cpufreq_update_plugin (); Can you remove this line and see if that helps? If yes, then either this line is completely unnecessary or it should be added to another part, like cpufreq_set_orientation, in case the panel changes its mode (if you have time please test changing panel mode horizontal/vertical/deskbar too to verify that the patch doesn't cause any troubles or is incomplete).
OK, tried that - still the same, i.e. if I have the governor displayed I get (for instance): |1GHz Ondemand| and switching: |1GHz Conservative| and switch back it resizes to the same as the top line. Also the 1GHz to 1.67GHz still resizes between them. I dunno. It doesn't really matter I suppose - it doing what it is suppose to do. I also tested the panel in vertical/desktop modes, and apart from the obvious squashing up (that all applets do), it works fine. Thanks, Nick
I have reproduced the problem by changing the frequency reported and altered the patch so it nearly works now. The previous patch had the right pieces, but in the wrong place. However, the new patch has revealed other issues with the layout changes etc. so more work and much testing is needed. If I can spend enough time, I'll try to include a fix in the next release, otherwise it has to wait (again).
Well I can test it out for you when ready if you give me the heads up. Nick
Please try http://git.xfce.org/users/hjudt/xfce4-cpufreq-plugin/log/?h=fix-bug-10385. Or if you don't know how to pull and compile from git, you can also simply apply these two patches in the following order: http://git.xfce.org/users/hjudt/xfce4-cpufreq-plugin/patch/?id=5677fa969032ae8e6eae26ea69d4c36a39db385e http://git.xfce.org/users/hjudt/xfce4-cpufreq-plugin/patch/?id=21a91c784c5ae99081dfff4c28ae30e092003255 These fix both your bug and small layout problems. The previous patch from this bug is obsolete. The resizes might still occur once, but from then on the plugin size should be stable until a panel resize or orientation change occurs. This too could be fixed probably, but then I don't want to spend more time on this and I don't really see the necessity to do so; such changes usually don't happen very often.
Comment on attachment 5822 fix-panel-resizing-caused-by-freq-format-function.patch Obsoleted by new patches on private git repository.
I've pushed the changes to git master: http://git.xfce.org/panel-plugins/xfce4-cpufreq-plugin/commit/?id=5677fa969032ae8e6eae26ea69d4c36a39db385e A new version will be released soon. Feel free to reopen if this is still an issue.
Will do - thanks for your hard work Harald. Seasons greetings, Nick
Hi Harald, I just got the latest git and built it - it works perfectly now. Thank you for your time on this. Nick
Thanks for your testing, glad to hear it's finally fixed now.
*** Bug 11953 has been marked as a duplicate of this bug. ***