aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/container.c
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2018-07-16 15:39:08 -0700
committerLibravatar GitHub <noreply@github.com>2018-07-16 15:39:08 -0700
commitd6bd314dffb7385eec73de40f0fdd5775cd5941b (patch)
tree1cec389e971cda3e42766c07789d0f51c2d39715 /sway/tree/container.c
parentMerge pull request #2265 from RedSoxFan/implement-1962 (diff)
parentswaybar: Read urgent colors from IPC (diff)
downloadsway-d6bd314dffb7385eec73de40f0fdd5775cd5941b.tar.gz
sway-d6bd314dffb7385eec73de40f0fdd5775cd5941b.tar.zst
sway-d6bd314dffb7385eec73de40f0fdd5775cd5941b.zip
Merge pull request #2276 from RyanDwyer/urgency
Implement urgency base functionality
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r--sway/tree/container.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 35f67cce..6d52c38c 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -674,16 +674,23 @@ struct sway_container *floating_container_at(double lx, double ly,
674void container_for_each_descendant_dfs(struct sway_container *container, 674void container_for_each_descendant_dfs(struct sway_container *container,
675 void (*f)(struct sway_container *container, void *data), 675 void (*f)(struct sway_container *container, void *data),
676 void *data) { 676 void *data) {
677 if (container) { 677 if (!container) {
678 if (container->children) { 678 return;
679 for (int i = 0; i < container->children->length; ++i) { 679 }
680 struct sway_container *child = 680 if (container->children) {
681 container->children->items[i]; 681 for (int i = 0; i < container->children->length; ++i) {
682 container_for_each_descendant_dfs(child, f, data); 682 struct sway_container *child = container->children->items[i];
683 } 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);
684 } 691 }
685 f(container, data);
686 } 692 }
693 f(container, data);
687} 694}
688 695
689void container_for_each_descendant_bfs(struct sway_container *con, 696void container_for_each_descendant_bfs(struct sway_container *con,
@@ -1063,6 +1070,8 @@ void container_floating_move_to(struct sway_container *con,
1063 container_add_child(new_workspace->sway_workspace->floating, con); 1070 container_add_child(new_workspace->sway_workspace->floating, con);
1064 arrange_windows(old_workspace); 1071 arrange_windows(old_workspace);
1065 arrange_windows(new_workspace); 1072 arrange_windows(new_workspace);
1073 workspace_detect_urgent(old_workspace);
1074 workspace_detect_urgent(new_workspace);
1066 } 1075 }
1067} 1076}
1068 1077
@@ -1073,3 +1082,12 @@ void container_set_dirty(struct sway_container *container) {
1073 container->dirty = true; 1082 container->dirty = true;
1074 list_add(server.dirty_containers, container); 1083 list_add(server.dirty_containers, container);
1075} 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}