When we have type safety we'll need to have functions for
workspace_add_tiling and so on. This means the existing container
functions will be just for containers, so they are being moved to
container.c. At this point layout.c doesn't contain much else, so I've
relocated everything and removed the file.
* container_swap and its static functions have been moved to the swap
command and made static.
* container_recursive_resize has been moved to the resize command and
made static.
* The following have been moved to container.c:
* container_handle_fullscreen_reparent
* container_insert_child
* container_add_sibling
* container_add_child
* container_remove_child
* container_replace_child
* container_split
* enum movement_direction and sway_dir_to_wlr have been moved to util.c.
Side note: Several commands included layout.h which then included
root.h. With layout.h gone, root.h has to be included by those commands.
This list includes disabled outputs.
When sway_container is demoted, we'll need to store the root's children
(ie. enabled outputs) in the sway_root. It makes sense to put these in a
list called `outputs`, so I'm renaming the existing list in advance.
* container_move is only called from the move command
* container_move_to was called from both the move command and the sticky
command, but the sticky command can easily not call it
* container_get_in_direction is only called from the focus command
Moving these functions to their respective commands gives better
separation of code and removes bloat from layout.c. These functions will
need to be refactored to take advantage of type safety, so separating
them will make this easier to refactor.
The following static functions have also been moved:
* is_parellel
* invert_movement
* move_offs
* container_limit
* workspace_rejigger
* move_out_of_tabs_stacks
* get_swayc_in_output_direction
They were all used by the move functions, except for the last one which
is used by focus.
Other changes:
* index_child has been renamed to container_sibling_index, moved to
container.c and made public
* sway_output_from_wlr has been renamed to output_from_wlr_output, moved
to output.c and made public
* container_handle_fullscreen_reparent has been made public
* sway_dir_to_wlr has been made public
No changes have been made to any of the moved functions, other than
updating calls to functions that have been renamed.
This changes the destroy functions to the following:
* output_begin_destroy
* output_destroy
* workspace_begin_destroy
* workspace_destroy
* container_begin_destroy
* container_destroy
* view_begin_destroy
* view_destroy
The terminology was `destroy` and `free`, and it has been changed to
`begin_destroy` and `destroy` respectively.
When the last output is disconnected, its workspaces will now be stashed
in the root. Upon connection of a new output they will be restored.
There is a new function `workspace_consider_destroy` which decides
whether the given workspace should be destroyed or not (ie. empty and
not visible).
Calling container_begin_destroy will no longer automatically reap the
parents. In some places we want to reap the parents and in some we
don't, so this is left to the caller.
container_reap_empty_recursive and container_reap_empty have been
combined into one function and it will recurse up the tree.
When a workspace is moved to another output, or the output it's on
changes its global layout position, the floating containers on that
workspace should be translated by the same amount as the workspace. This
keeps the floating containers in the same position relative to the
workspace.
A check is done to make sure the floating container's center point isn't
being moved off screen. If it is, it is centered within the workspace.
Fixes part of #2500.
Improves upon 18e425ed by using the first assigned workspace instead of
the last one. The order isn't explicitly guaranteed to be the same as in
the config, but in general works.
Fixes#2490.
To be honest I'm not sure why this fixes the issue.
I observed that I could only make the view jump if I resized it to the
smallest possible size first. Then I had a suspicion that we were
accidentally factoring in the title and border sizes into the view size
when it uses CSD. So I changed that and it appears to have fixed the
jumping issue.
I guess when we factor the title and borders in, we send a configure to
the surface with a size smaller than the minimum, and it comes back with
a surface at the minimum size. We interpret this as an unexpected
resize, and this somehow makes it jump.