summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-16 14:30:31 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-07-16 14:30:31 +1000
commitbe28c18ad5a3271aad537a5356662d57f16d9703 (patch)
tree3b83225ea6ccb895c7ac83e0f9f578317a88e3e0
parentUpdate workspace urgent state when views close or move workspaces (diff)
downloadsway-be28c18ad5a3271aad537a5356662d57f16d9703.tar.gz
sway-be28c18ad5a3271aad537a5356662d57f16d9703.tar.zst
sway-be28c18ad5a3271aad537a5356662d57f16d9703.zip
Mark containers as urgent in IPC if they have urgent views
-rw-r--r--include/sway/tree/container.h2
-rw-r--r--sway/ipc-json.c7
-rw-r--r--sway/tree/container.c9
-rw-r--r--sway/tree/workspace.c7
4 files changed, 15 insertions, 10 deletions
diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h
index 04e50fc6..ca7a3288 100644
--- a/include/sway/tree/container.h
+++ b/include/sway/tree/container.h
@@ -316,4 +316,6 @@ void container_floating_move_to(struct sway_container *con,
316 */ 316 */
317void container_set_dirty(struct sway_container *container); 317void container_set_dirty(struct sway_container *container);
318 318
319bool container_has_urgent_child(struct sway_container *container);
320
319#endif 321#endif
diff --git a/sway/ipc-json.c b/sway/ipc-json.c
index dbab8e68..c49ea47e 100644
--- a/sway/ipc-json.c
+++ b/sway/ipc-json.c
@@ -198,10 +198,9 @@ static void ipc_json_describe_view(struct sway_container *c, json_object *object
198 json_object_new_string(ipc_json_layout_description(c->layout))); 198 json_object_new_string(ipc_json_layout_description(c->layout)));
199 } 199 }
200 200
201 if (c->type == C_VIEW) { 201 bool urgent = c->type == C_VIEW ?
202 json_object_object_add(object, "urgent", 202 view_is_urgent(c->sway_view) : container_has_urgent_child(c);
203 json_object_new_boolean(view_is_urgent(c->sway_view))); 203 json_object_object_add(object, "urgent", json_object_new_boolean(urgent));
204 }
205} 204}
206 205
207static void focus_inactive_children_iterator(struct sway_container *c, void *data) { 206static void focus_inactive_children_iterator(struct sway_container *c, void *data) {
diff --git a/sway/tree/container.c b/sway/tree/container.c
index c1de46b5..6d52c38c 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -1082,3 +1082,12 @@ void container_set_dirty(struct sway_container *container) {
1082 container->dirty = true; 1082 container->dirty = true;
1083 list_add(server.dirty_containers, container); 1083 list_add(server.dirty_containers, container);
1084} 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}
diff --git a/sway/tree/workspace.c b/sway/tree/workspace.c
index d14f01eb..00b479ec 100644
--- a/sway/tree/workspace.c
+++ b/sway/tree/workspace.c
@@ -520,13 +520,8 @@ struct sway_container *workspace_output_get_highest_available(
520 return NULL; 520 return NULL;
521} 521}
522 522
523static bool find_urgent_iterator(struct sway_container *con,
524 void *data) {
525 return con->type == C_VIEW && view_is_urgent(con->sway_view);
526}
527
528void workspace_detect_urgent(struct sway_container *workspace) { 523void workspace_detect_urgent(struct sway_container *workspace) {
529 bool new_urgent = container_find(workspace, find_urgent_iterator, NULL); 524 bool new_urgent = container_has_urgent_child(workspace);
530 525
531 if (workspace->sway_workspace->urgent != new_urgent) { 526 if (workspace->sway_workspace->urgent != new_urgent) {
532 workspace->sway_workspace->urgent = new_urgent; 527 workspace->sway_workspace->urgent = new_urgent;