diff options
author | Luminarys <[email protected]> | 2015-08-20 11:30:32 -0500 |
---|---|---|
committer | Luminarys <[email protected]> | 2015-08-20 11:30:32 -0500 |
commit | bc3babf566f1f8ad9db4d1f7b70a859f54ba6c48 (patch) | |
tree | 2de760a0246bc071f561065bc46c4c1007b5e10e /sway/layout.c | |
parent | 15d9f1edcb69fec18104fc5d40780cf1306731ef (diff) |
Added in basic resize command
Diffstat (limited to 'sway/layout.c')
-rw-r--r-- | sway/layout.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/sway/layout.c b/sway/layout.c index 78b3dd27..b70e1041 100644 --- a/sway/layout.c +++ b/sway/layout.c @@ -370,3 +370,35 @@ swayc_t *get_swayc_in_direction(swayc_t *container, enum movement_direction dir) } } } + +void recursive_resize(swayc_t *container, double amount, enum movement_direction dir) { + int i; + bool layout_match = true; + if (dir == MOVE_LEFT) { + container->x += (int) amount; + container->width += (int) amount; + layout_match = container->layout == L_HORIZ; + } else if(dir == MOVE_RIGHT) { + container->width += (int) amount; + layout_match = container->layout == L_HORIZ; + } else if(dir == MOVE_UP) { + container->y += (int) amount; + container->height += (int) amount; + layout_match = container->layout == L_VERT; + } else if(dir == MOVE_DOWN) { + container->height += (int) amount; + layout_match = container->layout == L_VERT; + } + if (container->type == C_VIEW) { + return; + } + if (layout_match) { + for (i = 0; i < container->children->length; i++) { + recursive_resize(container->children->items[i], amount/container->children->length, dir); + } + } else { + for (i = 0; i < container->children->length; i++) { + recursive_resize(container->children->items[i], amount, dir); + } + } +} |