diff options
Diffstat (limited to 'sway/tree/layout.c')
-rw-r--r-- | sway/tree/layout.c | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c index e13c2ac4..bea15f8a 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c | |||
@@ -405,7 +405,12 @@ void apply_vert_layout(struct sway_container *container, | |||
405 | wlr_log(L_DEBUG, | 405 | wlr_log(L_DEBUG, |
406 | "Calculating arrangement for %p:%d (will scale %f by %f)", | 406 | "Calculating arrangement for %p:%d (will scale %f by %f)", |
407 | child, child->type, height, scale); | 407 | child, child->type, height, scale); |
408 | view_set_position(child->sway_view, x, child_y); | 408 | if (child->type == C_VIEW) { |
409 | view_set_position(child->sway_view, x, child_y); | ||
410 | } else { | ||
411 | child->x = x; | ||
412 | child->y = child_y; | ||
413 | } | ||
409 | 414 | ||
410 | if (i == end - 1) { | 415 | if (i == end - 1) { |
411 | double remaining_height = y + height - child_y; | 416 | double remaining_height = y + height - child_y; |
@@ -691,34 +696,33 @@ struct sway_container *container_split(struct sway_container *child, | |||
691 | wlr_log(L_DEBUG, "creating container %p around %p", cont, child); | 696 | wlr_log(L_DEBUG, "creating container %p around %p", cont, child); |
692 | 697 | ||
693 | cont->prev_layout = L_NONE; | 698 | cont->prev_layout = L_NONE; |
694 | cont->layout = layout; | ||
695 | cont->width = child->width; | 699 | cont->width = child->width; |
696 | cont->height = child->height; | 700 | cont->height = child->height; |
697 | cont->x = child->x; | 701 | cont->x = child->x; |
698 | cont->y = child->y; | 702 | cont->y = child->y; |
699 | 703 | ||
700 | /* Container inherits all of workspaces children, layout and whatnot */ | ||
701 | if (child->type == C_WORKSPACE) { | 704 | if (child->type == C_WORKSPACE) { |
705 | struct sway_seat *seat = sway_input_manager_get_default_seat(input_manager); | ||
702 | struct sway_container *workspace = child; | 706 | struct sway_container *workspace = child; |
703 | // reorder focus | 707 | bool set_focus = (sway_seat_get_focus(seat) == workspace); |
704 | int i; | 708 | |
705 | for (i = 0; i < workspace->children->length; ++i) { | 709 | while (workspace->children->length) { |
706 | ((struct sway_container *)workspace->children->items[i])->parent = | 710 | struct sway_container *ws_child = workspace->children->items[0]; |
707 | cont; | 711 | container_remove_child(ws_child); |
712 | container_add_child(cont, ws_child); | ||
708 | } | 713 | } |
709 | 714 | ||
710 | // Swap children | ||
711 | list_t *tmp_list = workspace->children; | ||
712 | workspace->children = cont->children; | ||
713 | cont->children = tmp_list; | ||
714 | // add container to workspace chidren | ||
715 | container_add_child(workspace, cont); | 715 | container_add_child(workspace, cont); |
716 | // give them proper layouts | 716 | container_set_layout(workspace, layout); |
717 | cont->layout = workspace->workspace_layout; | 717 | |
718 | cont->prev_layout = workspace->prev_layout; | 718 | if (set_focus) { |
719 | } else { // Or is built around container | 719 | sway_seat_set_focus(seat, cont); |
720 | } | ||
721 | } else { | ||
722 | cont->layout = layout; | ||
720 | container_replace_child(child, cont); | 723 | container_replace_child(child, cont); |
721 | container_add_child(cont, child); | 724 | container_add_child(cont, child); |
722 | } | 725 | } |
726 | |||
723 | return cont; | 727 | return cont; |
724 | } | 728 | } |