aboutsummaryrefslogtreecommitdiff
path: root/swaybar/tray
diff options
context:
space:
mode:
authorIan Fan <ianfan0@gmail.com>2019-01-02 22:31:05 +0000
committerIan Fan <ianfan0@gmail.com>2019-01-08 12:17:53 +0000
commitb666fc76a6de9d4eb24ca9a1e458736b1ffee974 (patch)
treeb620e177d20b94ad35e03ea75fc1ea34558e4a41 /swaybar/tray
parent140bc2dd5b81205df58bf06e695788e689fae397 (diff)
swaybar: free the right item during tray destruction
Also added a comment to make more obvious the reason for comparing sni->status[0] == 'N'
Diffstat (limited to 'swaybar/tray')
-rw-r--r--swaybar/tray/item.c4
-rw-r--r--swaybar/tray/tray.c2
2 files changed, 3 insertions, 3 deletions
diff --git a/swaybar/tray/item.c b/swaybar/tray/item.c
index 41cacd16..130496ec 100644
--- a/swaybar/tray/item.c
+++ b/swaybar/tray/item.c
@@ -19,7 +19,7 @@
// TODO menu
static bool sni_ready(struct swaybar_sni *sni) {
- return sni->status && (sni->status[0] == 'N' ?
+ return sni->status && (sni->status[0] == 'N' ? // NeedsAttention
sni->attention_icon_name || sni->attention_icon_pixmap :
sni->icon_name || sni->icon_pixmap);
}
@@ -396,7 +396,7 @@ uint32_t render_sni(cairo_t *cairo, struct swaybar_output *output, double *x,
icon_size = actual_size < ideal_size ?
actual_size*(ideal_size/actual_size) : ideal_size;
icon = cairo_image_surface_scale(sni->icon, icon_size, icon_size);
- } else { // draw a sad face
+ } else { // draw a :(
icon_size = ideal_size*0.8;
icon = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, icon_size, icon_size);
cairo_t *cairo_icon = cairo_create(icon);
diff --git a/swaybar/tray/tray.c b/swaybar/tray/tray.c
index acc300af..0c3517cb 100644
--- a/swaybar/tray/tray.c
+++ b/swaybar/tray/tray.c
@@ -79,7 +79,7 @@ void destroy_tray(struct swaybar_tray *tray) {
finish_host(&tray->host_xdg);
finish_host(&tray->host_kde);
for (int i = 0; i < tray->items->length; ++i) {
- destroy_sni(tray->items->items[0]);
+ destroy_sni(tray->items->items[i]);
}
list_free(tray->items);
destroy_watcher(tray->watcher_xdg);