diff options
author | Drew DeVault <[email protected]> | 2018-09-05 09:33:27 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2018-09-05 09:33:27 -0400 |
commit | 610eb946171f782165a20614b2d3318b89273990 (patch) | |
tree | 05eec1df1ef48e05b23d273d31143ad32e7632d2 /sway/commands/kill.c | |
parent | aa2bf98e0442f9bf41a852c2fafee5b0897010a2 (diff) | |
parent | dbf4aa3e33bdee53876c6893b15ac3f224818e7c (diff) |
Merge pull request #2540 from RyanDwyer/typesafety
Implement type safe arguments and demote sway_container
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 @@ #include "log.h" #include "sway/input/input-manager.h" #include "sway/input/seat.h" -#include "sway/tree/view.h" #include "sway/tree/container.h" +#include "sway/tree/view.h" +#include "sway/tree/workspace.h" #include "sway/commands.h" +static void close_container_iterator(struct sway_container *con, void *data) { + if (con->view) { + view_close(con->view); + } +} + struct cmd_results *cmd_kill(int argc, char **argv) { - struct sway_container *con = - config->handler_context.current_container; + struct sway_container *con = config->handler_context.container; + struct sway_workspace *ws = config->handler_context.workspace; - container_close(con); + if (con) { + close_container_iterator(con, NULL); + container_for_each_child(con, close_container_iterator, NULL); + } else { + workspace_for_each_container(ws, close_container_iterator, NULL); + } return cmd_results_new(CMD_SUCCESS, NULL, NULL); } |