|
|
@ -695,12 +695,13 @@ void floating_calculate_constraints(int *min_width, int *max_width,
|
|
|
|
*min_height = config->floating_minimum_height;
|
|
|
|
*min_height = config->floating_minimum_height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_box *box = wlr_output_layout_get_box(root->output_layout, NULL);
|
|
|
|
struct wlr_box box;
|
|
|
|
|
|
|
|
wlr_output_layout_get_box(root->output_layout, NULL, &box);
|
|
|
|
|
|
|
|
|
|
|
|
if (config->floating_maximum_width == -1) { // no maximum
|
|
|
|
if (config->floating_maximum_width == -1) { // no maximum
|
|
|
|
*max_width = INT_MAX;
|
|
|
|
*max_width = INT_MAX;
|
|
|
|
} else if (config->floating_maximum_width == 0) { // automatic
|
|
|
|
} else if (config->floating_maximum_width == 0) { // automatic
|
|
|
|
*max_width = box->width;
|
|
|
|
*max_width = box.width;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
*max_width = config->floating_maximum_width;
|
|
|
|
*max_width = config->floating_maximum_width;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -708,7 +709,7 @@ void floating_calculate_constraints(int *min_width, int *max_width,
|
|
|
|
if (config->floating_maximum_height == -1) { // no maximum
|
|
|
|
if (config->floating_maximum_height == -1) { // no maximum
|
|
|
|
*max_height = INT_MAX;
|
|
|
|
*max_height = INT_MAX;
|
|
|
|
} else if (config->floating_maximum_height == 0) { // automatic
|
|
|
|
} else if (config->floating_maximum_height == 0) { // automatic
|
|
|
|
*max_height = box->height;
|
|
|
|
*max_height = box.height;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
*max_height = config->floating_maximum_height;
|
|
|
|
*max_height = config->floating_maximum_height;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -740,9 +741,9 @@ void container_floating_resize_and_center(struct sway_container *con) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
struct wlr_box *ob = wlr_output_layout_get_box(root->output_layout,
|
|
|
|
struct wlr_box ob;
|
|
|
|
ws->output->wlr_output);
|
|
|
|
wlr_output_layout_get_box(root->output_layout, ws->output->wlr_output, &ob);
|
|
|
|
if (!ob) {
|
|
|
|
if (wlr_box_empty(&ob)) {
|
|
|
|
// On NOOP output. Will be called again when moved to an output
|
|
|
|
// On NOOP output. Will be called again when moved to an output
|
|
|
|
con->pending.x = 0;
|
|
|
|
con->pending.x = 0;
|
|
|
|
con->pending.y = 0;
|
|
|
|
con->pending.y = 0;
|
|
|
@ -754,8 +755,8 @@ void container_floating_resize_and_center(struct sway_container *con) {
|
|
|
|
floating_natural_resize(con);
|
|
|
|
floating_natural_resize(con);
|
|
|
|
if (!con->view) {
|
|
|
|
if (!con->view) {
|
|
|
|
if (con->pending.width > ws->width || con->pending.height > ws->height) {
|
|
|
|
if (con->pending.width > ws->width || con->pending.height > ws->height) {
|
|
|
|
con->pending.x = ob->x + (ob->width - con->pending.width) / 2;
|
|
|
|
con->pending.x = ob.x + (ob.width - con->pending.width) / 2;
|
|
|
|
con->pending.y = ob->y + (ob->height - con->pending.height) / 2;
|
|
|
|
con->pending.y = ob.y + (ob.height - con->pending.height) / 2;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
con->pending.x = ws->x + (ws->width - con->pending.width) / 2;
|
|
|
|
con->pending.x = ws->x + (ws->width - con->pending.width) / 2;
|
|
|
|
con->pending.y = ws->y + (ws->height - con->pending.height) / 2;
|
|
|
|
con->pending.y = ws->y + (ws->height - con->pending.height) / 2;
|
|
|
@ -763,8 +764,8 @@ void container_floating_resize_and_center(struct sway_container *con) {
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
if (con->pending.content_width > ws->width
|
|
|
|
if (con->pending.content_width > ws->width
|
|
|
|
|| con->pending.content_height > ws->height) {
|
|
|
|
|| con->pending.content_height > ws->height) {
|
|
|
|
con->pending.content_x = ob->x + (ob->width - con->pending.content_width) / 2;
|
|
|
|
con->pending.content_x = ob.x + (ob.width - con->pending.content_width) / 2;
|
|
|
|
con->pending.content_y = ob->y + (ob->height - con->pending.content_height) / 2;
|
|
|
|
con->pending.content_y = ob.y + (ob.height - con->pending.content_height) / 2;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
con->pending.content_x = ws->x + (ws->width - con->pending.content_width) / 2;
|
|
|
|
con->pending.content_x = ws->x + (ws->width - con->pending.content_width) / 2;
|
|
|
|
con->pending.content_y = ws->y + (ws->height - con->pending.content_height) / 2;
|
|
|
|
con->pending.content_y = ws->y + (ws->height - con->pending.content_height) / 2;
|
|
|
|