diff options
author | Adam Kürthy <adikurthy@gmail.com> | 2020-05-04 02:18:39 +0200 |
---|---|---|
committer | Simon Ser <contact@emersion.fr> | 2020-05-13 11:07:31 +0200 |
commit | 7a294b266839a63c871eeb72b2354dbbebcf15ec (patch) | |
tree | 7de83a1e3f487327957e7a013cc0c5f4f3808d76 /sway/input | |
parent | 2262ae60f4c405b881ca342a96f90865adc60ad0 (diff) |
Really fix floating window border resize problems
Fixes: https://github.com/swaywm/sway/pull/5250
Diffstat (limited to 'sway/input')
-rw-r--r-- | sway/input/seatop_resize_floating.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/sway/input/seatop_resize_floating.c b/sway/input/seatop_resize_floating.c index c9fa1e9b..80df63ce 100644 --- a/sway/input/seatop_resize_floating.c +++ b/sway/input/seatop_resize_floating.c @@ -7,6 +7,7 @@ #include "sway/tree/arrange.h" #include "sway/tree/view.h" #include "sway/tree/workspace.h" +#include "sway/tree/container.h" struct seatop_resize_floating_event { struct sway_container *con; @@ -55,29 +56,37 @@ static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec, grow_height = e->ref_height * max_multiplier; } + struct sway_container_state *state = &con->current; + double border_width = 0.0; + if (con->current.border == B_NORMAL || con->current.border == B_PIXEL) { + border_width = state->border_thickness * 2; + } + double border_height = 0.0; + if (con->current.border == B_NORMAL) { + border_height += container_titlebar_height(); + border_height += state->border_thickness; + } else if (con->current.border == B_PIXEL) { + border_height += state->border_thickness * 2; + } + // Determine new width/height, and accommodate for floating min/max values double width = e->ref_width + grow_width; 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, fmin(width, max_width)); - height = fmax(min_height, fmin(height, max_height)); + width = fmax(min_width + border_width, fmin(width, max_width)); + height = fmax(min_height + border_height, fmin(height, max_height)); // 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, fmin(width, view_max_width)); - height = fmax(view_min_height, fmin(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)); - struct sway_container_state *state = &con->current; - width += state->border_thickness * 2; - height += config->titlebar_border_thickness * 2; - height += container_titlebar_height(); - height += config->titlebar_v_padding; + } // Recalculate these, in case we hit a min/max limit grow_width = width - e->ref_width; |