Fix output adjustment for panels

This commit is contained in:
Drew DeVault 2015-11-29 13:59:12 -05:00
parent e59cffcea2
commit ef91764bc7

View file

@ -427,39 +427,43 @@ static void arrange_windows_r(swayc_t *container, double width, double height) {
} }
return; return;
case C_OUTPUT: case C_OUTPUT:
for (i = 0; i < desktop_shell.panels->length; ++i) { {
struct panel_config *config = desktop_shell.panels->items[i]; struct wlc_size resolution = *wlc_output_get_resolution(container->handle);
if (config->output == container->handle) { width = resolution.w; height = resolution.h;
struct wlc_size size = *wlc_surface_get_size(config->surface); for (i = 0; i < desktop_shell.panels->length; ++i) {
switch (desktop_shell.panel_position) { struct panel_config *config = desktop_shell.panels->items[i];
case DESKTOP_SHELL_PANEL_POSITION_TOP: if (config->output == container->handle) {
y += size.h; height -= size.h; struct wlc_size size = *wlc_surface_get_size(config->surface);
break; switch (desktop_shell.panel_position) {
case DESKTOP_SHELL_PANEL_POSITION_BOTTOM: case DESKTOP_SHELL_PANEL_POSITION_TOP:
height -= size.h; y += size.h; height -= size.h;
break; break;
case DESKTOP_SHELL_PANEL_POSITION_LEFT: case DESKTOP_SHELL_PANEL_POSITION_BOTTOM:
x += size.w; width -= size.w; height -= size.h;
break; break;
case DESKTOP_SHELL_PANEL_POSITION_RIGHT: case DESKTOP_SHELL_PANEL_POSITION_LEFT:
width -= size.w; x += size.w; width -= size.w;
break; break;
case DESKTOP_SHELL_PANEL_POSITION_RIGHT:
width -= size.w;
break;
}
} }
} }
}
container->width = width; container->width = width;
container->height = height; container->height = height;
x = 0, y = 0; x = 0, y = 0;
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 *child = container->children->items[i];
int gap = swayc_gap(child); int gap = swayc_gap(child);
child->x = x + gap; child->x = x + gap;
child->y = y + gap; child->y = y + gap;
child->width = width - gap * 2; child->width = width - gap * 2;
child->height = height - gap * 2; child->height = height - gap * 2;
sway_log(L_DEBUG, "Arranging workspace #%d at %f, %f", i, child->x, child->y); sway_log(L_DEBUG, "Arranging workspace #%d at %f, %f", i, child->x, child->y);
arrange_windows_r(child, -1, -1); arrange_windows_r(child, -1, -1);
}
} }
return; return;
case C_VIEW: case C_VIEW: