diff options
Diffstat (limited to 'swaybar')
-rw-r--r-- | swaybar/tray/host.c | 8 | ||||
-rw-r--r-- | swaybar/tray/icon.c | 18 | ||||
-rw-r--r-- | swaybar/tray/item.c | 4 |
3 files changed, 10 insertions, 20 deletions
diff --git a/swaybar/tray/host.c b/swaybar/tray/host.c index 451b0896..ddf2416d 100644 --- a/swaybar/tray/host.c +++ b/swaybar/tray/host.c | |||
@@ -65,9 +65,9 @@ static int handle_sni_unregistered(sd_bus_message *msg, void *data, | |||
65 | static int get_registered_snis_callback(sd_bus_message *msg, void *data, | 65 | static int get_registered_snis_callback(sd_bus_message *msg, void *data, |
66 | sd_bus_error *error) { | 66 | sd_bus_error *error) { |
67 | if (sd_bus_message_is_method_error(msg, NULL)) { | 67 | if (sd_bus_message_is_method_error(msg, NULL)) { |
68 | sd_bus_error err = *sd_bus_message_get_error(msg); | 68 | const sd_bus_error *err = sd_bus_message_get_error(msg); |
69 | sway_log(SWAY_ERROR, "Failed to get registered SNIs: %s", err.message); | 69 | sway_log(SWAY_ERROR, "Failed to get registered SNIs: %s", err->message); |
70 | return -sd_bus_error_get_errno(&err); | 70 | return -sd_bus_error_get_errno(err); |
71 | } | 71 | } |
72 | 72 | ||
73 | int ret = sd_bus_message_enter_container(msg, 'v', NULL); | 73 | int ret = sd_bus_message_enter_container(msg, 'v', NULL); |
@@ -87,9 +87,11 @@ static int get_registered_snis_callback(sd_bus_message *msg, void *data, | |||
87 | struct swaybar_tray *tray = data; | 87 | struct swaybar_tray *tray = data; |
88 | for (char **id = ids; *id; ++id) { | 88 | for (char **id = ids; *id; ++id) { |
89 | add_sni(tray, *id); | 89 | add_sni(tray, *id); |
90 | free(*id); | ||
90 | } | 91 | } |
91 | } | 92 | } |
92 | 93 | ||
94 | free(ids); | ||
93 | return ret; | 95 | return ret; |
94 | } | 96 | } |
95 | 97 | ||
diff --git a/swaybar/tray/icon.c b/swaybar/tray/icon.c index 69df3582..c426c3d4 100644 --- a/swaybar/tray/icon.c +++ b/swaybar/tray/icon.c | |||
@@ -412,7 +412,7 @@ static char *find_icon_in_subdir(char *name, char *basedir, char *theme, | |||
412 | #endif | 412 | #endif |
413 | "png", | 413 | "png", |
414 | #if HAVE_GDK_PIXBUF | 414 | #if HAVE_GDK_PIXBUF |
415 | "xpm" | 415 | "xpm" // deprecated |
416 | #endif | 416 | #endif |
417 | }; | 417 | }; |
418 | 418 | ||
@@ -508,21 +508,13 @@ static char *find_icon_with_theme(list_t *basedirs, list_t *themes, char *name, | |||
508 | return icon; | 508 | return icon; |
509 | } | 509 | } |
510 | 510 | ||
511 | char *find_icon_in_dir(char *name, char *dir, int *min_size, int *max_size) { | ||
512 | char *icon = find_icon_in_subdir(name, dir, "", ""); | ||
513 | if (icon) { | ||
514 | *min_size = 1; | ||
515 | *max_size = 512; | ||
516 | } | ||
517 | return icon; | ||
518 | |||
519 | } | ||
520 | |||
521 | static char *find_fallback_icon(list_t *basedirs, char *name, int *min_size, | 511 | static char *find_fallback_icon(list_t *basedirs, char *name, int *min_size, |
522 | int *max_size) { | 512 | int *max_size) { |
523 | for (int i = 0; i < basedirs->length; ++i) { | 513 | for (int i = 0; i < basedirs->length; ++i) { |
524 | char *icon = find_icon_in_dir(name, basedirs->items[i], min_size, max_size); | 514 | char *icon = find_icon_in_subdir(name, basedirs->items[i], "", ""); |
525 | if (icon) { | 515 | if (icon) { |
516 | *min_size = 1; | ||
517 | *max_size = 512; | ||
526 | return icon; | 518 | return icon; |
527 | } | 519 | } |
528 | } | 520 | } |
@@ -537,7 +529,7 @@ char *find_icon(list_t *themes, list_t *basedirs, char *name, int size, | |||
537 | icon = find_icon_with_theme(basedirs, themes, name, size, theme, | 529 | icon = find_icon_with_theme(basedirs, themes, name, size, theme, |
538 | min_size, max_size); | 530 | min_size, max_size); |
539 | } | 531 | } |
540 | if (!icon) { | 532 | if (!icon && !(theme && strcmp(theme, "Hicolor") == 0)) { |
541 | icon = find_icon_with_theme(basedirs, themes, name, size, "Hicolor", | 533 | icon = find_icon_with_theme(basedirs, themes, name, size, "Hicolor", |
542 | min_size, max_size); | 534 | min_size, max_size); |
543 | } | 535 | } |
diff --git a/swaybar/tray/item.c b/swaybar/tray/item.c index b4238417..63578cd9 100644 --- a/swaybar/tray/item.c +++ b/swaybar/tray/item.c | |||
@@ -416,10 +416,6 @@ static void reload_sni(struct swaybar_sni *sni, char *icon_theme, | |||
416 | icon_name, target_size, icon_theme, | 416 | icon_name, target_size, icon_theme, |
417 | &sni->min_size, &sni->max_size); | 417 | &sni->min_size, &sni->max_size); |
418 | list_free(icon_search_paths); | 418 | list_free(icon_search_paths); |
419 | if (!icon_path && sni->icon_theme_path) { | ||
420 | icon_path = find_icon_in_dir(icon_name, sni->icon_theme_path, | ||
421 | &sni->min_size, &sni->max_size); | ||
422 | } | ||
423 | if (icon_path) { | 419 | if (icon_path) { |
424 | cairo_surface_destroy(sni->icon); | 420 | cairo_surface_destroy(sni->icon); |
425 | sni->icon = load_background_image(icon_path); | 421 | sni->icon = load_background_image(icon_path); |