aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-04-01 21:39:15 +0200
committerMikkel Oscar Lyderik <mikkeloscar@gmail.com>2016-04-25 00:00:49 +0200
commita0cebb7c5a0530414e85c85fb0231881f988df7c (patch)
treed2f58758747730cb79d5cc053b6b15300ea51fe8
parentd26658fb355fdf7feee2d6aa801e487502e6ce8b (diff)
Improve move command with tabbed/stacked layout
-rw-r--r--sway/debug_log.c1
-rw-r--r--sway/layout.c12
2 files changed, 9 insertions, 4 deletions
diff --git a/sway/debug_log.c b/sway/debug_log.c
index 761dca6c..f804a541 100644
--- a/sway/debug_log.c
+++ b/sway/debug_log.c
@@ -38,6 +38,7 @@ static void container_log(const swayc_t *c, int depth) {
c->layout == L_HORIZ ? "Horiz":
c->layout == L_VERT ? "Vert":
c->layout == L_STACKED ? "Stack":
+ c->layout == L_TABBED ? "Tab":
c->layout == L_FLOATING ? "Float":
"Unknown");
fprintf(stderr, "w:%4.f|h:%4.f|", c->width, c->height);
diff --git a/sway/layout.c b/sway/layout.c
index 261e2138..e9eb8add 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -244,7 +244,9 @@ void move_container(swayc_t *container, enum movement_direction dir) {
while (true) {
sway_log(L_DEBUG, "container:%p, parent:%p, child %p,",
container,parent,child);
- if (parent->layout == layout) {
+ if (parent->layout == layout
+ || (parent->layout == L_TABBED && layout == L_HORIZ)
+ || (parent->layout == L_STACKED && layout == L_VERT)) {
int diff;
// If it has ascended (parent has moved up), no container is removed
// so insert it at index, or index+1.
@@ -264,9 +266,11 @@ void move_container(swayc_t *container, enum movement_direction dir) {
// Move container into sibling container
if (child->type == C_CONTAINER) {
parent = child;
- // Insert it in first/last if matching layout,otherwise
+ // Insert it in first/last if matching layout, otherwise
// inesrt it next to focused container
- if (parent->layout == layout) {
+ if (parent->layout == layout
+ || (parent->layout == L_TABBED && layout == L_HORIZ)
+ || (parent->layout == L_STACKED && layout == L_VERT)) {
desired = (diff < 0) * parent->children->length;
} else {
desired = index_child(child->focused);
@@ -300,7 +304,7 @@ void move_container(swayc_t *container, enum movement_direction dir) {
parent = child->parent;
}
// Dirty hack to fix a certain case
- arrange_windows(parent, -1, -1);
+ /* arrange_windows(parent, -1, -1); */
arrange_windows(parent->parent, -1, -1);
set_focused_container_for(parent->parent, container);
}