diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-02-14 15:23:56 -0500 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-02-14 15:23:56 -0500 |
commit | 780d9fe1e3ee051a4d9eb08d1c049e19d72c1d6a (patch) | |
tree | 1bf03f3c77ee4b0fbb8d3ca0a7e0abb516814867 | |
parent | fix build for latest api (diff) | |
download | sway-780d9fe1e3ee051a4d9eb08d1c049e19d72c1d6a.tar.gz sway-780d9fe1e3ee051a4d9eb08d1c049e19d72c1d6a.tar.zst sway-780d9fe1e3ee051a4d9eb08d1c049e19d72c1d6a.zip |
cleanup layout.c
-rw-r--r-- | sway/tree/layout.c | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c index 205f42eb..5e8f4c56 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c | |||
@@ -173,8 +173,8 @@ void arrange_windows(swayc_t *container, double width, double height) { | |||
173 | height = floor(height); | 173 | height = floor(height); |
174 | 174 | ||
175 | wlr_log(L_DEBUG, "Arranging layout for %p %s %fx%f+%f,%f", container, | 175 | wlr_log(L_DEBUG, "Arranging layout for %p %s %fx%f+%f,%f", container, |
176 | container->name, container->width, container->height, container->x, | 176 | container->name, container->width, container->height, container->x, |
177 | container->y); | 177 | container->y); |
178 | 178 | ||
179 | double x = 0, y = 0; | 179 | double x = 0, y = 0; |
180 | switch (container->type) { | 180 | switch (container->type) { |
@@ -275,8 +275,8 @@ static void apply_horiz_layout(swayc_t *container, | |||
275 | for (int i = start; i < end; ++i) { | 275 | for (int i = start; i < end; ++i) { |
276 | swayc_t *child = container->children->items[i]; | 276 | swayc_t *child = container->children->items[i]; |
277 | wlr_log(L_DEBUG, | 277 | wlr_log(L_DEBUG, |
278 | "Calculating arrangement for %p:%d (will scale %f by %f)", | 278 | "Calculating arrangement for %p:%d (will scale %f by %f)", |
279 | child, child->type, width, scale); | 279 | child, child->type, width, scale); |
280 | view_set_position(child->sway_view, child_x, y); | 280 | view_set_position(child->sway_view, child_x, y); |
281 | 281 | ||
282 | if (i == end - 1) { | 282 | if (i == end - 1) { |
@@ -325,8 +325,8 @@ void apply_vert_layout(swayc_t *container, | |||
325 | for (i = start; i < end; ++i) { | 325 | for (i = start; i < end; ++i) { |
326 | swayc_t *child = container->children->items[i]; | 326 | swayc_t *child = container->children->items[i]; |
327 | wlr_log(L_DEBUG, | 327 | wlr_log(L_DEBUG, |
328 | "Calculating arrangement for %p:%d (will scale %f by %f)", | 328 | "Calculating arrangement for %p:%d (will scale %f by %f)", |
329 | child, child->type, height, scale); | 329 | child, child->type, height, scale); |
330 | view_set_position(child->sway_view, x, child_y); | 330 | view_set_position(child->sway_view, x, child_y); |
331 | 331 | ||
332 | if (i == end - 1) { | 332 | if (i == end - 1) { |
@@ -373,24 +373,23 @@ static swayc_t *get_swayc_in_output_direction(swayc_t *output, | |||
373 | // get most left child of new output | 373 | // get most left child of new output |
374 | return ws->children->items[0]; | 374 | return ws->children->items[0]; |
375 | case MOVE_UP: | 375 | case MOVE_UP: |
376 | case MOVE_DOWN: | 376 | case MOVE_DOWN: { |
377 | { | 377 | swayc_t *focused = sway_seat_get_focus_inactive(seat, ws); |
378 | swayc_t *focused = sway_seat_get_focus_inactive(seat, ws); | 378 | if (focused && focused->parent) { |
379 | if (focused && focused->parent) { | 379 | swayc_t *parent = focused->parent; |
380 | swayc_t *parent = focused->parent; | 380 | if (parent->layout == L_VERT) { |
381 | if (parent->layout == L_VERT) { | 381 | if (dir == MOVE_UP) { |
382 | if (dir == MOVE_UP) { | 382 | // get child furthest down on new output |
383 | // get child furthest down on new output | 383 | return parent->children->items[parent->children->length-1]; |
384 | return parent->children->items[parent->children->length-1]; | 384 | } else if (dir == MOVE_DOWN) { |
385 | } else if (dir == MOVE_DOWN) { | 385 | // get child furthest up on new output |
386 | // get child furthest up on new output | 386 | return parent->children->items[0]; |
387 | return parent->children->items[0]; | ||
388 | } | ||
389 | } | 387 | } |
390 | return focused; | ||
391 | } | 388 | } |
392 | break; | 389 | return focused; |
393 | } | 390 | } |
391 | break; | ||
392 | } | ||
394 | default: | 393 | default: |
395 | break; | 394 | break; |
396 | } | 395 | } |