basic split containers

This commit is contained in:
Tony Crisci 2018-03-31 00:44:17 -04:00
parent 122b96abed
commit 7706d83160
10 changed files with 245 additions and 51 deletions

View file

@ -3,21 +3,30 @@
#include "sway/input/input-manager.h"
#include "sway/input/seat.h"
#include "sway/tree/view.h"
#include "sway/tree/container.h"
#include "sway/commands.h"
struct cmd_results *cmd_kill(int argc, char **argv) {
enum sway_container_type type = config->handler_context.current_container->type;
if (type != C_VIEW && type != C_CONTAINER) {
struct sway_container *con =
config->handler_context.current_container;
switch (con->type) {
case C_ROOT:
case C_OUTPUT:
case C_WORKSPACE:
return cmd_results_new(CMD_INVALID, NULL,
"Can only kill views and containers with this command");
}
// TODO close arbitrary containers without a view
struct sway_view *view =
config->handler_context.current_container->sway_view;
if (view) {
view_close(view);
break;
case C_CONTAINER:
con = container_destroy(con);
con = container_reap_empty(con);
arrange_windows(con, -1, -1);
break;
case C_VIEW:
view_close(con->sway_view);
break;
default:
break;
}
return cmd_results_new(CMD_SUCCESS, NULL, NULL);