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