diff options
author | Drew DeVault <sir@cmpwn.com> | 2015-12-18 08:40:52 -0500 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2015-12-18 08:40:52 -0500 |
commit | 7f7be26cfe3eeab07fce9333c8204f1623b42bb5 (patch) | |
tree | 93caf2a4888f79bdcb639e2b38ef81958c2cf724 | |
parent | Merge pull request #355 from sce/fix_moving_last_ws (diff) | |
parent | layout: Keep output at the correct size, workspace can be smaller. (diff) | |
download | sway-7f7be26cfe3eeab07fce9333c8204f1623b42bb5.tar.gz sway-7f7be26cfe3eeab07fce9333c8204f1623b42bb5.tar.zst sway-7f7be26cfe3eeab07fce9333c8204f1623b42bb5.zip |
Merge pull request #356 from sce/output_vs_workspace_size
layout: Keep output at the correct size, workspace can be smaller.
-rw-r--r-- | sway/layout.c | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/sway/layout.c b/sway/layout.c index 08d06d0b..97c857a1 100644 --- a/sway/layout.c +++ b/sway/layout.c | |||
@@ -432,9 +432,29 @@ static void arrange_windows_r(swayc_t *container, double width, double height) { | |||
432 | { | 432 | { |
433 | struct wlc_size resolution = *wlc_output_get_resolution(container->handle); | 433 | struct wlc_size resolution = *wlc_output_get_resolution(container->handle); |
434 | width = resolution.w; height = resolution.h; | 434 | width = resolution.w; height = resolution.h; |
435 | // output must have correct size due to e.g. seamless mouse, | ||
436 | // but a workspace might be smaller depending on panels. | ||
437 | container->width = width; | ||
438 | container->height = height; | ||
439 | } | ||
440 | // arrange all workspaces: | ||
441 | for (i = 0; i < container->children->length; ++i) { | ||
442 | swayc_t *child = container->children->items[i]; | ||
443 | arrange_windows_r(child, -1, -1); | ||
444 | } | ||
445 | // Bring all unmanaged views to the front | ||
446 | for (i = 0; i < container->unmanaged->length; ++i) { | ||
447 | wlc_handle *handle = container->unmanaged->items[i]; | ||
448 | wlc_view_bring_to_front(*handle); | ||
449 | } | ||
450 | return; | ||
451 | case C_WORKSPACE: | ||
452 | { | ||
453 | swayc_t *output = swayc_parent_by_type(container, C_OUTPUT); | ||
454 | int width = output->width, height = output->height; | ||
435 | for (i = 0; i < desktop_shell.panels->length; ++i) { | 455 | for (i = 0; i < desktop_shell.panels->length; ++i) { |
436 | struct panel_config *config = desktop_shell.panels->items[i]; | 456 | struct panel_config *config = desktop_shell.panels->items[i]; |
437 | if (config->output == container->handle) { | 457 | if (config->output == output->handle) { |
438 | struct wlc_size size = *wlc_surface_get_size(config->surface); | 458 | struct wlc_size size = *wlc_surface_get_size(config->surface); |
439 | switch (desktop_shell.panel_position) { | 459 | switch (desktop_shell.panel_position) { |
440 | case DESKTOP_SHELL_PANEL_POSITION_TOP: | 460 | case DESKTOP_SHELL_PANEL_POSITION_TOP: |
@@ -452,27 +472,16 @@ static void arrange_windows_r(swayc_t *container, double width, double height) { | |||
452 | } | 472 | } |
453 | } | 473 | } |
454 | } | 474 | } |
475 | int gap = swayc_gap(container); | ||
476 | container->x = gap; | ||
477 | container->y = gap; | ||
478 | container->width = width - gap * 2; | ||
479 | container->height = height - gap * 2; | ||
480 | sway_log(L_DEBUG, "Arranging workspace #%d at %f, %f", i, container->x, container->y); | ||
455 | 481 | ||
456 | container->width = width; | ||
457 | container->height = height; | ||
458 | for (i = 0; i < container->children->length; ++i) { | ||
459 | swayc_t *child = container->children->items[i]; | ||
460 | int gap = swayc_gap(child); | ||
461 | child->x = x + gap; | ||
462 | child->y = y + gap; | ||
463 | child->width = width - gap * 2; | ||
464 | child->height = height - gap * 2; | ||
465 | sway_log(L_DEBUG, "Arranging workspace #%d at %f, %f", i, child->x, child->y); | ||
466 | arrange_windows_r(child, -1, -1); | ||
467 | } | ||
468 | |||
469 | // Bring all unmanaged views to the front | ||
470 | for (i = 0; i < container->unmanaged->length; ++i) { | ||
471 | wlc_handle *handle = container->unmanaged->items[i]; | ||
472 | wlc_view_bring_to_front(*handle); | ||
473 | } | ||
474 | } | 482 | } |
475 | return; | 483 | // children are properly handled below |
484 | break; | ||
476 | case C_VIEW: | 485 | case C_VIEW: |
477 | { | 486 | { |
478 | container->width = width; | 487 | container->width = width; |