diff options
Diffstat (limited to 'sway/input/seatop_resize_floating.c')
-rw-r--r-- | sway/input/seatop_resize_floating.c | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/sway/input/seatop_resize_floating.c b/sway/input/seatop_resize_floating.c index bf6c7ab4..18c6db73 100644 --- a/sway/input/seatop_resize_floating.c +++ b/sway/input/seatop_resize_floating.c | |||
@@ -17,41 +17,6 @@ struct seatop_resize_floating_event { | |||
17 | double ref_con_lx, ref_con_ly; // container's x/y at start of op | 17 | double ref_con_lx, ref_con_ly; // container's x/y at start of op |
18 | }; | 18 | }; |
19 | 19 | ||
20 | static void calculate_floating_constraints(struct sway_container *con, | ||
21 | int *min_width, int *max_width, int *min_height, int *max_height) { | ||
22 | if (config->floating_minimum_width == -1) { // no minimum | ||
23 | *min_width = 0; | ||
24 | } else if (config->floating_minimum_width == 0) { // automatic | ||
25 | *min_width = 75; | ||
26 | } else { | ||
27 | *min_width = config->floating_minimum_width; | ||
28 | } | ||
29 | |||
30 | if (config->floating_minimum_height == -1) { // no minimum | ||
31 | *min_height = 0; | ||
32 | } else if (config->floating_minimum_height == 0) { // automatic | ||
33 | *min_height = 50; | ||
34 | } else { | ||
35 | *min_height = config->floating_minimum_height; | ||
36 | } | ||
37 | |||
38 | if (config->floating_maximum_width == -1) { // no maximum | ||
39 | *max_width = INT_MAX; | ||
40 | } else if (config->floating_maximum_width == 0) { // automatic | ||
41 | *max_width = con->workspace->width; | ||
42 | } else { | ||
43 | *max_width = config->floating_maximum_width; | ||
44 | } | ||
45 | |||
46 | if (config->floating_maximum_height == -1) { // no maximum | ||
47 | *max_height = INT_MAX; | ||
48 | } else if (config->floating_maximum_height == 0) { // automatic | ||
49 | *max_height = con->workspace->height; | ||
50 | } else { | ||
51 | *max_height = config->floating_maximum_height; | ||
52 | } | ||
53 | } | ||
54 | |||
55 | static void handle_motion(struct sway_seat *seat, uint32_t time_msec) { | 20 | static void handle_motion(struct sway_seat *seat, uint32_t time_msec) { |
56 | struct seatop_resize_floating_event *e = seat->seatop_data; | 21 | struct seatop_resize_floating_event *e = seat->seatop_data; |
57 | struct sway_container *con = e->con; | 22 | struct sway_container *con = e->con; |
@@ -85,7 +50,7 @@ static void handle_motion(struct sway_seat *seat, uint32_t time_msec) { | |||
85 | double width = e->ref_width + grow_width; | 50 | double width = e->ref_width + grow_width; |
86 | double height = e->ref_height + grow_height; | 51 | double height = e->ref_height + grow_height; |
87 | int min_width, max_width, min_height, max_height; | 52 | int min_width, max_width, min_height, max_height; |
88 | calculate_floating_constraints(con, &min_width, &max_width, | 53 | floating_calculate_constraints(&min_width, &max_width, |
89 | &min_height, &max_height); | 54 | &min_height, &max_height); |
90 | width = fmax(min_width, fmin(width, max_width)); | 55 | width = fmax(min_width, fmin(width, max_width)); |
91 | height = fmax(min_height, fmin(height, max_height)); | 56 | height = fmax(min_height, fmin(height, max_height)); |