aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/container.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r--sway/tree/container.c58
1 files changed, 37 insertions, 21 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 58852717..6d52c38c 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -159,14 +159,6 @@ void container_free(struct sway_container *cont) {
159 wlr_texture_destroy(cont->title_focused_inactive); 159 wlr_texture_destroy(cont->title_focused_inactive);
160 wlr_texture_destroy(cont->title_unfocused); 160 wlr_texture_destroy(cont->title_unfocused);
161 wlr_texture_destroy(cont->title_urgent); 161 wlr_texture_destroy(cont->title_urgent);
162
163 for (int i = 0; i < server.destroying_containers->length; ++i) {
164 if (server.destroying_containers->items[i] == cont) {
165 list_del(server.destroying_containers, i);
166 break;
167 }
168 }
169
170 list_free(cont->instructions); 162 list_free(cont->instructions);
171 list_free(cont->children); 163 list_free(cont->children);
172 list_free(cont->current.children); 164 list_free(cont->current.children);
@@ -325,7 +317,7 @@ static struct sway_container *container_destroy_noreaping(
325 } 317 }
326 318
327 con->destroying = true; 319 con->destroying = true;
328 list_add(server.destroying_containers, con); 320 container_set_dirty(con);
329 321
330 if (!con->parent) { 322 if (!con->parent) {
331 return NULL; 323 return NULL;
@@ -682,16 +674,23 @@ struct sway_container *floating_container_at(double lx, double ly,
682void container_for_each_descendant_dfs(struct sway_container *container, 674void container_for_each_descendant_dfs(struct sway_container *container,
683 void (*f)(struct sway_container *container, void *data), 675 void (*f)(struct sway_container *container, void *data),
684 void *data) { 676 void *data) {
685 if (container) { 677 if (!container) {
686 if (container->children) { 678 return;
687 for (int i = 0; i < container->children->length; ++i) { 679 }
688 struct sway_container *child = 680 if (container->children) {
689 container->children->items[i]; 681 for (int i = 0; i < container->children->length; ++i) {
690 container_for_each_descendant_dfs(child, f, data); 682 struct sway_container *child = container->children->items[i];
691 } 683 container_for_each_descendant_dfs(child, f, data);
684 }
685 }
686 if (container->type == C_WORKSPACE) {
687 struct sway_container *floating = container->sway_workspace->floating;
688 for (int i = 0; i < floating->children->length; ++i) {
689 struct sway_container *child = floating->children->items[i];
690 container_for_each_descendant_dfs(child, f, data);
692 } 691 }
693 f(container, data);
694 } 692 }
693 f(container, data);
695} 694}
696 695
697void container_for_each_descendant_bfs(struct sway_container *con, 696void container_for_each_descendant_bfs(struct sway_container *con,
@@ -1069,9 +1068,26 @@ void container_floating_move_to(struct sway_container *con,
1069 if (old_workspace != new_workspace) { 1068 if (old_workspace != new_workspace) {
1070 container_remove_child(con); 1069 container_remove_child(con);
1071 container_add_child(new_workspace->sway_workspace->floating, con); 1070 container_add_child(new_workspace->sway_workspace->floating, con);
1072 struct sway_transaction *transaction = transaction_create(); 1071 arrange_windows(old_workspace);
1073 arrange_windows(old_workspace, transaction); 1072 arrange_windows(new_workspace);
1074 arrange_windows(new_workspace, transaction); 1073 workspace_detect_urgent(old_workspace);
1075 transaction_commit(transaction); 1074 workspace_detect_urgent(new_workspace);
1076 } 1075 }
1077} 1076}
1077
1078void container_set_dirty(struct sway_container *container) {
1079 if (container->dirty) {
1080 return;
1081 }
1082 container->dirty = true;
1083 list_add(server.dirty_containers, container);
1084}
1085
1086static bool find_urgent_iterator(struct sway_container *con,
1087 void *data) {
1088 return con->type == C_VIEW && view_is_urgent(con->sway_view);
1089}
1090
1091bool container_has_urgent_child(struct sway_container *container) {
1092 return container_find(container, find_urgent_iterator, NULL);
1093}