summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar S. Christoffer Eliesen <christoffer@eliesen.no>2015-12-28 01:14:48 +0100
committerLibravatar S. Christoffer Eliesen <christoffer@eliesen.no>2015-12-28 01:14:48 +0100
commit831f6680f41ab2ed91e5a17694bdee802cd1e789 (patch)
tree03c676f1510205cea58e9e9adc8c72c1b8132eca
parentMerge pull request #409 from mikkeloscar/bar-airblade-features (diff)
downloadsway-831f6680f41ab2ed91e5a17694bdee802cd1e789.tar.gz
sway-831f6680f41ab2ed91e5a17694bdee802cd1e789.tar.zst
sway-831f6680f41ab2ed91e5a17694bdee802cd1e789.zip
arrange_windows_r: Bring parent coordinates into layout calculations.
This brings consistency into the algorithm (instead of resetting and then fetching again).
-rw-r--r--sway/layout.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/sway/layout.c b/sway/layout.c
index d7265605..8c253fe4 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -434,7 +434,7 @@ static void arrange_windows_r(swayc_t *container, double width, double height) {
434 sway_log(L_DEBUG, "Arranging layout for %p %s %fx%f+%f,%f", container, 434 sway_log(L_DEBUG, "Arranging layout for %p %s %fx%f+%f,%f", container,
435 container->name, container->width, container->height, container->x, container->y); 435 container->name, container->width, container->height, container->x, container->y);
436 436
437 int x = 0, y = 0; 437 double x = 0, y = 0;
438 switch (container->type) { 438 switch (container->type) {
439 case C_ROOT: 439 case C_ROOT:
440 for (i = 0; i < container->children->length; ++i) { 440 for (i = 0; i < container->children->length; ++i) {
@@ -489,8 +489,8 @@ static void arrange_windows_r(swayc_t *container, double width, double height) {
489 } 489 }
490 } 490 }
491 int gap = swayc_gap(container); 491 int gap = swayc_gap(container);
492 container->x = x + gap; 492 x = container->x = x + gap;
493 container->y = y + gap; 493 y = container->y = y + gap;
494 width = container->width = width - gap * 2; 494 width = container->width = width - gap * 2;
495 height = container->height = height - gap * 2; 495 height = container->height = height - gap * 2;
496 sway_log(L_DEBUG, "Arranging workspace '%s' at %f, %f", container->name, container->x, container->y); 496 sway_log(L_DEBUG, "Arranging workspace '%s' at %f, %f", container->name, container->x, container->y);
@@ -509,10 +509,11 @@ static void arrange_windows_r(swayc_t *container, double width, double height) {
509 default: 509 default:
510 container->width = width; 510 container->width = width;
511 container->height = height; 511 container->height = height;
512 x = container->x;
513 y = container->y;
512 break; 514 break;
513 } 515 }
514 516
515 x = y = 0;
516 double scale = 0; 517 double scale = 0;
517 switch (container->layout) { 518 switch (container->layout) {
518 case L_HORIZ: 519 case L_HORIZ:
@@ -536,8 +537,8 @@ static void arrange_windows_r(swayc_t *container, double width, double height) {
536 for (i = 0; i < container->children->length; ++i) { 537 for (i = 0; i < container->children->length; ++i) {
537 swayc_t *child = container->children->items[i]; 538 swayc_t *child = container->children->items[i];
538 sway_log(L_DEBUG, "Calculating arrangement for %p:%d (will scale %f by %f)", child, child->type, width, scale); 539 sway_log(L_DEBUG, "Calculating arrangement for %p:%d (will scale %f by %f)", child, child->type, width, scale);
539 child->x = x + container->x; 540 child->x = x;
540 child->y = y + container->y; 541 child->y = y;
541 arrange_windows_r(child, child->width * scale, height); 542 arrange_windows_r(child, child->width * scale, height);
542 x += child->width; 543 x += child->width;
543 } 544 }
@@ -563,8 +564,8 @@ static void arrange_windows_r(swayc_t *container, double width, double height) {
563 for (i = 0; i < container->children->length; ++i) { 564 for (i = 0; i < container->children->length; ++i) {
564 swayc_t *child = container->children->items[i]; 565 swayc_t *child = container->children->items[i];
565 sway_log(L_DEBUG, "Calculating arrangement for %p:%d (will scale %f by %f)", child, child->type, height, scale); 566 sway_log(L_DEBUG, "Calculating arrangement for %p:%d (will scale %f by %f)", child, child->type, height, scale);
566 child->x = x + container->x; 567 child->x = x;
567 child->y = y + container->y; 568 child->y = y;
568 arrange_windows_r(child, width, child->height * scale); 569 arrange_windows_r(child, width, child->height * scale);
569 y += child->height; 570 y += child->height;
570 } 571 }