diff options
Diffstat (limited to 'sway/tree/layout.c')
-rw-r--r-- | sway/tree/layout.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/sway/tree/layout.c b/sway/tree/layout.c index 49ec806e..2f22a3dd 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c | |||
@@ -117,9 +117,11 @@ struct sway_container *container_remove_child(struct sway_container *child) { | |||
117 | } | 117 | } |
118 | 118 | ||
119 | struct sway_container *parent = child->parent; | 119 | struct sway_container *parent = child->parent; |
120 | int index = index_child(child); | 120 | list_t *list = container_is_floating(child) ? |
121 | parent->sway_workspace->floating : parent->children; | ||
122 | int index = list_find(list, child); | ||
121 | if (index != -1) { | 123 | if (index != -1) { |
122 | list_del(parent->children, index); | 124 | list_del(list, index); |
123 | } | 125 | } |
124 | child->parent = NULL; | 126 | child->parent = NULL; |
125 | container_notify_subtree_changed(parent); | 127 | container_notify_subtree_changed(parent); |
@@ -160,7 +162,8 @@ void container_move_to(struct sway_container *container, | |||
160 | struct sway_container *old_output = | 162 | struct sway_container *old_output = |
161 | container_parent(container, C_OUTPUT); | 163 | container_parent(container, C_OUTPUT); |
162 | old_parent = container_remove_child(container); | 164 | old_parent = container_remove_child(container); |
163 | container_add_child(new_ws->sway_workspace->floating, container); | 165 | workspace_add_floating(new_ws, container); |
166 | container_handle_fullscreen_reparent(container, old_parent); | ||
164 | // If changing output, center it within the workspace | 167 | // If changing output, center it within the workspace |
165 | if (old_output != new_ws->parent && !container->is_fullscreen) { | 168 | if (old_output != new_ws->parent && !container->is_fullscreen) { |
166 | container_floating_move_to_center(container); | 169 | container_floating_move_to_center(container); |
@@ -431,9 +434,6 @@ void container_move(struct sway_container *container, | |||
431 | if ((index == parent->children->length - 1 && offs > 0) | 434 | if ((index == parent->children->length - 1 && offs > 0) |
432 | || (index == 0 && offs < 0)) { | 435 | || (index == 0 && offs < 0)) { |
433 | if (current->parent == container->parent) { | 436 | if (current->parent == container->parent) { |
434 | if (parent->parent->layout == L_FLOATING) { | ||
435 | return; | ||
436 | } | ||
437 | if (!parent->is_fullscreen && | 437 | if (!parent->is_fullscreen && |
438 | (parent->layout == L_TABBED || | 438 | (parent->layout == L_TABBED || |
439 | parent->layout == L_STACKED)) { | 439 | parent->layout == L_STACKED)) { |
@@ -457,14 +457,10 @@ void container_move(struct sway_container *container, | |||
457 | sibling = parent->children->items[index + offs]; | 457 | sibling = parent->children->items[index + offs]; |
458 | wlr_log(WLR_DEBUG, "Selecting sibling id:%zd", sibling->id); | 458 | wlr_log(WLR_DEBUG, "Selecting sibling id:%zd", sibling->id); |
459 | } | 459 | } |
460 | } else if (!parent->is_fullscreen && | 460 | } else if (!parent->is_fullscreen && (parent->layout == L_TABBED || |
461 | parent->parent->layout != L_FLOATING && | ||
462 | (parent->layout == L_TABBED || | ||
463 | parent->layout == L_STACKED)) { | 461 | parent->layout == L_STACKED)) { |
464 | move_out_of_tabs_stacks(container, current, move_dir, offs); | 462 | move_out_of_tabs_stacks(container, current, move_dir, offs); |
465 | return; | 463 | return; |
466 | } else if (parent->parent->layout == L_FLOATING) { | ||
467 | return; | ||
468 | } else { | 464 | } else { |
469 | wlr_log(WLR_DEBUG, "Moving up to find a parallel container"); | 465 | wlr_log(WLR_DEBUG, "Moving up to find a parallel container"); |
470 | current = current->parent; | 466 | current = current->parent; |
@@ -802,13 +798,15 @@ struct sway_container *container_replace_child(struct sway_container *child, | |||
802 | if (parent == NULL) { | 798 | if (parent == NULL) { |
803 | return NULL; | 799 | return NULL; |
804 | } | 800 | } |
805 | int i = index_child(child); | ||
806 | 801 | ||
807 | // TODO floating | 802 | list_t *list = container_is_floating(child) ? |
803 | parent->sway_workspace->floating : parent->children; | ||
804 | int i = list_find(list, child); | ||
805 | |||
808 | if (new_child->parent) { | 806 | if (new_child->parent) { |
809 | container_remove_child(new_child); | 807 | container_remove_child(new_child); |
810 | } | 808 | } |
811 | parent->children->items[i] = new_child; | 809 | list->items[i] = new_child; |
812 | new_child->parent = parent; | 810 | new_child->parent = parent; |
813 | child->parent = NULL; | 811 | child->parent = NULL; |
814 | 812 | ||
@@ -973,7 +971,8 @@ void container_swap(struct sway_container *con1, struct sway_container *con2) { | |||
973 | "Cannot swap ancestor and descendant")) { | 971 | "Cannot swap ancestor and descendant")) { |
974 | return; | 972 | return; |
975 | } | 973 | } |
976 | if (!sway_assert(con1->layout != L_FLOATING && con2->layout != L_FLOATING, | 974 | if (!sway_assert(!container_is_floating(con1) |
975 | && !container_is_floating(con2), | ||
977 | "Swapping with floating containers is not supported")) { | 976 | "Swapping with floating containers is not supported")) { |
978 | return; | 977 | return; |
979 | } | 978 | } |