Merge pull request #1766 from emersion/fix-output-container-position

Fix output containers position
This commit is contained in:
emersion 2018-04-07 13:21:52 -04:00 committed by GitHub
commit a5d06b6e2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -30,26 +30,7 @@ static void output_layout_handle_change(struct wl_listener *listener,
root_container.width = layout_box->width; root_container.width = layout_box->width;
root_container.height = layout_box->height; root_container.height = layout_box->height;
for (int i = 0 ; i < root_container.children->length; ++i) { arrange_windows(&root_container, layout_box->width, layout_box->height);
struct sway_container *output_container =
root_container.children->items[i];
if (output_container->type != C_OUTPUT) {
continue;
}
struct sway_output *output = output_container->sway_output;
const struct wlr_box *output_box =
wlr_output_layout_get_box(output_layout, output->wlr_output);
if (!output_box) {
continue;
}
output_container->x = output_box->x;
output_container->y = output_box->y;
output_container->width = output_box->width;
output_container->height = output_box->height;
}
arrange_windows(&root_container, -1, -1);
} }
struct sway_container *container_set_layout(struct sway_container *container, struct sway_container *container_set_layout(struct sway_container *container,
@ -551,19 +532,19 @@ void arrange_windows(struct sway_container *container,
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];
const struct wlr_box *output_box = wlr_output_layout_get_box(
container->sway_root->output_layout,
output->sway_output->wlr_output);
output->x = output_box->x;
output->y = output_box->y;
output->width = output_box->width;
output->height = output_box->height;
wlr_log(L_DEBUG, "Arranging output '%s' at %f,%f", wlr_log(L_DEBUG, "Arranging output '%s' at %f,%f",
output->name, output->x, output->y); output->name, output->x, output->y);
arrange_windows(output, -1, -1); arrange_windows(output, output_box->width, output_box->height);
} }
return; return;
case C_OUTPUT: case C_OUTPUT:
{
int _width, _height;
wlr_output_effective_resolution(
container->sway_output->wlr_output, &_width, &_height);
width = container->width = _width;
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) {
struct sway_container *child = container->children->items[i]; struct sway_container *child = container->children->items[i];