aboutsummaryrefslogtreecommitdiffstats
path: root/sway/tree/container.c
diff options
context:
space:
mode:
authorLibravatar Alexander Orzechowski <orzechowski.alexander@gmail.com>2022-07-23 20:24:57 -0400
committerLibravatar Simon Ser <contact@emersion.fr>2022-10-29 00:47:01 +0200
commita61815d3859e4cc92d3f8a0701a5675d97b81cdc (patch)
treea1e2e63903e235dd4ae59b26c64368bf13b51c72 /sway/tree/container.c
parentFix focus tracking when session lock is active (diff)
downloadsway-a61815d3859e4cc92d3f8a0701a5675d97b81cdc.tar.gz
sway-a61815d3859e4cc92d3f8a0701a5675d97b81cdc.tar.zst
sway-a61815d3859e4cc92d3f8a0701a5675d97b81cdc.zip
container_floating_set_default_size: Store workspace size box on the stack
Diffstat (limited to 'sway/tree/container.c')
-rw-r--r--sway/tree/container.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 04ef965f..bf7085cb 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -787,11 +787,11 @@ void container_floating_set_default_size(struct sway_container *con) {
787 int min_width, max_width, min_height, max_height; 787 int min_width, max_width, min_height, max_height;
788 floating_calculate_constraints(&min_width, &max_width, 788 floating_calculate_constraints(&min_width, &max_width,
789 &min_height, &max_height); 789 &min_height, &max_height);
790 struct wlr_box *box = calloc(1, sizeof(struct wlr_box)); 790 struct wlr_box box;
791 workspace_get_box(con->pending.workspace, box); 791 workspace_get_box(con->pending.workspace, &box);
792 792
793 double width = fmax(min_width, fmin(box->width * 0.5, max_width)); 793 double width = fmax(min_width, fmin(box.width * 0.5, max_width));
794 double height = fmax(min_height, fmin(box->height * 0.75, max_height)); 794 double height = fmax(min_height, fmin(box.height * 0.75, max_height));
795 if (!con->view) { 795 if (!con->view) {
796 con->pending.width = width; 796 con->pending.width = width;
797 con->pending.height = height; 797 con->pending.height = height;
@@ -800,8 +800,6 @@ void container_floating_set_default_size(struct sway_container *con) {
800 con->pending.content_height = height; 800 con->pending.content_height = height;
801 container_set_geometry_from_content(con); 801 container_set_geometry_from_content(con);
802 } 802 }
803
804 free(box);
805} 803}
806 804
807 805