Merge pull request #2471 from RyanDwyer/reap-when-floating

Attempt to reap old tiling parent when floating a container
This commit is contained in:
emersion 2018-08-17 13:37:39 +01:00 committed by GitHub
commit 754bbd03c0
Failed to generate hash of commit

View file

@ -1030,12 +1030,13 @@ void container_set_floating(struct sway_container *container, bool enable) {
struct sway_container *workspace = container_parent(container, C_WORKSPACE); struct sway_container *workspace = container_parent(container, C_WORKSPACE);
if (enable) { if (enable) {
container_remove_child(container); struct sway_container *old_parent = container_remove_child(container);
container_add_child(workspace->sway_workspace->floating, container); container_add_child(workspace->sway_workspace->floating, container);
container_init_floating(container); container_init_floating(container);
if (container->type == C_VIEW) { if (container->type == C_VIEW) {
view_set_tiled(container->sway_view, false); view_set_tiled(container->sway_view, false);
} }
container_reap_empty(old_parent);
} else { } else {
// Returning to tiled // Returning to tiled
if (container->scratchpad) { if (container->scratchpad) {