aboutsummaryrefslogtreecommitdiff
path: root/sway/input
diff options
context:
space:
mode:
authorBrian Ashworth <bosrsf04@gmail.com>2019-03-02 02:29:28 -0500
committeremersion <contact@emersion.fr>2019-03-02 09:10:26 +0100
commit430359519c1cb9583020fc8da04f5ecc31b0e914 (patch)
treea2b8287babeb96e63953de8d4bb68bc422029fe9 /sway/input
parent37f0e1f1a2cc8e072c8e01e0769c62c536b8295b (diff)
floating_maximum_size: change default behavior
This changes the way zero (which is the default) is interpreted for both the width and height of `floating_maximum_size`. It now refers to the width and height of the entire output layout, which matches i3's behavior. This also removes duplicated code to calculate the floating constraints in three files. Before this, `container_init_floating` used two-thirds of the workspace width/height as the max and the entire workspace width/height was used everywhere else. Now, all callers use a single function `floating_calculate_constraints`.
Diffstat (limited to 'sway/input')
-rw-r--r--sway/input/seatop_resize_floating.c37
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 {
double ref_con_lx, ref_con_ly; // container's x/y at start of op
};
-static void calculate_floating_constraints(struct sway_container *con,
- int *min_width, int *max_width, int *min_height, int *max_height) {
- if (config->floating_minimum_width == -1) { // no minimum
- *min_width = 0;
- } else if (config->floating_minimum_width == 0) { // automatic
- *min_width = 75;
- } else {
- *min_width = config->floating_minimum_width;
- }
-
- if (config->floating_minimum_height == -1) { // no minimum
- *min_height = 0;
- } else if (config->floating_minimum_height == 0) { // automatic
- *min_height = 50;
- } else {
- *min_height = config->floating_minimum_height;
- }
-
- if (config->floating_maximum_width == -1) { // no maximum
- *max_width = INT_MAX;
- } else if (config->floating_maximum_width == 0) { // automatic
- *max_width = con->workspace->width;
- } else {
- *max_width = config->floating_maximum_width;
- }
-
- if (config->floating_maximum_height == -1) { // no maximum
- *max_height = INT_MAX;
- } else if (config->floating_maximum_height == 0) { // automatic
- *max_height = con->workspace->height;
- } else {
- *max_height = config->floating_maximum_height;
- }
-}
-
static void handle_motion(struct sway_seat *seat, uint32_t time_msec) {
struct seatop_resize_floating_event *e = seat->seatop_data;
struct sway_container *con = e->con;
@@ -85,7 +50,7 @@ static void handle_motion(struct sway_seat *seat, uint32_t time_msec) {
double width = e->ref_width + grow_width;
double height = e->ref_height + grow_height;
int min_width, max_width, min_height, max_height;
- calculate_floating_constraints(con, &min_width, &max_width,
+ 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));