diff options
Diffstat (limited to 'sway/commands/kill.c')
-rw-r--r-- | sway/commands/kill.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/sway/commands/kill.c b/sway/commands/kill.c index f3fa52f1..85ca0f33 100644 --- a/sway/commands/kill.c +++ b/sway/commands/kill.c | |||
@@ -2,15 +2,27 @@ | |||
2 | #include "log.h" | 2 | #include "log.h" |
3 | #include "sway/input/input-manager.h" | 3 | #include "sway/input/input-manager.h" |
4 | #include "sway/input/seat.h" | 4 | #include "sway/input/seat.h" |
5 | #include "sway/tree/view.h" | ||
6 | #include "sway/tree/container.h" | 5 | #include "sway/tree/container.h" |
6 | #include "sway/tree/view.h" | ||
7 | #include "sway/tree/workspace.h" | ||
7 | #include "sway/commands.h" | 8 | #include "sway/commands.h" |
8 | 9 | ||
10 | static void close_container_iterator(struct sway_container *con, void *data) { | ||
11 | if (con->view) { | ||
12 | view_close(con->view); | ||
13 | } | ||
14 | } | ||
15 | |||
9 | struct cmd_results *cmd_kill(int argc, char **argv) { | 16 | struct cmd_results *cmd_kill(int argc, char **argv) { |
10 | struct sway_container *con = | 17 | struct sway_container *con = config->handler_context.container; |
11 | config->handler_context.current_container; | 18 | struct sway_workspace *ws = config->handler_context.workspace; |
12 | 19 | ||
13 | container_close(con); | 20 | if (con) { |
21 | close_container_iterator(con, NULL); | ||
22 | container_for_each_child(con, close_container_iterator, NULL); | ||
23 | } else { | ||
24 | workspace_for_each_container(ws, close_container_iterator, NULL); | ||
25 | } | ||
14 | 26 | ||
15 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); | 27 | return cmd_results_new(CMD_SUCCESS, NULL, NULL); |
16 | } | 28 | } |