diff options
author | Kirill Primak <vyivel@eclair.cafe> | 2022-01-29 23:11:54 +0300 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2022-01-31 11:44:03 +0100 |
commit | ee7668c1f2b5ba31420d972161d6d43fc1c84bb4 (patch) | |
tree | db2d114113e60cfa4f5a1c87813c53868e0bf9f1 /sway/tree/container.c | |
parent | xwayland: listen to `request_activate` event (diff) | |
download | sway-ee7668c1f2b5ba31420d972161d6d43fc1c84bb4.tar.gz sway-ee7668c1f2b5ba31420d972161d6d43fc1c84bb4.tar.zst sway-ee7668c1f2b5ba31420d972161d6d43fc1c84bb4.zip |
chore: chase wlr_output_layout_get_box() update
https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3439
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r-- | sway/tree/container.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c index 4756028c..bcac36b1 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -695,12 +695,13 @@ void floating_calculate_constraints(int *min_width, int *max_width, | |||
695 | *min_height = config->floating_minimum_height; | 695 | *min_height = config->floating_minimum_height; |
696 | } | 696 | } |
697 | 697 | ||
698 | struct wlr_box *box = wlr_output_layout_get_box(root->output_layout, NULL); | 698 | struct wlr_box box; |
699 | wlr_output_layout_get_box(root->output_layout, NULL, &box); | ||
699 | 700 | ||
700 | if (config->floating_maximum_width == -1) { // no maximum | 701 | if (config->floating_maximum_width == -1) { // no maximum |
701 | *max_width = INT_MAX; | 702 | *max_width = INT_MAX; |
702 | } else if (config->floating_maximum_width == 0) { // automatic | 703 | } else if (config->floating_maximum_width == 0) { // automatic |
703 | *max_width = box->width; | 704 | *max_width = box.width; |
704 | } else { | 705 | } else { |
705 | *max_width = config->floating_maximum_width; | 706 | *max_width = config->floating_maximum_width; |
706 | } | 707 | } |
@@ -708,7 +709,7 @@ void floating_calculate_constraints(int *min_width, int *max_width, | |||
708 | if (config->floating_maximum_height == -1) { // no maximum | 709 | if (config->floating_maximum_height == -1) { // no maximum |
709 | *max_height = INT_MAX; | 710 | *max_height = INT_MAX; |
710 | } else if (config->floating_maximum_height == 0) { // automatic | 711 | } else if (config->floating_maximum_height == 0) { // automatic |
711 | *max_height = box->height; | 712 | *max_height = box.height; |
712 | } else { | 713 | } else { |
713 | *max_height = config->floating_maximum_height; | 714 | *max_height = config->floating_maximum_height; |
714 | } | 715 | } |
@@ -740,9 +741,9 @@ void container_floating_resize_and_center(struct sway_container *con) { | |||
740 | return; | 741 | return; |
741 | } | 742 | } |
742 | 743 | ||
743 | struct wlr_box *ob = wlr_output_layout_get_box(root->output_layout, | 744 | struct wlr_box ob; |
744 | ws->output->wlr_output); | 745 | wlr_output_layout_get_box(root->output_layout, ws->output->wlr_output, &ob); |
745 | if (!ob) { | 746 | if (wlr_box_empty(&ob)) { |
746 | // On NOOP output. Will be called again when moved to an output | 747 | // On NOOP output. Will be called again when moved to an output |
747 | con->pending.x = 0; | 748 | con->pending.x = 0; |
748 | con->pending.y = 0; | 749 | con->pending.y = 0; |
@@ -754,8 +755,8 @@ void container_floating_resize_and_center(struct sway_container *con) { | |||
754 | floating_natural_resize(con); | 755 | floating_natural_resize(con); |
755 | if (!con->view) { | 756 | if (!con->view) { |
756 | if (con->pending.width > ws->width || con->pending.height > ws->height) { | 757 | if (con->pending.width > ws->width || con->pending.height > ws->height) { |
757 | con->pending.x = ob->x + (ob->width - con->pending.width) / 2; | 758 | con->pending.x = ob.x + (ob.width - con->pending.width) / 2; |
758 | con->pending.y = ob->y + (ob->height - con->pending.height) / 2; | 759 | con->pending.y = ob.y + (ob.height - con->pending.height) / 2; |
759 | } else { | 760 | } else { |
760 | con->pending.x = ws->x + (ws->width - con->pending.width) / 2; | 761 | con->pending.x = ws->x + (ws->width - con->pending.width) / 2; |
761 | con->pending.y = ws->y + (ws->height - con->pending.height) / 2; | 762 | con->pending.y = ws->y + (ws->height - con->pending.height) / 2; |
@@ -763,8 +764,8 @@ void container_floating_resize_and_center(struct sway_container *con) { | |||
763 | } else { | 764 | } else { |
764 | if (con->pending.content_width > ws->width | 765 | if (con->pending.content_width > ws->width |
765 | || con->pending.content_height > ws->height) { | 766 | || con->pending.content_height > ws->height) { |
766 | con->pending.content_x = ob->x + (ob->width - con->pending.content_width) / 2; | 767 | con->pending.content_x = ob.x + (ob.width - con->pending.content_width) / 2; |
767 | con->pending.content_y = ob->y + (ob->height - con->pending.content_height) / 2; | 768 | con->pending.content_y = ob.y + (ob.height - con->pending.content_height) / 2; |
768 | } else { | 769 | } else { |
769 | con->pending.content_x = ws->x + (ws->width - con->pending.content_width) / 2; | 770 | con->pending.content_x = ws->x + (ws->width - con->pending.content_width) / 2; |
770 | con->pending.content_y = ws->y + (ws->height - con->pending.content_height) / 2; | 771 | con->pending.content_y = ws->y + (ws->height - con->pending.content_height) / 2; |