diff options
-rw-r--r-- | include/sway/output.h | 2 | ||||
-rw-r--r-- | include/sway/tree/layout.h | 2 | ||||
-rw-r--r-- | sway/commands/output.c | 5 | ||||
-rw-r--r-- | sway/desktop/output.c | 15 | ||||
-rw-r--r-- | sway/ipc-server.c | 5 | ||||
-rw-r--r-- | sway/tree/layout.c | 2 |
6 files changed, 12 insertions, 19 deletions
diff --git a/include/sway/output.h b/include/sway/output.h index 22c84039..70f746dc 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -29,6 +29,8 @@ struct sway_output { | |||
29 | struct wl_listener damage_destroy; | 29 | struct wl_listener damage_destroy; |
30 | struct wl_listener damage_frame; | 30 | struct wl_listener damage_frame; |
31 | 31 | ||
32 | struct wl_list link; | ||
33 | |||
32 | pid_t bg_pid; | 34 | pid_t bg_pid; |
33 | }; | 35 | }; |
34 | 36 | ||
diff --git a/include/sway/tree/layout.h b/include/sway/tree/layout.h index 069a02cc..cd131056 100644 --- a/include/sway/tree/layout.h +++ b/include/sway/tree/layout.h | |||
@@ -31,7 +31,7 @@ struct sway_root { | |||
31 | 31 | ||
32 | struct wlr_texture *debug_tree; | 32 | struct wlr_texture *debug_tree; |
33 | 33 | ||
34 | list_t *outputs; | 34 | struct wl_list outputs; // sway_output::link |
35 | 35 | ||
36 | struct { | 36 | struct { |
37 | struct wl_signal new_container; | 37 | struct wl_signal new_container; |
diff --git a/sway/commands/output.c b/sway/commands/output.c index 6c789cc9..f955bf90 100644 --- a/sway/commands/output.c +++ b/sway/commands/output.c | |||
@@ -82,9 +82,8 @@ struct cmd_results *cmd_output(int argc, char **argv) { | |||
82 | // will be applied during normal "new output" event from wlroots. | 82 | // will be applied during normal "new output" event from wlroots. |
83 | char identifier[128]; | 83 | char identifier[128]; |
84 | bool all = strcmp(output->name, "*") == 0; | 84 | bool all = strcmp(output->name, "*") == 0; |
85 | list_t *sway_outputs = root_container.sway_root->outputs; | 85 | struct sway_output *sway_output; |
86 | for (int i = 0; i < sway_outputs->length; ++i) { | 86 | wl_list_for_each(sway_output, &root_container.sway_root->outputs, link) { |
87 | struct sway_output *sway_output = sway_outputs->items[i]; | ||
88 | output_get_identifier(identifier, sizeof(identifier), sway_output); | 87 | output_get_identifier(identifier, sizeof(identifier), sway_output); |
89 | wlr_log(L_DEBUG, "Checking identifier %s", identifier); | 88 | wlr_log(L_DEBUG, "Checking identifier %s", identifier); |
90 | if (all || strcmp(sway_output->wlr_output->name, output->name) == 0 | 89 | if (all || strcmp(sway_output->wlr_output->name, output->name) == 0 |
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index cb53a980..3142bdb4 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -1157,10 +1157,6 @@ void output_damage_whole_container(struct sway_output *output, | |||
1157 | wlr_output_damage_add_box(output->damage, &box); | 1157 | wlr_output_damage_add_box(output->damage, &box); |
1158 | } | 1158 | } |
1159 | 1159 | ||
1160 | static int find_output(const void *output1, const void *output2) { | ||
1161 | return output1 == output2 ? 0 : 1; | ||
1162 | } | ||
1163 | |||
1164 | static void damage_handle_destroy(struct wl_listener *listener, void *data) { | 1160 | static void damage_handle_destroy(struct wl_listener *listener, void *data) { |
1165 | struct sway_output *output = | 1161 | struct sway_output *output = |
1166 | wl_container_of(listener, output, damage_destroy); | 1162 | wl_container_of(listener, output, damage_destroy); |
@@ -1172,12 +1168,9 @@ static void handle_destroy(struct wl_listener *listener, void *data) { | |||
1172 | if (output->swayc) { | 1168 | if (output->swayc) { |
1173 | container_destroy(output->swayc); | 1169 | container_destroy(output->swayc); |
1174 | } | 1170 | } |
1175 | int index = list_seq_find(root_container.sway_root->outputs, find_output, | 1171 | |
1176 | output); | 1172 | if (&output->link) { |
1177 | if (index >= 0 && index < root_container.sway_root->outputs->length) { | 1173 | wl_list_remove(&output->link); |
1178 | wlr_log(L_DEBUG, "Removing %s from outputs list", | ||
1179 | output->wlr_output->name); | ||
1180 | list_del(root_container.sway_root->outputs, index); | ||
1181 | wl_list_remove(&output->destroy.link); | 1174 | wl_list_remove(&output->destroy.link); |
1182 | output->wlr_output = NULL; | 1175 | output->wlr_output = NULL; |
1183 | free(output); | 1176 | free(output); |
@@ -1219,7 +1212,7 @@ void handle_new_output(struct wl_listener *listener, void *data) { | |||
1219 | output->wlr_output = wlr_output; | 1212 | output->wlr_output = wlr_output; |
1220 | wlr_output->data = output; | 1213 | wlr_output->data = output; |
1221 | output->server = server; | 1214 | output->server = server; |
1222 | list_add(root_container.sway_root->outputs, output); | 1215 | wl_list_insert(&root_container.sway_root->outputs, &output->link); |
1223 | 1216 | ||
1224 | output->damage = wlr_output_damage_create(wlr_output); | 1217 | output->damage = wlr_output_damage_create(wlr_output); |
1225 | 1218 | ||
diff --git a/sway/ipc-server.c b/sway/ipc-server.c index 2a2346b4..241fe742 100644 --- a/sway/ipc-server.c +++ b/sway/ipc-server.c | |||
@@ -489,9 +489,8 @@ void ipc_client_handle_command(struct ipc_client *client) { | |||
489 | ipc_json_describe_container(container)); | 489 | ipc_json_describe_container(container)); |
490 | } | 490 | } |
491 | } | 491 | } |
492 | for (int i = 0; i < root_container.sway_root->outputs->length; ++i) { | 492 | struct sway_output *output; |
493 | struct sway_output *output = | 493 | wl_list_for_each(output, &root_container.sway_root->outputs, link) { |
494 | root_container.sway_root->outputs->items[i]; | ||
495 | if (!output->swayc) { | 494 | if (!output->swayc) { |
496 | json_object_array_add(outputs, | 495 | json_object_array_add(outputs, |
497 | ipc_json_describe_disabled_output(output)); | 496 | ipc_json_describe_disabled_output(output)); |
diff --git a/sway/tree/layout.c b/sway/tree/layout.c index ce53a515..b54dc2fe 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c | |||
@@ -35,7 +35,7 @@ void layout_init(void) { | |||
35 | 35 | ||
36 | root_container.sway_root = calloc(1, sizeof(*root_container.sway_root)); | 36 | root_container.sway_root = calloc(1, sizeof(*root_container.sway_root)); |
37 | root_container.sway_root->output_layout = wlr_output_layout_create(); | 37 | root_container.sway_root->output_layout = wlr_output_layout_create(); |
38 | root_container.sway_root->outputs = create_list(); | 38 | wl_list_init(&root_container.sway_root->outputs); |
39 | wl_list_init(&root_container.sway_root->xwayland_unmanaged); | 39 | wl_list_init(&root_container.sway_root->xwayland_unmanaged); |
40 | wl_signal_init(&root_container.sway_root->events.new_container); | 40 | wl_signal_init(&root_container.sway_root->events.new_container); |
41 | 41 | ||