diff options
Diffstat (limited to 'swaybar/bar.c')
-rw-r--r-- | swaybar/bar.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/swaybar/bar.c b/swaybar/bar.c index b4c0698f..5b8028e5 100644 --- a/swaybar/bar.c +++ b/swaybar/bar.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include "ipc-client.h" | 25 | #include "ipc-client.h" |
26 | #include "list.h" | 26 | #include "list.h" |
27 | #include "log.h" | 27 | #include "log.h" |
28 | #include "pango.h" | ||
29 | #include "pool-buffer.h" | 28 | #include "pool-buffer.h" |
30 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" | 29 | #include "wlr-layer-shell-unstable-v1-client-protocol.h" |
31 | 30 | ||
@@ -34,6 +33,15 @@ static void bar_init(struct swaybar *bar) { | |||
34 | wl_list_init(&bar->outputs); | 33 | wl_list_init(&bar->outputs); |
35 | } | 34 | } |
36 | 35 | ||
36 | void free_workspaces(struct wl_list *list) { | ||
37 | struct swaybar_workspace *ws, *tmp; | ||
38 | wl_list_for_each_safe(ws, tmp, list, link) { | ||
39 | wl_list_remove(&ws->link); | ||
40 | free(ws->name); | ||
41 | free(ws); | ||
42 | } | ||
43 | } | ||
44 | |||
37 | static void swaybar_output_free(struct swaybar_output *output) { | 45 | static void swaybar_output_free(struct swaybar_output *output) { |
38 | if (!output) { | 46 | if (!output) { |
39 | return; | 47 | return; |
@@ -44,12 +52,7 @@ static void swaybar_output_free(struct swaybar_output *output) { | |||
44 | wl_output_destroy(output->output); | 52 | wl_output_destroy(output->output); |
45 | destroy_buffer(&output->buffers[0]); | 53 | destroy_buffer(&output->buffers[0]); |
46 | destroy_buffer(&output->buffers[1]); | 54 | destroy_buffer(&output->buffers[1]); |
47 | struct swaybar_workspace *ws, *ws_tmp; | 55 | free_workspaces(&output->workspaces); |
48 | wl_list_for_each_safe(ws, ws_tmp, &output->workspaces, link) { | ||
49 | wl_list_remove(&ws->link); | ||
50 | free(ws->name); | ||
51 | free(ws); | ||
52 | } | ||
53 | struct swaybar_hotspot *hotspot, *hotspot_tmp; | 56 | struct swaybar_hotspot *hotspot, *hotspot_tmp; |
54 | wl_list_for_each_safe(hotspot, hotspot_tmp, &output->hotspots, link) { | 57 | wl_list_for_each_safe(hotspot, hotspot_tmp, &output->hotspots, link) { |
55 | if (hotspot->destroy) { | 58 | if (hotspot->destroy) { |
@@ -468,9 +471,7 @@ void bar_run(struct swaybar *bar) { | |||
468 | static void free_outputs(struct wl_list *list) { | 471 | static void free_outputs(struct wl_list *list) { |
469 | struct swaybar_output *output, *tmp; | 472 | struct swaybar_output *output, *tmp; |
470 | wl_list_for_each_safe(output, tmp, list, link) { | 473 | wl_list_for_each_safe(output, tmp, list, link) { |
471 | wl_list_remove(&output->link); | 474 | swaybar_output_free(output); |
472 | free(output->name); | ||
473 | free(output); | ||
474 | } | 475 | } |
475 | } | 476 | } |
476 | 477 | ||