mirror of
https://github.com/swaywm/sway.git
synced 2026-04-18 06:46:56 -04:00
Remove conditionals and old code for locating and loading icons
With libsfdo a hard dependency we can locate and load icons always, regardless of whether we have tray or not. Old locating and loading code can also be removed.
This commit is contained in:
parent
0872673472
commit
6d7c0d52d6
10 changed files with 7 additions and 134 deletions
|
|
@ -538,9 +538,7 @@ void bar_teardown(struct swaybar *bar) {
|
|||
#if HAVE_TRAY
|
||||
destroy_tray(bar->tray);
|
||||
#endif
|
||||
#if HAVE_LIBSFDO
|
||||
sfdo_destroy(bar->config->sfdo);
|
||||
#endif
|
||||
free_outputs(&bar->outputs);
|
||||
free_outputs(&bar->unused_outputs);
|
||||
free_seats(&bar->seats);
|
||||
|
|
|
|||
|
|
@ -7,9 +7,7 @@
|
|||
#include "list.h"
|
||||
#include "log.h"
|
||||
|
||||
#if HAVE_LIBSFDO
|
||||
#include "sfdo.h"
|
||||
#endif
|
||||
|
||||
uint32_t parse_position(const char *position) {
|
||||
uint32_t horiz = ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT |
|
||||
|
|
@ -132,18 +130,11 @@ void free_config(struct swaybar_config *config) {
|
|||
wl_list_remove(&tray_bind->link);
|
||||
free_tray_binding(tray_bind);
|
||||
}
|
||||
|
||||
free(config->icon_theme);
|
||||
#endif
|
||||
|
||||
#if HAVE_LIBSFDO && !HAVE_TRAY
|
||||
free(config->icon_theme);
|
||||
#endif
|
||||
|
||||
#if HAVE_LIBSFDO
|
||||
sfdo_destroy(config->sfdo);
|
||||
sway_log(SWAY_DEBUG, "Destroyed swaybar sfdo");
|
||||
#endif
|
||||
|
||||
free(config);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,9 +18,7 @@
|
|||
#include "stringop.h"
|
||||
#include "util.h"
|
||||
|
||||
#if HAVE_LIBSFDO
|
||||
#include "sfdo.h"
|
||||
#endif
|
||||
|
||||
void ipc_send_workspace_command(struct swaybar *bar, const char *ws) {
|
||||
uint32_t size = strlen("workspace \"\"") + strlen(ws);
|
||||
|
|
@ -332,14 +330,14 @@ static bool ipc_parse_config(
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// whether or not there is a tray, we now always have an icon theme
|
||||
if ((json_object_object_get_ex(bar_config, "icon_theme", &icon_theme))) {
|
||||
config->icon_theme = strdup(json_object_get_string(icon_theme));
|
||||
#if HAVE_LIBSFDO
|
||||
sfdo_destroy(config->sfdo);
|
||||
config->sfdo = sfdo_create(config->icon_theme);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
|
||||
json_object_put(bar_config);
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -20,9 +20,7 @@
|
|||
#include "stringop.h"
|
||||
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
||||
|
||||
#if HAVE_LIBSFDO
|
||||
#include "sfdo.h"
|
||||
#endif
|
||||
|
||||
// TODO menu
|
||||
|
||||
|
|
@ -426,16 +424,6 @@ static void reload_sni(struct swaybar_sni *sni, char *icon_theme, int target_siz
|
|||
sni->attention_icon_name : sni->icon_name;
|
||||
if (icon_name) {
|
||||
char *icon_path = NULL;
|
||||
#if !HAVE_LIBSFDO
|
||||
list_t *icon_search_paths = create_list();
|
||||
list_cat(icon_search_paths, sni->tray->basedirs);
|
||||
if (sni->icon_theme_path) {
|
||||
list_add(icon_search_paths, sni->icon_theme_path);
|
||||
}
|
||||
icon_path = find_icon(sni->tray->themes, icon_search_paths,
|
||||
icon_name, target_size, icon_theme,
|
||||
&sni->min_size, &sni->max_size);
|
||||
#else
|
||||
// TODO: at some point we will need to make this scaling-aware
|
||||
int scale = 1;
|
||||
struct sfdo *sfdo = sni->tray->bar->config->sfdo;
|
||||
|
|
@ -446,10 +434,6 @@ static void reload_sni(struct swaybar_sni *sni, char *icon_theme, int target_siz
|
|||
icon_name, icon_theme, target_size);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#if !HAVE_LIBSFDO
|
||||
list_free(icon_search_paths);
|
||||
#endif
|
||||
if (icon_path) {
|
||||
cairo_surface_destroy(sni->icon);
|
||||
sni->icon = load_image(icon_path, target_size, scale);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue