aboutsummaryrefslogtreecommitdiff
path: root/sway/input
diff options
context:
space:
mode:
authorRyan Dwyer <ryandwyer1@gmail.com>2018-07-21 12:13:00 +1000
committerRyan Dwyer <ryandwyer1@gmail.com>2018-07-22 23:10:19 +1000
commit011d1ebfa4219eb666487529a5a5e7189c14fd40 (patch)
tree4dd3efa39573b7baa9e3965ed3b03799af849c54 /sway/input
parent9df660ee3188386c907d8feb999636ce8d61d095 (diff)
downloadsway-011d1ebfa4219eb666487529a5a5e7189c14fd40.tar.xz
Consider view's min/max sizes when resizing
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/cursor.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index ad0ceb94..7deb2b19 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -243,7 +243,7 @@ static void handle_resize_motion(struct sway_seat *seat,
grow_height = seat->op_ref_height * max_multiplier;
}
- // Determine new width/height, and accommodate for min/max values
+ // Determine new width/height, and accommodate for floating min/max values
double width = seat->op_ref_width + grow_width;
double height = seat->op_ref_height + grow_height;
int min_width, max_width, min_height, max_height;
@@ -252,6 +252,15 @@ static void handle_resize_motion(struct sway_seat *seat,
width = fmax(min_width, fmin(width, max_width));
height = fmax(min_height, fmin(height, max_height));
+ // Apply the view's min/max size
+ if (con->type == C_VIEW) {
+ double view_min_width, view_max_width, view_min_height, view_max_height;
+ view_get_constraints(con->sway_view, &view_min_width, &view_max_width,
+ &view_min_height, &view_max_height);
+ width = fmax(view_min_width, fmin(width, view_max_width));
+ height = fmax(view_min_height, fmin(height, view_max_height));
+ }
+
// Recalculate these, in case we hit a min/max limit
grow_width = width - seat->op_ref_width;
grow_height = height - seat->op_ref_height;