diff options
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 @@ | |||
7 | #include "sway/tree/arrange.h" | 7 | #include "sway/tree/arrange.h" |
8 | #include "sway/tree/view.h" | 8 | #include "sway/tree/view.h" |
9 | #include "sway/tree/workspace.h" | 9 | #include "sway/tree/workspace.h" |
10 | #include "sway/tree/container.h" | ||
10 | 11 | ||
11 | struct seatop_resize_floating_event { | 12 | struct seatop_resize_floating_event { |
12 | struct sway_container *con; | 13 | struct sway_container *con; |
@@ -55,29 +56,37 @@ static void handle_pointer_motion(struct sway_seat *seat, uint32_t time_msec, | |||
55 | grow_height = e->ref_height * max_multiplier; | 56 | grow_height = e->ref_height * max_multiplier; |
56 | } | 57 | } |
57 | 58 | ||
59 | struct sway_container_state *state = &con->current; | ||
60 | double border_width = 0.0; | ||
61 | if (con->current.border == B_NORMAL || con->current.border == B_PIXEL) { | ||
62 | border_width = state->border_thickness * 2; | ||
63 | } | ||
64 | double border_height = 0.0; | ||
65 | if (con->current.border == B_NORMAL) { | ||
66 | border_height += container_titlebar_height(); | ||
67 | border_height += state->border_thickness; | ||
68 | } else if (con->current.border == B_PIXEL) { | ||
69 | border_height += state->border_thickness * 2; | ||
70 | } | ||
71 | |||
58 | // Determine new width/height, and accommodate for floating min/max values | 72 | // Determine new width/height, and accommodate for floating min/max values |
59 | double width = e->ref_width + grow_width; | 73 | double width = e->ref_width + grow_width; |
60 | double height = e->ref_height + grow_height; | 74 | double height = e->ref_height + grow_height; |
61 | int min_width, max_width, min_height, max_height; | 75 | int min_width, max_width, min_height, max_height; |
62 | floating_calculate_constraints(&min_width, &max_width, | 76 | floating_calculate_constraints(&min_width, &max_width, |
63 | &min_height, &max_height); | 77 | &min_height, &max_height); |
64 | width = fmax(min_width, fmin(width, max_width)); | 78 | width = fmax(min_width + border_width, fmin(width, max_width)); |
65 | height = fmax(min_height, fmin(height, max_height)); | 79 | height = fmax(min_height + border_height, fmin(height, max_height)); |
66 | 80 | ||
67 | // Apply the view's min/max size | 81 | // Apply the view's min/max size |
68 | if (con->view) { | 82 | if (con->view) { |
69 | double view_min_width, view_max_width, view_min_height, view_max_height; | 83 | double view_min_width, view_max_width, view_min_height, view_max_height; |
70 | view_get_constraints(con->view, &view_min_width, &view_max_width, | 84 | view_get_constraints(con->view, &view_min_width, &view_max_width, |
71 | &view_min_height, &view_max_height); | 85 | &view_min_height, &view_max_height); |
72 | width = fmax(view_min_width, fmin(width, view_max_width)); | 86 | width = fmax(view_min_width + border_width, fmin(width, view_max_width)); |
73 | height = fmax(view_min_height, fmin(height, view_max_height)); | 87 | height = fmax(view_min_height + border_height, fmin(height, view_max_height)); |
74 | } | ||
75 | 88 | ||
76 | struct sway_container_state *state = &con->current; | 89 | } |
77 | width += state->border_thickness * 2; | ||
78 | height += config->titlebar_border_thickness * 2; | ||
79 | height += container_titlebar_height(); | ||
80 | height += config->titlebar_v_padding; | ||
81 | 90 | ||
82 | // Recalculate these, in case we hit a min/max limit | 91 | // Recalculate these, in case we hit a min/max limit |
83 | grow_width = width - e->ref_width; | 92 | grow_width = width - e->ref_width; |