diff options
author | taiyu <taiyu.len@gmail.com> | 2015-08-24 01:11:21 -0700 |
---|---|---|
committer | taiyu <taiyu.len@gmail.com> | 2015-08-24 01:11:21 -0700 |
commit | dbad30a409b83d2e327e5eb2a53b46f12e462258 (patch) | |
tree | beedc915a86c4a1109fd0cf4de7961642ccd8354 /sway/layout.c | |
parent | b054ac9d4973c8803ff8981eb1f1a754434efe4d (diff) |
add limit to swayc_in_direction
Diffstat (limited to 'sway/layout.c')
-rw-r--r-- | sway/layout.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sway/layout.c b/sway/layout.c index bc12b9b1..a37e137c 100644 --- a/sway/layout.c +++ b/sway/layout.c @@ -353,8 +353,7 @@ void arrange_windows(swayc_t *container, double width, double height) { layout_log(&root_container, 0); } - -swayc_t *get_swayc_in_direction(swayc_t *container, enum movement_direction dir) { +swayc_t *get_swayc_in_direction_under(swayc_t *container, enum movement_direction dir, swayc_t *limit) { swayc_t *parent = container->parent; if (dir == MOVE_PARENT) { @@ -453,7 +452,7 @@ swayc_t *get_swayc_in_direction(swayc_t *container, enum movement_direction dir) if (!can_move) { container = parent; parent = parent->parent; - if (!parent) { + if (!parent || container == limit) { // Nothing we can do return NULL; } @@ -461,6 +460,10 @@ swayc_t *get_swayc_in_direction(swayc_t *container, enum movement_direction dir) } } +swayc_t *get_swayc_in_direction(swayc_t *container, enum movement_direction dir) { + return get_swayc_in_direction_under(container, dir, NULL); +} + void recursive_resize(swayc_t *container, double amount, enum wlc_resize_edge edge) { int i; bool layout_match = true; |