Merge pull request #360 from sce/fix_arrange_windows

Fix arrange windows
This commit is contained in:
Drew DeVault 2015-12-18 18:39:02 -05:00
commit 2ab4e5676e

View file

@ -422,10 +422,9 @@ static void arrange_windows_r(swayc_t *container, double width, double height) {
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) {
swayc_t *child = container->children->items[i]; swayc_t *output = container->children->items[i];
sway_log(L_DEBUG, "Arranging output at %d", x); sway_log(L_DEBUG, "Arranging output '%s' at %f,%f", output->name, output->x, output->y);
arrange_windows_r(child, -1, -1); arrange_windows_r(output, -1, -1);
x += child->width;
} }
return; return;
case C_OUTPUT: case C_OUTPUT:
@ -451,11 +450,12 @@ static void arrange_windows_r(swayc_t *container, double width, double height) {
case C_WORKSPACE: case C_WORKSPACE:
{ {
swayc_t *output = swayc_parent_by_type(container, C_OUTPUT); swayc_t *output = swayc_parent_by_type(container, C_OUTPUT);
int width = output->width, height = output->height; width = output->width, height = output->height;
for (i = 0; i < desktop_shell.panels->length; ++i) { for (i = 0; i < desktop_shell.panels->length; ++i) {
struct panel_config *config = desktop_shell.panels->items[i]; struct panel_config *config = desktop_shell.panels->items[i];
if (config->output == output->handle) { if (config->output == output->handle) {
struct wlc_size size = *wlc_surface_get_size(config->surface); struct wlc_size size = *wlc_surface_get_size(config->surface);
sway_log(L_DEBUG, "-> Found panel for this workspace: %ux%u, position: %u", size.w, size.h, desktop_shell.panel_position);
switch (desktop_shell.panel_position) { switch (desktop_shell.panel_position) {
case DESKTOP_SHELL_PANEL_POSITION_TOP: case DESKTOP_SHELL_PANEL_POSITION_TOP:
y += size.h; height -= size.h; y += size.h; height -= size.h;
@ -473,12 +473,11 @@ static void arrange_windows_r(swayc_t *container, double width, double height) {
} }
} }
int gap = swayc_gap(container); int gap = swayc_gap(container);
container->x = gap; container->x = x + gap;
container->y = gap; container->y = y + gap;
container->width = width - gap * 2; width = container->width = width - gap * 2;
container->height = height - gap * 2; height = container->height = height - gap * 2;
sway_log(L_DEBUG, "Arranging workspace #%d at %f, %f", i, container->x, container->y); sway_log(L_DEBUG, "Arranging workspace '%s' at %f, %f", container->name, container->x, container->y);
} }
// children are properly handled below // children are properly handled below
break; break;