From dbad30a409b83d2e327e5eb2a53b46f12e462258 Mon Sep 17 00:00:00 2001 From: taiyu Date: Mon, 24 Aug 2015 01:11:21 -0700 Subject: add limit to swayc_in_direction --- sway/layout.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'sway/layout.c') 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; -- cgit v1.2.3