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 /sway | |
parent | 0b4e3d39eb7af94617a3f95995e2b0ba8bb5513f (diff) | |
download | sway-f2b6d1ec290014674bf2755a3488aef8ab51a182.tar.xz |
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>
Diffstat (limited to 'sway')
-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) { double height = e->ref_height + grow_height; int min_width, max_width, min_height, max_height; floating_calculate_constraints(&min_width, &max_width, - &min_height, &max_height); - width = fmax(min_width + border_width, fmin(width, max_width)); - height = fmax(min_height + border_height, fmin(height, max_height)); + &min_height, &max_height); + width = fmin(width, max_width - border_width); + width = fmax(width, min_width + border_width); + width = fmax(width, 1); + height = fmin(height, max_height - border_height); + height = fmax(height, min_height + border_height); + height = fmax(height, 1); // Apply the view's min/max size if (con->view) { double view_min_width, view_max_width, view_min_height, view_max_height; view_get_constraints(con->view, &view_min_width, &view_max_width, &view_min_height, &view_max_height); - width = fmax(view_min_width + border_width, fmin(width, view_max_width)); - height = fmax(view_min_height + border_height, fmin(height, view_max_height)); + width = fmin(width, view_max_width - border_width); + width = fmax(width, view_min_width + border_width); + width = fmax(width, 1); + height = fmin(height, view_max_height - border_height); + height = fmax(height, view_min_height + border_height); + height = fmax(height, 1); } |