diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-01-21 08:46:31 -0500 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-01-21 08:46:31 -0500 |
commit | 1156523ccf8b45102333cca7d80b3451930b48e8 (patch) | |
tree | 9ffcf90b69ee2940862c1add1f2fdf02dcd24da9 /sway/commands | |
parent | 6a1d71b8b8f33bdea3fb41bcd0de9439c0452682 (diff) |
run all commands with focused container context
Diffstat (limited to 'sway/commands')
-rw-r--r-- | sway/commands/kill.c | 28 |
1 files changed, 10 insertions, 18 deletions
diff --git a/sway/commands/kill.c b/sway/commands/kill.c index f0e3722a..a04c21f3 100644 --- a/sway/commands/kill.c +++ b/sway/commands/kill.c @@ -1,29 +1,21 @@ +#include <wlr/util/log.h> #include "sway/input/input-manager.h" #include "sway/input/seat.h" #include "sway/view.h" #include "sway/commands.h" struct cmd_results *cmd_kill(int argc, char **argv) { - struct sway_seat *seat = config->handler_context.seat; - if (!seat) { - seat = sway_input_manager_get_default_seat(input_manager); + if (!config->handler_context.current_container) { + wlr_log(L_ERROR, "cmd_kill called without container context"); + return cmd_results_new(CMD_INVALID, NULL, + "cmd_kill called without container context " + "(this is a bug in sway)"); } + // TODO close arbitrary containers without a view + struct sway_view *view = + config->handler_context.current_container->sway_view; - // TODO context for arbitrary sway containers (when we get criteria - // working) will make seat context not explicitly required - if (!seat) { - return cmd_results_new(CMD_FAILURE, NULL, "no seat context given"); - } - - struct sway_view *view = NULL; - - if (config->handler_context.current_container) { - view = config->handler_context.current_container->sway_view; - } else { - view = seat->focus->sway_view; - } - - if (view->iface.close) { + if (view && view->iface.close) { view->iface.close(view); } |