summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2015-11-29 13:59:12 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2015-11-29 13:59:12 -0500
commitef91764bc721633b335af8d5be051db21a9b7eea (patch)
treee7b53fa4a8720028cb886e25f06b8864867547c4
parentSupport desktop shell panels in compositor (diff)
downloadsway-ef91764bc721633b335af8d5be051db21a9b7eea.tar.gz
sway-ef91764bc721633b335af8d5be051db21a9b7eea.tar.zst
sway-ef91764bc721633b335af8d5be051db21a9b7eea.zip
Fix output adjustment for panels
-rw-r--r--sway/layout.c64
1 files changed, 34 insertions, 30 deletions
diff --git a/sway/layout.c b/sway/layout.c
index 70980ec3..5081724a 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -427,39 +427,43 @@ static void arrange_windows_r(swayc_t *container, double width, double height) {
427 } 427 }
428 return; 428 return;
429 case C_OUTPUT: 429 case C_OUTPUT:
430 for (i = 0; i < desktop_shell.panels->length; ++i) { 430 {
431 struct panel_config *config = desktop_shell.panels->items[i]; 431 struct wlc_size resolution = *wlc_output_get_resolution(container->handle);
432 if (config->output == container->handle) { 432 width = resolution.w; height = resolution.h;
433 struct wlc_size size = *wlc_surface_get_size(config->surface); 433 for (i = 0; i < desktop_shell.panels->length; ++i) {
434 switch (desktop_shell.panel_position) { 434 struct panel_config *config = desktop_shell.panels->items[i];
435 case DESKTOP_SHELL_PANEL_POSITION_TOP: 435 if (config->output == container->handle) {
436 y += size.h; height -= size.h; 436 struct wlc_size size = *wlc_surface_get_size(config->surface);
437 break; 437 switch (desktop_shell.panel_position) {
438 case DESKTOP_SHELL_PANEL_POSITION_BOTTOM: 438 case DESKTOP_SHELL_PANEL_POSITION_TOP:
439 height -= size.h; 439 y += size.h; height -= size.h;
440 break; 440 break;
441 case DESKTOP_SHELL_PANEL_POSITION_LEFT: 441 case DESKTOP_SHELL_PANEL_POSITION_BOTTOM:
442 x += size.w; width -= size.w; 442 height -= size.h;
443 break; 443 break;
444 case DESKTOP_SHELL_PANEL_POSITION_RIGHT: 444 case DESKTOP_SHELL_PANEL_POSITION_LEFT:
445 width -= size.w; 445 x += size.w; width -= size.w;
446 break; 446 break;
447 case DESKTOP_SHELL_PANEL_POSITION_RIGHT:
448 width -= size.w;
449 break;
450 }
447 } 451 }
448 } 452 }
449 }
450 453
451 container->width = width; 454 container->width = width;
452 container->height = height; 455 container->height = height;
453 x = 0, y = 0; 456 x = 0, y = 0;
454 for (i = 0; i < container->children->length; ++i) { 457 for (i = 0; i < container->children->length; ++i) {
455 swayc_t *child = container->children->items[i]; 458 swayc_t *child = container->children->items[i];
456 int gap = swayc_gap(child); 459 int gap = swayc_gap(child);
457 child->x = x + gap; 460 child->x = x + gap;
458 child->y = y + gap; 461 child->y = y + gap;
459 child->width = width - gap * 2; 462 child->width = width - gap * 2;
460 child->height = height - gap * 2; 463 child->height = height - gap * 2;
461 sway_log(L_DEBUG, "Arranging workspace #%d at %f, %f", i, child->x, child->y); 464 sway_log(L_DEBUG, "Arranging workspace #%d at %f, %f", i, child->x, child->y);
462 arrange_windows_r(child, -1, -1); 465 arrange_windows_r(child, -1, -1);
466 }
463 } 467 }
464 return; 468 return;
465 case C_VIEW: 469 case C_VIEW: