aboutsummaryrefslogtreecommitdiffstats
path: root/swaybar/tray/tray.c
diff options
context:
space:
mode:
authorLibravatar Konstantin Pospelov <kupospelov@gmail.com>2019-06-08 18:11:32 +0300
committerLibravatar Simon Ser <contact@emersion.fr>2019-10-21 17:22:25 +0200
commitfa0abaf7cfecf1dc433717d53379d6942226c2bb (patch)
treedeb117124ad6b8f824cab986b99cf60f4cc2871c /swaybar/tray/tray.c
parentFix refresh rate scale of output (diff)
downloadsway-fa0abaf7cfecf1dc433717d53379d6942226c2bb.tar.gz
sway-fa0abaf7cfecf1dc433717d53379d6942226c2bb.tar.zst
sway-fa0abaf7cfecf1dc433717d53379d6942226c2bb.zip
swaybar: do not retry search for tray icons
In case a tray icon cannot be found or does not have a desirable size, swaybar retries the search again and again, which increases load on disk and CPU. This commit solves it by storing target_size for each icon, so that swaybar does not search for an icon of some size if it already tried to. Fixes #3789.
Diffstat (limited to 'swaybar/tray/tray.c')
-rw-r--r--swaybar/tray/tray.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/swaybar/tray/tray.c b/swaybar/tray/tray.c
index fcf8114f..5fe6f9c3 100644
--- a/swaybar/tray/tray.c
+++ b/swaybar/tray/tray.c
@@ -124,7 +124,9 @@ uint32_t render_tray(cairo_t *cairo, struct swaybar_output *output, double *x) {
124 struct swaybar_tray *tray = output->bar->tray; 124 struct swaybar_tray *tray = output->bar->tray;
125 for (int i = 0; i < tray->items->length; ++i) { 125 for (int i = 0; i < tray->items->length; ++i) {
126 uint32_t h = render_sni(cairo, output, x, tray->items->items[i]); 126 uint32_t h = render_sni(cairo, output, x, tray->items->items[i]);
127 max_height = h > max_height ? h : max_height; 127 if (h > max_height) {
128 max_height = h;
129 }
128 } 130 }
129 131
130 return max_height; 132 return max_height;