Validate matched containers for "kill" command correctly.

We now execute the validations when "kill" is executed even if match
criteria are used. This prevents users from killing workspace containers,
which instead kills all clients (as before when not using criteria).

fixes #1761
This commit is contained in:
Ingo Bürk
2015-12-27 22:11:51 -05:00
parent 0dd71674de
commit 19c273a2ad
6 changed files with 44 additions and 44 deletions

View File

@ -1258,7 +1258,6 @@ void cmd_split(I3_CMD, const char *direction) {
void cmd_kill(I3_CMD, const char *kill_mode_str) {
if (kill_mode_str == NULL)
kill_mode_str = "window";
owindow *current;
DLOG("kill_mode=%s\n", kill_mode_str);
@ -1273,16 +1272,11 @@ void cmd_kill(I3_CMD, const char *kill_mode_str) {
return;
}
HANDLE_INVALID_MATCH;
HANDLE_EMPTY_MATCH;
/* check if the match is empty, not if the result is empty */
if (match_is_empty(current_match))
tree_close_con(kill_mode);
else {
TAILQ_FOREACH(current, &owindows, owindows) {
DLOG("matching: %p / %s\n", current->con, current->con->name);
tree_close_internal(current->con, kill_mode, false, false);
}
owindow *current;
TAILQ_FOREACH(current, &owindows, owindows) {
con_close(current->con, kill_mode);
}
cmd_output->needs_tree_render = true;