When unfloating, return container to previously focused tiled container

This introduces seat_get_focus_inactive_tiling and updates
`focus mode_toggle` to use it instead, because the previous method
wasn't guaranteed to return a tiling view.
This commit is contained in:
Ryan Dwyer 2018-07-26 22:58:42 +10:00
parent 936168e740
commit da2a87f6c7
4 changed files with 32 additions and 13 deletions

View file

@ -1015,6 +1015,7 @@ void container_set_floating(struct sway_container *container, bool enable) {
return;
}
struct sway_seat *seat = input_manager_current_seat(input_manager);
struct sway_container *workspace = container_parent(container, C_WORKSPACE);
if (enable) {
@ -1029,8 +1030,10 @@ void container_set_floating(struct sway_container *container, bool enable) {
if (container->scratchpad) {
scratchpad_remove_container(container);
}
struct sway_container *sibling =
seat_get_focus_inactive_tiling(seat, workspace);
container_remove_child(container);
container_add_child(workspace, container);
container_add_child(sibling, container);
container->width = container->parent->width;
container->height = container->parent->height;
if (container->type == C_VIEW) {