From 57954a2b24f1e211c3b8811fb898ef4e076cb098 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 2 Apr 2018 13:49:37 -0400 Subject: Implement move [left|right|up|down] The exact semantics of this command are complicated. I'll describe each test scenario as s-expressions. Everything assumes L_HORIZ if not specified, but if you rotate everything 90 degrees the same test cases hold. ``` (container (view a) (view b focus) (view c)) -> move left (container (view b focus) (view a) (view c)) (container (view a) (view b focus) (view c)) -> move right (container (view a) (view c) (view b focus)) (container L_VERT (view a)) (container L_HORIZ (view b) (view c focus)) -> move up (container L_VERT (view a) (view c focus)) (container L_HORIZ (view b)) (workspace (view a) (view b focus) (view c)) -> move up (workspace [split direction flipped] (view b focus) (container (view a) (view c))) (workspace (view a) (view b focus) (view c)) -> move down (workspace [split direction flipped] (container (view a) (view c)) (view b focus))) Note: outputs use wlr_output_layout instead of assuming that i+/-1 is the next output in the move direction. (root (output X11-1 (workspace 1)) (output X11-2 (workspace 1 (view a focus) (view b))))) -> move left (root (output X11-1 (workspace 1 (view a focus))) (output X11-2 (workspace 1 (view b))))) (root (output X11-1 (workspace 1 (container (view a) (view b))) (output X11-2 (workspace 1 (view c focus))))) -> move left (root (output X11-1 (workspace 1 (container (view a) (view b)) (view c focus))) (output X11-2 (workspace 1))) ``` --- include/sway/tree/container.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/sway/tree/container.h b/include/sway/tree/container.h index 4c60530f..2a8b8aba 100644 --- a/include/sway/tree/container.h +++ b/include/sway/tree/container.h @@ -182,4 +182,11 @@ void container_create_notify(struct sway_container *container); void container_damage_whole(struct sway_container *container); +bool container_reap_empty(struct sway_container *con); + +struct sway_container *container_reap_empty_recursive( + struct sway_container *con); + +struct sway_container *container_flatten(struct sway_container *container); + #endif -- cgit v1.2.3-54-g00ecf