O(`max`*`space.length`) ~ O(`space.length`) for finitely wide screens. Doesn't
seem like there's a large performance penalty to decide ties between
equidistant windows using the mru, instead of deciding ties by sorting on
left/right.
Mutter hands focus to the "highest" window when a window is closed. This means
we need to raise windows from the edges in towards the selected window, making
the neighbours of the selected window the next highest windows.
In particular since we propagate backwards last, the right neighbour will get
priority.
With the two previous commits we can now safely remove the `restacked` signal
watching. For some reason watching the signal is this way blocks clicks while things are
moving.
So now it's possible to eg. doubleclick on the left/right edge and jump
two places.
This is no longer necessary as we now raise windows when we know if they will be
visible after animation, which is much better than after animation is finished.
When we propagate the position forward/backward we check the desired position
against the left/right limits and stack the rest of the windows if it's the
case.
This also fixes the stack performance issue in a cleaner way. We simply raise
all non-stacked windows while propagating, instead of doing a fix-up afterwards.
When navigating workspaces in mru order animating the workspaces based on the
mru order gives a false sense of spatiallity. Instead simply animate the
previewed workspace from the bottom and animate the last workspace down.
`selectedWindow` isn't necessarily a visible window, eg. when we're doing
previews, so just do a search from the start/end up until we find the last
stackd window.
The bottleneck when calling ensure seems to be calling lower on every window on
the left/right stack.
This is a quick fix, where we simply call raise on the top of the left/right
stack, and the visible windows.
A consequence of this change is the left/right stacks might be above a visible
window for a short time, but it's not very noticeable.
When there's only workspaces on the primary display, moving a window to another
monitor makes it `stick`. In the past this would make it part of the scratch
layer, but that's not the case anymore, so it would just be detached and
attached to the workspace again.
This makes it possible to simply drag a window from a space into another monitor
and it will detach and float on the monitor.
This makes it possible, with some work, to use a combination of above and
minimized to detect scratch windows. Leaving always visible on all workspaces
functional for multimonitor use.
As mentioned we need to use a combination of above and minimized since minimized
windows can't be above.
Restoration require the same settings object to be available due to the use of
Map. Indexing on the canonical name of the schema is probably a better solution.