gnome-shell-system-monitor-applet icon indicating copy to clipboard operation
gnome-shell-system-monitor-applet copied to clipboard

Tooltip font rendering is slightly garbled sometimes

Open ZimbiX opened this issue 2 years ago • 2 comments

Sometimes it renders properly:

Screenshot from 2023-01-18 06-33-07

But most of the time, it looks like this:

Screenshot from 2023-01-18 06-33-48

When a tooltip appears, it's either garbled or not, and stays that way. Moving the cursor away, waiting a second, and hovering again, rolls the dice again on whether it'll be garbled.

Unlike the other tooltips, the network one seems to be always garbled. Of my graphs' refresh time settings, network and CPU have the shortest - 1000ms - but it doesn't affect the CPU tooltip to the same extent, strangely.

It's rather odd. It's been like this for a few years now.

The last graph is an addition from my fork, but the issue is unrelated to that.

➜ dconf dump /org/gnome/shell/extensions/system-monitor/
[/]
battery-display=false
battery-hidesystem=false
battery-show-menu=false
battery-show-text=false
battery-style='digit'
battery-time=true
center-display=false
compact-display=false
cpu-graph-width=100
cpu-individual-cores=false
cpu-refresh-time=1000
cpu-show-text=false
disk-display=true
disk-show-text=false
disk-style='graph'
disk-usage-style='bar'
fan-display=false
fan-fan0-color='#865e3cff'
fan-graph-width=30
fan-sensor-file='/sys/class/hwmon/hwmon4/fan1_input'
fan-show-menu=false
fan-show-text=false
fan-style='graph'
freq-display=false
freq-show-menu=false
freq-show-text=true
freq-style='both'
gpu-display=false
icon-display=false
memory-refresh-time=5000
memory-show-text=false
memory-style='graph'
move-clock=false
net-show-text=false
net-speed-in-bits=false
show-tooltip=true
swap-display=true
swap-graph-width=100
swap-show-text=false
thermal-display=true
thermal-fahrenheit-unit=false
thermal-graph-width=100
thermal-sensor-file='/sys/class/hwmon/hwmon4/temp1_input'
thermal-show-menu=true
thermal-show-text=false
thermal-style='graph'
thermal-threshold=0
thermal-tz0-color='#c17d11ff'

ZimbiX avatar Jan 17 '23 19:01 ZimbiX

Ok, weird. I enabled the GPU graph and adjusted the width of all my graphs to compensate, and now the network tooltip renders fine! It might have moved the consistent problem elsewhere though.

for g in memory swap cpu gpu freq net disk thermal fan solar battery; do dconf write /org/gnome/shell/extensions/system-monitor/$g-graph-width 85; done

ZimbiX avatar Jan 17 '23 21:01 ZimbiX

I figured it out! The fact that it seemed related to width and that some of the garbling presented as blurriness led me to wonder if it was from a fractional x position. I added some logging to check this:

diff --git a/[email protected]/extension.js b/[email protected]/extension.js
index 146e279..16355ba 100644
--- a/[email protected]/extension.js
+++ b/[email protected]/extension.js
@@ -792,6 +792,7 @@ const TipMenu = class SystemMonitor_TipMenu extends PopupMenu.PopupMenuBase {
         let tipx = cx - width / 2;
         tipx = Math.max(tipx, monitor.x);
         tipx = Math.min(tipx, monitor.x + monitor.width - width);
+        console.log(`tipx orig: ${tipx}`);
         let tipy = Math.floor(ym);
         // Hacky condition to determine if the status bar is at the top or at the bottom of the screen
         if (sourceTopLeftY / monitor.height > 0.3) {

And yep - some tooltips have fractional x values, and it's exactly correlated to the garbling - see the below screen recording. The last one is harder to notice as it's just blurry with no artifacting - view the video at 100% scale to see it: right-click -> Open video in new tab.

https://user-images.githubusercontent.com/2916331/214095496-0ca578c4-8fb8-4937-a109-1e19654fd74f.mp4

A simple rounding of the x position fixed it 🙂 I'll submit a PR in a moment

ZimbiX avatar Jan 23 '23 16:01 ZimbiX