|
|
@ -24,10 +24,10 @@ static void output_layout_handle_change(struct wl_listener *listener,
|
|
|
|
root_container.sway_root->output_layout;
|
|
|
|
root_container.sway_root->output_layout;
|
|
|
|
const struct wlr_box *layout_box =
|
|
|
|
const struct wlr_box *layout_box =
|
|
|
|
wlr_output_layout_get_box(output_layout, NULL);
|
|
|
|
wlr_output_layout_get_box(output_layout, NULL);
|
|
|
|
root_container.box.x = layout_box->x;
|
|
|
|
root_container.x = layout_box->x;
|
|
|
|
root_container.box.y = layout_box->y;
|
|
|
|
root_container.y = layout_box->y;
|
|
|
|
root_container.box.width = layout_box->width;
|
|
|
|
root_container.width = layout_box->width;
|
|
|
|
root_container.box.height = layout_box->height;
|
|
|
|
root_container.height = layout_box->height;
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0 ; i < root_container.children->length; ++i) {
|
|
|
|
for (int i = 0 ; i < root_container.children->length; ++i) {
|
|
|
|
struct sway_container *output_container =
|
|
|
|
struct sway_container *output_container =
|
|
|
@ -42,10 +42,10 @@ static void output_layout_handle_change(struct wl_listener *listener,
|
|
|
|
if (!output_box) {
|
|
|
|
if (!output_box) {
|
|
|
|
continue;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
output_container->box.x = output_box->x;
|
|
|
|
output_container->x = output_box->x;
|
|
|
|
output_container->box.y = output_box->y;
|
|
|
|
output_container->y = output_box->y;
|
|
|
|
output_container->box.width = output_box->width;
|
|
|
|
output_container->width = output_box->width;
|
|
|
|
output_container->box.height = output_box->height;
|
|
|
|
output_container->height = output_box->height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
arrange_windows(&root_container, -1, -1);
|
|
|
|
arrange_windows(&root_container, -1, -1);
|
|
|
@ -112,9 +112,9 @@ struct sway_container *container_add_sibling(struct sway_container *fixed,
|
|
|
|
|
|
|
|
|
|
|
|
void container_add_child(struct sway_container *parent,
|
|
|
|
void container_add_child(struct sway_container *parent,
|
|
|
|
struct sway_container *child) {
|
|
|
|
struct sway_container *child) {
|
|
|
|
wlr_log(L_DEBUG, "Adding id:%zd (%d, %dx%d) to id:%zd (%d, %dx%d)",
|
|
|
|
wlr_log(L_DEBUG, "Adding %p (%d, %fx%f) to %p (%d, %fx%f)",
|
|
|
|
child->id, child->type, child->box.width, child->box.height,
|
|
|
|
child, child->type, child->width, child->height,
|
|
|
|
parent->id, parent->type, parent->box.width, parent->box.height);
|
|
|
|
parent, parent->type, parent->width, parent->height);
|
|
|
|
list_add(parent->children, child);
|
|
|
|
list_add(parent->children, child);
|
|
|
|
child->parent = parent;
|
|
|
|
child->parent = parent;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -138,7 +138,7 @@ void container_move_to(struct sway_container *container,
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
struct sway_container *old_parent = container_remove_child(container);
|
|
|
|
struct sway_container *old_parent = container_remove_child(container);
|
|
|
|
container->box.width = container->box.height = 0;
|
|
|
|
container->width = container->height = 0;
|
|
|
|
struct sway_container *new_parent;
|
|
|
|
struct sway_container *new_parent;
|
|
|
|
if (destination->type == C_VIEW) {
|
|
|
|
if (destination->type == C_VIEW) {
|
|
|
|
new_parent = container_add_sibling(destination, container);
|
|
|
|
new_parent = container_add_sibling(destination, container);
|
|
|
@ -187,10 +187,11 @@ enum sway_container_layout container_get_default_layout(
|
|
|
|
return config->default_layout;
|
|
|
|
return config->default_layout;
|
|
|
|
} else if (config->default_orientation != L_NONE) {
|
|
|
|
} else if (config->default_orientation != L_NONE) {
|
|
|
|
return config->default_orientation;
|
|
|
|
return config->default_orientation;
|
|
|
|
} else if (con->box.width >= con->box.height) {
|
|
|
|
} else if (con->width >= con->height) {
|
|
|
|
return L_HORIZ;
|
|
|
|
return L_HORIZ;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return L_VERT;
|
|
|
|
return L_VERT;
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static int sort_workspace_cmp_qsort(const void *_a, const void *_b) {
|
|
|
|
static int sort_workspace_cmp_qsort(const void *_a, const void *_b) {
|
|
|
@ -215,23 +216,25 @@ void container_sort_workspaces(struct sway_container *output) {
|
|
|
|
list_stable_sort(output->children, sort_workspace_cmp_qsort);
|
|
|
|
list_stable_sort(output->children, sort_workspace_cmp_qsort);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void apply_horiz_layout(struct sway_container *container,
|
|
|
|
static void apply_horiz_layout(struct sway_container *container, const double x,
|
|
|
|
const int x, const int y, const int width,
|
|
|
|
const double y, const double width,
|
|
|
|
const int height, const int start, const int end);
|
|
|
|
const double height, const int start,
|
|
|
|
|
|
|
|
const int end);
|
|
|
|
|
|
|
|
|
|
|
|
static void apply_vert_layout(struct sway_container *container,
|
|
|
|
static void apply_vert_layout(struct sway_container *container, const double x,
|
|
|
|
const int x, const int y, const int width,
|
|
|
|
const double y, const double width,
|
|
|
|
const int height, const int start, const int end);
|
|
|
|
const double height, const int start,
|
|
|
|
|
|
|
|
const int end);
|
|
|
|
|
|
|
|
|
|
|
|
void arrange_windows(struct sway_container *container,
|
|
|
|
void arrange_windows(struct sway_container *container,
|
|
|
|
int width, int height) {
|
|
|
|
double width, double height) {
|
|
|
|
if (config->reloading) {
|
|
|
|
if (config->reloading) {
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
if (width == -1 || height == -1) {
|
|
|
|
if (width == -1 || height == -1) {
|
|
|
|
width = container->box.width;
|
|
|
|
width = container->width;
|
|
|
|
height = container->box.height;
|
|
|
|
height = container->height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// pixels are indivisible. if we don't round the pixels, then the view
|
|
|
|
// pixels are indivisible. if we don't round the pixels, then the view
|
|
|
|
// calculations will be off (e.g. 50.5 + 50.5 = 101, but in reality it's
|
|
|
|
// calculations will be off (e.g. 50.5 + 50.5 = 101, but in reality it's
|
|
|
@ -239,17 +242,17 @@ void arrange_windows(struct sway_container *container,
|
|
|
|
width = floor(width);
|
|
|
|
width = floor(width);
|
|
|
|
height = floor(height);
|
|
|
|
height = floor(height);
|
|
|
|
|
|
|
|
|
|
|
|
wlr_log(L_DEBUG, "Arranging layout for %p %s %dx%d+%d,%d", container,
|
|
|
|
wlr_log(L_DEBUG, "Arranging layout for %p %s %fx%f+%f,%f", container,
|
|
|
|
container->name, container->box.width, container->box.height,
|
|
|
|
container->name, container->width, container->height, container->x,
|
|
|
|
container->box.x, container->box.y);
|
|
|
|
container->y);
|
|
|
|
|
|
|
|
|
|
|
|
int x = 0, y = 0;
|
|
|
|
double x = 0, y = 0;
|
|
|
|
switch (container->type) {
|
|
|
|
switch (container->type) {
|
|
|
|
case C_ROOT:
|
|
|
|
case C_ROOT:
|
|
|
|
for (i = 0; i < container->children->length; ++i) {
|
|
|
|
for (i = 0; i < container->children->length; ++i) {
|
|
|
|
struct sway_container *output = container->children->items[i];
|
|
|
|
struct sway_container *output = container->children->items[i];
|
|
|
|
wlr_log(L_DEBUG, "Arranging output '%s' at %d,%d",
|
|
|
|
wlr_log(L_DEBUG, "Arranging output '%s' at %f,%f",
|
|
|
|
output->name, output->box.x, output->box.y);
|
|
|
|
output->name, output->x, output->y);
|
|
|
|
arrange_windows(output, -1, -1);
|
|
|
|
arrange_windows(output, -1, -1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
return;
|
|
|
@ -258,8 +261,8 @@ void arrange_windows(struct sway_container *container,
|
|
|
|
int _width, _height;
|
|
|
|
int _width, _height;
|
|
|
|
wlr_output_effective_resolution(
|
|
|
|
wlr_output_effective_resolution(
|
|
|
|
container->sway_output->wlr_output, &_width, &_height);
|
|
|
|
container->sway_output->wlr_output, &_width, &_height);
|
|
|
|
width = container->box.width = _width;
|
|
|
|
width = container->width = _width;
|
|
|
|
height = container->box.height = _height;
|
|
|
|
height = container->height = _height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// arrange all workspaces:
|
|
|
|
// arrange all workspaces:
|
|
|
|
for (i = 0; i < container->children->length; ++i) {
|
|
|
|
for (i = 0; i < container->children->length; ++i) {
|
|
|
@ -274,32 +277,31 @@ void arrange_windows(struct sway_container *container,
|
|
|
|
struct wlr_box *area = &output->sway_output->usable_area;
|
|
|
|
struct wlr_box *area = &output->sway_output->usable_area;
|
|
|
|
wlr_log(L_DEBUG, "Usable area for ws: %dx%d@%d,%d",
|
|
|
|
wlr_log(L_DEBUG, "Usable area for ws: %dx%d@%d,%d",
|
|
|
|
area->width, area->height, area->x, area->y);
|
|
|
|
area->width, area->height, area->x, area->y);
|
|
|
|
container->box.width = width = area->width;
|
|
|
|
container->width = width = area->width;
|
|
|
|
container->box.height = height = area->height;
|
|
|
|
container->height = height = area->height;
|
|
|
|
container->box.x = x = area->x;
|
|
|
|
container->x = x = area->x;
|
|
|
|
container->box.y = y = area->y;
|
|
|
|
container->y = y = area->y;
|
|
|
|
wlr_log(L_DEBUG, "Arranging workspace '%s' at %d,%d",
|
|
|
|
wlr_log(L_DEBUG, "Arranging workspace '%s' at %f, %f",
|
|
|
|
container->name, container->box.x, container->box.y);
|
|
|
|
container->name, container->x, container->y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// children are properly handled below
|
|
|
|
// children are properly handled below
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
case C_VIEW:
|
|
|
|
case C_VIEW:
|
|
|
|
{
|
|
|
|
{
|
|
|
|
container->box.width = width;
|
|
|
|
container->width = width;
|
|
|
|
container->box.height = height;
|
|
|
|
container->height = height;
|
|
|
|
view_configure(container->sway_view,
|
|
|
|
view_configure(container->sway_view, container->x, container->y,
|
|
|
|
container->box.x, container->box.y,
|
|
|
|
container->width, container->height);
|
|
|
|
container->box.width, container->box.height);
|
|
|
|
wlr_log(L_DEBUG, "Set view to %.f x %.f @ %.f, %.f",
|
|
|
|
wlr_log(L_DEBUG, "Set view to %d x %d @ %d, %d",
|
|
|
|
container->width, container->height,
|
|
|
|
container->box.width, container->box.height,
|
|
|
|
container->x, container->y);
|
|
|
|
container->box.x, container->box.y);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
default:
|
|
|
|
default:
|
|
|
|
container->box.width = width;
|
|
|
|
container->width = width;
|
|
|
|
container->box.height = height;
|
|
|
|
container->height = height;
|
|
|
|
x = container->box.x;
|
|
|
|
x = container->x;
|
|
|
|
y = container->box.y;
|
|
|
|
y = container->y;
|
|
|
|
break;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -321,49 +323,50 @@ void arrange_windows(struct sway_container *container,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void apply_horiz_layout(struct sway_container *container,
|
|
|
|
static void apply_horiz_layout(struct sway_container *container,
|
|
|
|
const int x, const int y, const int width, const int height,
|
|
|
|
const double x, const double y,
|
|
|
|
|
|
|
|
const double width, const double height,
|
|
|
|
const int start, const int end) {
|
|
|
|
const int start, const int end) {
|
|
|
|
double scale = 0;
|
|
|
|
double scale = 0;
|
|
|
|
// Calculate total width
|
|
|
|
// Calculate total width
|
|
|
|
for (int i = start; i < end; ++i) {
|
|
|
|
for (int i = start; i < end; ++i) {
|
|
|
|
struct sway_container *child = container->children->items[i];
|
|
|
|
double *old_width =
|
|
|
|
int old_width = child->box.width;
|
|
|
|
&((struct sway_container *)container->children->items[i])->width;
|
|
|
|
if (old_width <= 0) {
|
|
|
|
if (*old_width <= 0) {
|
|
|
|
if (end - start > 1) {
|
|
|
|
if (end - start > 1) {
|
|
|
|
old_width = width / (end - start - 1);
|
|
|
|
*old_width = width / (end - start - 1);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
old_width = width;
|
|
|
|
*old_width = width;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
scale += old_width;
|
|
|
|
scale += *old_width;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
scale = width / scale;
|
|
|
|
scale = width / scale;
|
|
|
|
|
|
|
|
|
|
|
|
// Resize windows
|
|
|
|
// Resize windows
|
|
|
|
int child_x = x;
|
|
|
|
double child_x = x;
|
|
|
|
if (scale > 0.1) {
|
|
|
|
if (scale > 0.1) {
|
|
|
|
wlr_log(L_DEBUG, "Arranging %p horizontally", container);
|
|
|
|
wlr_log(L_DEBUG, "Arranging %p horizontally", container);
|
|
|
|
for (int i = start; i < end; ++i) {
|
|
|
|
for (int i = start; i < end; ++i) {
|
|
|
|
struct sway_container *child = container->children->items[i];
|
|
|
|
struct sway_container *child = container->children->items[i];
|
|
|
|
wlr_log(L_DEBUG,
|
|
|
|
wlr_log(L_DEBUG,
|
|
|
|
"Calculating arrangement for %p:%d (will scale %d by %f)",
|
|
|
|
"Calculating arrangement for %p:%d (will scale %f by %f)",
|
|
|
|
child, child->type, width, scale);
|
|
|
|
child, child->type, width, scale);
|
|
|
|
|
|
|
|
|
|
|
|
if (child->type == C_VIEW) {
|
|
|
|
if (child->type == C_VIEW) {
|
|
|
|
view_configure(child->sway_view, child_x, y,
|
|
|
|
view_configure(child->sway_view, child_x, y, child->width,
|
|
|
|
child->box.width, child->box.height);
|
|
|
|
child->height);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
child->box.x = child_x;
|
|
|
|
child->x = child_x;
|
|
|
|
child->box.y = y;
|
|
|
|
child->y = y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (i == end - 1) {
|
|
|
|
if (i == end - 1) {
|
|
|
|
int remaining_width = x + width - child_x;
|
|
|
|
double remaining_width = x + width - child_x;
|
|
|
|
arrange_windows(child, remaining_width, height);
|
|
|
|
arrange_windows(child, remaining_width, height);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
arrange_windows(child, child->box.width * scale, height);
|
|
|
|
arrange_windows(child, child->width * scale, height);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
child_x += child->box.width;
|
|
|
|
child_x += child->width;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// update focused view border last because it may
|
|
|
|
// update focused view border last because it may
|
|
|
@ -377,49 +380,50 @@ static void apply_horiz_layout(struct sway_container *container,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void apply_vert_layout(struct sway_container *container,
|
|
|
|
void apply_vert_layout(struct sway_container *container,
|
|
|
|
const int x, const int y, const int width, const int height,
|
|
|
|
const double x, const double y,
|
|
|
|
const int start, const int end) {
|
|
|
|
const double width, const double height, const int start,
|
|
|
|
|
|
|
|
const int end) {
|
|
|
|
int i;
|
|
|
|
int i;
|
|
|
|
double scale = 0;
|
|
|
|
double scale = 0;
|
|
|
|
// Calculate total height
|
|
|
|
// Calculate total height
|
|
|
|
for (i = start; i < end; ++i) {
|
|
|
|
for (i = start; i < end; ++i) {
|
|
|
|
struct sway_container *child = container->children->items[i];
|
|
|
|
double *old_height =
|
|
|
|
int old_height = child->box.height;
|
|
|
|
&((struct sway_container *)container->children->items[i])->height;
|
|
|
|
if (old_height <= 0) {
|
|
|
|
if (*old_height <= 0) {
|
|
|
|
if (end - start > 1) {
|
|
|
|
if (end - start > 1) {
|
|
|
|
old_height = height / (end - start - 1);
|
|
|
|
*old_height = height / (end - start - 1);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
old_height = height;
|
|
|
|
*old_height = height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
scale += old_height;
|
|
|
|
scale += *old_height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
scale = height / scale;
|
|
|
|
scale = height / scale;
|
|
|
|
|
|
|
|
|
|
|
|
// Resize
|
|
|
|
// Resize
|
|
|
|
int child_y = y;
|
|
|
|
double child_y = y;
|
|
|
|
if (scale > 0.1) {
|
|
|
|
if (scale > 0.1) {
|
|
|
|
wlr_log(L_DEBUG, "Arranging %p vertically", container);
|
|
|
|
wlr_log(L_DEBUG, "Arranging %p vertically", container);
|
|
|
|
for (i = start; i < end; ++i) {
|
|
|
|
for (i = start; i < end; ++i) {
|
|
|
|
struct sway_container *child = container->children->items[i];
|
|
|
|
struct sway_container *child = container->children->items[i];
|
|
|
|
wlr_log(L_DEBUG,
|
|
|
|
wlr_log(L_DEBUG,
|
|
|
|
"Calculating arrangement for %p:%d (will scale %d by %f)",
|
|
|
|
"Calculating arrangement for %p:%d (will scale %f by %f)",
|
|
|
|
child, child->type, height, scale);
|
|
|
|
child, child->type, height, scale);
|
|
|
|
if (child->type == C_VIEW) {
|
|
|
|
if (child->type == C_VIEW) {
|
|
|
|
view_configure(child->sway_view, x, child_y,
|
|
|
|
view_configure(child->sway_view, x, child_y, child->width,
|
|
|
|
child->box.width, child->box.height);
|
|
|
|
child->height);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
child->box.x = x;
|
|
|
|
child->x = x;
|
|
|
|
child->box.y = child_y;
|
|
|
|
child->y = child_y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (i == end - 1) {
|
|
|
|
if (i == end - 1) {
|
|
|
|
int remaining_height = y + height - child_y;
|
|
|
|
double remaining_height = y + height - child_y;
|
|
|
|
arrange_windows(child, width, remaining_height);
|
|
|
|
arrange_windows(child, width, remaining_height);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
arrange_windows(child, width, child->box.height * scale);
|
|
|
|
arrange_windows(child, width, child->height * scale);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
child_y += child->box.height;
|
|
|
|
child_y += child->height;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// update focused view border last because it may
|
|
|
|
// update focused view border last because it may
|
|
|
@ -492,18 +496,18 @@ static void get_layout_center_position(struct sway_container *container,
|
|
|
|
int *x, int *y) {
|
|
|
|
int *x, int *y) {
|
|
|
|
// FIXME view coords are inconsistently referred to in layout/output systems
|
|
|
|
// FIXME view coords are inconsistently referred to in layout/output systems
|
|
|
|
if (container->type == C_OUTPUT) {
|
|
|
|
if (container->type == C_OUTPUT) {
|
|
|
|
*x = container->box.x + container->box.width / 2;
|
|
|
|
*x = container->x + container->width/2;
|
|
|
|
*y = container->box.y + container->box.height / 2;
|
|
|
|
*y = container->y + container->height/2;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
struct sway_container *output = container_parent(container, C_OUTPUT);
|
|
|
|
struct sway_container *output = container_parent(container, C_OUTPUT);
|
|
|
|
if (container->type == C_WORKSPACE) {
|
|
|
|
if (container->type == C_WORKSPACE) {
|
|
|
|
// Workspace coordinates are actually wrong/arbitrary, but should
|
|
|
|
// Workspace coordinates are actually wrong/arbitrary, but should
|
|
|
|
// be same as output.
|
|
|
|
// be same as output.
|
|
|
|
*x = output->box.x;
|
|
|
|
*x = output->x;
|
|
|
|
*y = output->box.y;
|
|
|
|
*y = output->y;
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
*x = output->box.x + container->box.x;
|
|
|
|
*x = output->x + container->x;
|
|
|
|
*y = output->box.y + container->box.y;
|
|
|
|
*y = output->y + container->y;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -674,14 +678,14 @@ struct sway_container *container_replace_child(struct sway_container *child,
|
|
|
|
child->parent = NULL;
|
|
|
|
child->parent = NULL;
|
|
|
|
|
|
|
|
|
|
|
|
// Set geometry for new child
|
|
|
|
// Set geometry for new child
|
|
|
|
new_child->box.x = child->box.x;
|
|
|
|
new_child->x = child->x;
|
|
|
|
new_child->box.y = child->box.y;
|
|
|
|
new_child->y = child->y;
|
|
|
|
new_child->box.width = child->box.width;
|
|
|
|
new_child->width = child->width;
|
|
|
|
new_child->box.height = child->box.height;
|
|
|
|
new_child->height = child->height;
|
|
|
|
|
|
|
|
|
|
|
|
// reset geometry for child
|
|
|
|
// reset geometry for child
|
|
|
|
child->box.width = 0;
|
|
|
|
child->width = 0;
|
|
|
|
child->box.height = 0;
|
|
|
|
child->height = 0;
|
|
|
|
|
|
|
|
|
|
|
|
return parent;
|
|
|
|
return parent;
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -697,10 +701,10 @@ struct sway_container *container_split(struct sway_container *child,
|
|
|
|
wlr_log(L_DEBUG, "creating container %p around %p", cont, child);
|
|
|
|
wlr_log(L_DEBUG, "creating container %p around %p", cont, child);
|
|
|
|
|
|
|
|
|
|
|
|
cont->prev_layout = L_NONE;
|
|
|
|
cont->prev_layout = L_NONE;
|
|
|
|
cont->box.width = child->box.width;
|
|
|
|
cont->width = child->width;
|
|
|
|
cont->box.height = child->box.height;
|
|
|
|
cont->height = child->height;
|
|
|
|
cont->box.x = child->box.x;
|
|
|
|
cont->x = child->x;
|
|
|
|
cont->box.y = child->box.y;
|
|
|
|
cont->y = child->y;
|
|
|
|
|
|
|
|
|
|
|
|
if (child->type == C_WORKSPACE) {
|
|
|
|
if (child->type == C_WORKSPACE) {
|
|
|
|
struct sway_seat *seat = input_manager_get_default_seat(input_manager);
|
|
|
|
struct sway_seat *seat = input_manager_get_default_seat(input_manager);
|
|
|
@ -733,10 +737,10 @@ void container_recursive_resize(struct sway_container *container,
|
|
|
|
bool layout_match = true;
|
|
|
|
bool layout_match = true;
|
|
|
|
wlr_log(L_DEBUG, "Resizing %p with amount: %f", container, amount);
|
|
|
|
wlr_log(L_DEBUG, "Resizing %p with amount: %f", container, amount);
|
|
|
|
if (edge == RESIZE_EDGE_LEFT || edge == RESIZE_EDGE_RIGHT) {
|
|
|
|
if (edge == RESIZE_EDGE_LEFT || edge == RESIZE_EDGE_RIGHT) {
|
|
|
|
container->box.width += amount;
|
|
|
|
container->width += amount;
|
|
|
|
layout_match = container->layout == L_HORIZ;
|
|
|
|
layout_match = container->layout == L_HORIZ;
|
|
|
|
} else if (edge == RESIZE_EDGE_TOP || edge == RESIZE_EDGE_BOTTOM) {
|
|
|
|
} else if (edge == RESIZE_EDGE_TOP || edge == RESIZE_EDGE_BOTTOM) {
|
|
|
|
container->box.height += amount;
|
|
|
|
container->height += amount;
|
|
|
|
layout_match = container->layout == L_VERT;
|
|
|
|
layout_match = container->layout == L_VERT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (container->children) {
|
|
|
|
if (container->children) {
|
|
|
|