Only look at the neighbours of the closed window when selecting a new window.
Also raise the window on ensure, this way the stacking order works like an mru
for selectedWindow.
When a window actor is hidden its clone won't properly update its size, so we
manually fix it up in resizeHandler.
To complicate matters this bugs out the new window animation so we need to delay
connecting the `size-changed` signal.
The cloneContainer now lives inside a `cloneClip` clipping the cloneContainer
correctly when previewing workspaces.
`ensureViewport` and `move_to` simply moves the scrollContainer instead of
laying out all the clones. The actual windows are only synced up with the clones
position on `Space.moveDone`. Space.layout is run when the actualy clone layout
changes, eg. when a window changes size, or a window is added to the tiling.
`move_to` also computes the windows that should show their MetaWindowActor on
`moveDone` and sets up the clickoverlays at the edges correctly.
`space.cloneContainer`s animation target can be looked at `space.targetX`.
Similar to Minimap.layout, it will move through the tiling from left to right
laying out clones correctly in the space.cloneContainer.
A clone's animation target can be looked up using `clone.targetX`.
Doesn't make sense to revaluate each time the window changes workspace.
Also make it easier to control initial focus of scratch windows and removes
side-effects from add_filter.
We use this pattern all over the place:
```
signals = [ foo.connect('bar', handler) ];
signals.forEach(id => foo.disconnect(id));
```
So we abstract it into a class that keeps track of the state automatically.
A space now emits four signals (supplying these arguments):
1. `select`, which runs on `ensureViewport`
2. `window-added` (metaWindow, index, row)
3. `window-removed` (metaWindow, index, row)
4. `monitor-changed`, currently not used
The minimap hooks into these signals updating as necessary. This is a lot
cleaner and goes a long way untangling the minimap from the navigator. One nice
effect is proper support of adding and removing windows when the minimap is
active.
It also works better on wayland as there's less reliance on synchronous updates.
Let focus follow the selected window. This caused issues in the past, but seems
to work now. It actually makes the switch more reliable, squashing a weird bug
where changing to another after moving a window would trigger the native switch
workspace animation.
In `moveSizeHandler` we need to check the coordinates of the window against the
monitor because `metaWindow.get_monitor()` reports the old monitor.
We also need to force ensure when inserting a window into a workspace that's not
active.
When monitors actually change we try out some heuristics. In particular we make
sure that the previously active workspace is shown on its assigned
monitor (which might've changed).