diff options
author | RoastVeg <RoastVeg@users.noreply.github.com> | 2020-06-09 16:47:38 +0100 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2021-12-14 10:30:10 +0100 |
commit | f2b6d1ec290014674bf2755a3488aef8ab51a182 (patch) | |
tree | 626046af7212f197805fb246c683edad6ce3acf7 | |
parent | meson.build: require wayland-protocols 1.24 (diff) | |
download | sway-f2b6d1ec290014674bf2755a3488aef8ab51a182.tar.gz sway-f2b6d1ec290014674bf2755a3488aef8ab51a182.tar.zst sway-f2b6d1ec290014674bf2755a3488aef8ab51a182.zip |
Handle border width and height on minimum floating sizes
This fixes: https://github.com/swaywm/sway/issues/5337
Co-authored-by: Moon Sungjoon <sumoon@seoulsaram.org>
-rw-r--r-- | sway/input/seatop_resize_floating.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/sway/input/seatop_resize_floating.c b/sway/input/seatop_resize_floating.c index 8400a4b3..df683026 100644 --- a/sway/input/seatop_resize_floating.c +++ b/sway/input/seatop_resize_floating.c | |||
@@ -80,17 +80,25 @@ static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec) { | |||
80 | double height = e->ref_height + grow_height; | 80 | double height = e->ref_height + grow_height; |
81 | int min_width, max_width, min_height, max_height; | 81 | int min_width, max_width, min_height, max_height; |
82 | floating_calculate_constraints(&min_width, &max_width, | 82 | floating_calculate_constraints(&min_width, &max_width, |
83 | &min_height, &max_height); | 83 | &min_height, &max_height); |
84 | width = fmax(min_width + border_width, fmin(width, max_width)); | 84 | width = fmin(width, max_width - border_width); |
85 | height = fmax(min_height + border_height, fmin(height, max_height)); | 85 | width = fmax(width, min_width + border_width); |
86 | width = fmax(width, 1); | ||
87 | height = fmin(height, max_height - border_height); | ||
88 | height = fmax(height, min_height + border_height); | ||
89 | height = fmax(height, 1); | ||
86 | 90 | ||
87 | // Apply the view's min/max size | 91 | // Apply the view's min/max size |
88 | if (con->view) { | 92 | if (con->view) { |
89 | double view_min_width, view_max_width, view_min_height, view_max_height; | 93 | double view_min_width, view_max_width, view_min_height, view_max_height; |
90 | view_get_constraints(con->view, &view_min_width, &view_max_width, | 94 | view_get_constraints(con->view, &view_min_width, &view_max_width, |
91 | &view_min_height, &view_max_height); | 95 | &view_min_height, &view_max_height); |
92 | width = fmax(view_min_width + border_width, fmin(width, view_max_width)); | 96 | width = fmin(width, view_max_width - border_width); |
93 | height = fmax(view_min_height + border_height, fmin(height, view_max_height)); | 97 | width = fmax(width, view_min_width + border_width); |
98 | width = fmax(width, 1); | ||
99 | height = fmin(height, view_max_height - border_height); | ||
100 | height = fmax(height, view_min_height + border_height); | ||
101 | height = fmax(height, 1); | ||
94 | 102 | ||
95 | } | 103 | } |
96 | 104 | ||