summaryrefslogtreecommitdiffstats
path: root/sway/commands.c
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands.c')
-rw-r--r--sway/commands.c53
1 files changed, 31 insertions, 22 deletions
diff --git a/sway/commands.c b/sway/commands.c
index 27dbb44b..0f743b4e 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -478,31 +478,37 @@ static bool cmd_resize(struct sway_config *config, int argc, char **argv) {
478 sibling = parent->parent->children->items[i]; 478 sibling = parent->parent->children->items[i];
479 if (sibling->x != focused->x) { 479 if (sibling->x != focused->x) {
480 if (sibling->x < parent->x) { 480 if (sibling->x < parent->x) {
481 double pixels = -1 * (amount/lnumber); 481 double pixels = -1 * amount;
482 if (lnumber) { 482 pixels /= lnumber;
483 recursive_resize(sibling, pixels/2, MOVE_RIGHT); 483 if (rnumber) {
484 recursive_resize(sibling, pixels/2, WLC_RESIZE_EDGE_RIGHT);
484 } else { 485 } else {
485 recursive_resize(sibling, pixels, MOVE_RIGHT); 486 recursive_resize(sibling, pixels, WLC_RESIZE_EDGE_RIGHT);
486 } 487 }
487 } else if (sibling->x > parent->x) { 488 } else if (sibling->x > parent->x) {
488 double pixels = -1 * (amount/rnumber); 489 double pixels = -1 * amount;
489 if (rnumber) { 490 pixels /= rnumber;
490 recursive_resize(sibling, pixels/2, MOVE_LEFT); 491 if (lnumber) {
492 recursive_resize(sibling, pixels/2, WLC_RESIZE_EDGE_LEFT);
491 } else { 493 } else {
492 recursive_resize(sibling, pixels, MOVE_LEFT); 494 recursive_resize(sibling, pixels, WLC_RESIZE_EDGE_LEFT);
493 } 495 }
494 } 496 }
495 } else { 497 } else {
496 if (rnumber != 0 && lnumber != 0) { 498 if (rnumber != 0 && lnumber != 0) {
497 recursive_resize(parent, amount/2, MOVE_LEFT); 499 double pixels = amount;
498 recursive_resize(parent, amount/2, MOVE_RIGHT); 500 pixels /= 2;
501 recursive_resize(parent, pixels, WLC_RESIZE_EDGE_LEFT);
502 recursive_resize(parent, pixels, WLC_RESIZE_EDGE_RIGHT);
499 } else if (rnumber) { 503 } else if (rnumber) {
500 recursive_resize(parent, amount, MOVE_RIGHT); 504 recursive_resize(parent, amount, WLC_RESIZE_EDGE_RIGHT);
501 } else if (lnumber) { 505 } else if (lnumber) {
502 recursive_resize(parent, amount, MOVE_LEFT); 506 recursive_resize(parent, amount, WLC_RESIZE_EDGE_LEFT);
503 } 507 }
504 } 508 }
505 } 509 }
510 // Recursive resize does not handle positions, let arrange_windows
511 // take care of that.
506 arrange_windows(active_workspace, -1, -1); 512 arrange_windows(active_workspace, -1, -1);
507 return true; 513 return true;
508 } else if (strcmp(argv[1], "height") == 0) { 514 } else if (strcmp(argv[1], "height") == 0) {
@@ -535,28 +541,31 @@ static bool cmd_resize(struct sway_config *config, int argc, char **argv) {
535 sibling = parent->parent->children->items[i]; 541 sibling = parent->parent->children->items[i];
536 if (sibling->y != focused->y) { 542 if (sibling->y != focused->y) {
537 if (sibling->y < parent->y) { 543 if (sibling->y < parent->y) {
538 double pixels = -1 * (amount/bnumber); 544 double pixels = -1 * amount;
545 pixels /= bnumber;
539 if (tnumber) { 546 if (tnumber) {
540 recursive_resize(sibling, pixels/2, MOVE_UP); 547 recursive_resize(sibling, pixels/2, WLC_RESIZE_EDGE_BOTTOM);
541 } else { 548 } else {
542 recursive_resize(sibling, pixels, MOVE_UP); 549 recursive_resize(sibling, pixels, WLC_RESIZE_EDGE_BOTTOM);
543 } 550 }
544 } else if (sibling->x > parent->x) { 551 } else if (sibling->x > parent->x) {
545 double pixels = -1 * (amount/tnumber); 552 double pixels = -1 * amount;
553 pixels /= tnumber;
546 if (bnumber) { 554 if (bnumber) {
547 recursive_resize(sibling, pixels/2, MOVE_DOWN); 555 recursive_resize(sibling, pixels/2, WLC_RESIZE_EDGE_TOP);
548 } else { 556 } else {
549 recursive_resize(sibling, pixels, MOVE_DOWN); 557 recursive_resize(sibling, pixels, WLC_RESIZE_EDGE_TOP);
550 } 558 }
551 } 559 }
552 } else { 560 } else {
553 if (bnumber != 0 && tnumber != 0) { 561 if (bnumber != 0 && tnumber != 0) {
554 recursive_resize(parent, amount/2, MOVE_UP); 562 double pixels = amount/2;
555 recursive_resize(parent, amount/2, MOVE_DOWN); 563 recursive_resize(parent, pixels, WLC_RESIZE_EDGE_TOP);
564 recursive_resize(parent, pixels, WLC_RESIZE_EDGE_BOTTOM);
556 } else if (tnumber) { 565 } else if (tnumber) {
557 recursive_resize(parent, amount, MOVE_UP); 566 recursive_resize(parent, amount, WLC_RESIZE_EDGE_TOP);
558 } else if (bnumber) { 567 } else if (bnumber) {
559 recursive_resize(parent, amount, MOVE_DOWN); 568 recursive_resize(parent, amount, WLC_RESIZE_EDGE_BOTTOM);
560 } 569 }
561 } 570 }
562 } 571 }