summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2015-12-18 18:39:02 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2015-12-18 18:39:02 -0500
commit2ab4e5676e1dc0ddd4323a1cce6a3060ccf4f8c0 (patch)
treebdb39a9a045f3fb8d3a2e08d3d77e34f053730a2
parentDrop sway-xorg.desktop (diff)
parentlayout: arrange_windows: Partially fix swaybar irregularties. (diff)
downloadsway-2ab4e5676e1dc0ddd4323a1cce6a3060ccf4f8c0.tar.gz
sway-2ab4e5676e1dc0ddd4323a1cce6a3060ccf4f8c0.tar.zst
sway-2ab4e5676e1dc0ddd4323a1cce6a3060ccf4f8c0.zip
Merge pull request #360 from sce/fix_arrange_windows
Fix arrange windows
-rw-r--r--sway/layout.c21
1 files changed, 10 insertions, 11 deletions
diff --git a/sway/layout.c b/sway/layout.c
index 97c857a1..5b7dc486 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -422,10 +422,9 @@ static void arrange_windows_r(swayc_t *container, double width, double height) {
422 switch (container->type) { 422 switch (container->type) {
423 case C_ROOT: 423 case C_ROOT:
424 for (i = 0; i < container->children->length; ++i) { 424 for (i = 0; i < container->children->length; ++i) {
425 swayc_t *child = container->children->items[i]; 425 swayc_t *output = container->children->items[i];
426 sway_log(L_DEBUG, "Arranging output at %d", x); 426 sway_log(L_DEBUG, "Arranging output '%s' at %f,%f", output->name, output->x, output->y);
427 arrange_windows_r(child, -1, -1); 427 arrange_windows_r(output, -1, -1);
428 x += child->width;
429 } 428 }
430 return; 429 return;
431 case C_OUTPUT: 430 case C_OUTPUT:
@@ -451,11 +450,12 @@ static void arrange_windows_r(swayc_t *container, double width, double height) {
451 case C_WORKSPACE: 450 case C_WORKSPACE:
452 { 451 {
453 swayc_t *output = swayc_parent_by_type(container, C_OUTPUT); 452 swayc_t *output = swayc_parent_by_type(container, C_OUTPUT);
454 int width = output->width, height = output->height; 453 width = output->width, height = output->height;
455 for (i = 0; i < desktop_shell.panels->length; ++i) { 454 for (i = 0; i < desktop_shell.panels->length; ++i) {
456 struct panel_config *config = desktop_shell.panels->items[i]; 455 struct panel_config *config = desktop_shell.panels->items[i];
457 if (config->output == output->handle) { 456 if (config->output == output->handle) {
458 struct wlc_size size = *wlc_surface_get_size(config->surface); 457 struct wlc_size size = *wlc_surface_get_size(config->surface);
458 sway_log(L_DEBUG, "-> Found panel for this workspace: %ux%u, position: %u", size.w, size.h, desktop_shell.panel_position);
459 switch (desktop_shell.panel_position) { 459 switch (desktop_shell.panel_position) {
460 case DESKTOP_SHELL_PANEL_POSITION_TOP: 460 case DESKTOP_SHELL_PANEL_POSITION_TOP:
461 y += size.h; height -= size.h; 461 y += size.h; height -= size.h;
@@ -473,12 +473,11 @@ static void arrange_windows_r(swayc_t *container, double width, double height) {
473 } 473 }
474 } 474 }
475 int gap = swayc_gap(container); 475 int gap = swayc_gap(container);
476 container->x = gap; 476 container->x = x + gap;
477 container->y = gap; 477 container->y = y + gap;
478 container->width = width - gap * 2; 478 width = container->width = width - gap * 2;
479 container->height = height - gap * 2; 479 height = container->height = height - gap * 2;
480 sway_log(L_DEBUG, "Arranging workspace #%d at %f, %f", i, container->x, container->y); 480 sway_log(L_DEBUG, "Arranging workspace '%s' at %f, %f", container->name, container->x, container->y);
481
482 } 481 }
483 // children are properly handled below 482 // children are properly handled below
484 break; 483 break;