diff options
author | 2015-08-20 11:30:32 -0500 | |
---|---|---|
committer | 2015-08-20 11:30:32 -0500 | |
commit | bc3babf566f1f8ad9db4d1f7b70a859f54ba6c48 (patch) | |
tree | 2de760a0246bc071f561065bc46c4c1007b5e10e /sway/layout.c | |
parent | Added in basic resize command (diff) | |
download | sway-bc3babf566f1f8ad9db4d1f7b70a859f54ba6c48.tar.gz sway-bc3babf566f1f8ad9db4d1f7b70a859f54ba6c48.tar.zst sway-bc3babf566f1f8ad9db4d1f7b70a859f54ba6c48.zip |
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) | |||
370 | } | 370 | } |
371 | } | 371 | } |
372 | } | 372 | } |
373 | |||
374 | void recursive_resize(swayc_t *container, double amount, enum movement_direction dir) { | ||
375 | int i; | ||
376 | bool layout_match = true; | ||
377 | if (dir == MOVE_LEFT) { | ||
378 | container->x += (int) amount; | ||
379 | container->width += (int) amount; | ||
380 | layout_match = container->layout == L_HORIZ; | ||
381 | } else if(dir == MOVE_RIGHT) { | ||
382 | container->width += (int) amount; | ||
383 | layout_match = container->layout == L_HORIZ; | ||
384 | } else if(dir == MOVE_UP) { | ||
385 | container->y += (int) amount; | ||
386 | container->height += (int) amount; | ||
387 | layout_match = container->layout == L_VERT; | ||
388 | } else if(dir == MOVE_DOWN) { | ||
389 | container->height += (int) amount; | ||
390 | layout_match = container->layout == L_VERT; | ||
391 | } | ||
392 | if (container->type == C_VIEW) { | ||
393 | return; | ||
394 | } | ||
395 | if (layout_match) { | ||
396 | for (i = 0; i < container->children->length; i++) { | ||
397 | recursive_resize(container->children->items[i], amount/container->children->length, dir); | ||
398 | } | ||
399 | } else { | ||
400 | for (i = 0; i < container->children->length; i++) { | ||
401 | recursive_resize(container->children->items[i], amount, dir); | ||
402 | } | ||
403 | } | ||
404 | } | ||