aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/kill.c
diff options
context:
space:
mode:
authorLibravatar Tony Crisci <tony@dubstepdish.com>2018-01-21 08:46:31 -0500
committerLibravatar Tony Crisci <tony@dubstepdish.com>2018-01-21 08:46:31 -0500
commit1156523ccf8b45102333cca7d80b3451930b48e8 (patch)
tree9ffcf90b69ee2940862c1add1f2fdf02dcd24da9 /sway/commands/kill.c
parentbasic command criteria (diff)
downloadsway-1156523ccf8b45102333cca7d80b3451930b48e8.tar.gz
sway-1156523ccf8b45102333cca7d80b3451930b48e8.tar.zst
sway-1156523ccf8b45102333cca7d80b3451930b48e8.zip
run all commands with focused container context
Diffstat (limited to 'sway/commands/kill.c')
-rw-r--r--sway/commands/kill.c28
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 @@
1#include <wlr/util/log.h>
1#include "sway/input/input-manager.h" 2#include "sway/input/input-manager.h"
2#include "sway/input/seat.h" 3#include "sway/input/seat.h"
3#include "sway/view.h" 4#include "sway/view.h"
4#include "sway/commands.h" 5#include "sway/commands.h"
5 6
6struct cmd_results *cmd_kill(int argc, char **argv) { 7struct cmd_results *cmd_kill(int argc, char **argv) {
7 struct sway_seat *seat = config->handler_context.seat; 8 if (!config->handler_context.current_container) {
8 if (!seat) { 9 wlr_log(L_ERROR, "cmd_kill called without container context");
9 seat = sway_input_manager_get_default_seat(input_manager); 10 return cmd_results_new(CMD_INVALID, NULL,
11 "cmd_kill called without container context "
12 "(this is a bug in sway)");
10 } 13 }
14 // TODO close arbitrary containers without a view
15 struct sway_view *view =
16 config->handler_context.current_container->sway_view;
11 17
12 // TODO context for arbitrary sway containers (when we get criteria 18 if (view && view->iface.close) {
13 // working) will make seat context not explicitly required
14 if (!seat) {
15 return cmd_results_new(CMD_FAILURE, NULL, "no seat context given");
16 }
17
18 struct sway_view *view = NULL;
19
20 if (config->handler_context.current_container) {
21 view = config->handler_context.current_container->sway_view;
22 } else {
23 view = seat->focus->sway_view;
24 }
25
26 if (view->iface.close) {
27 view->iface.close(view); 19 view->iface.close(view);
28 } 20 }
29 21