Commit Graph
1117 Commits
Author SHA1 Message Date
Tor Hedin Brønner 84550d6717 Reparent the selection highlight on the window clone
This makes selection logic a lot more centralized and robust. In particular the
selection highlight will now consitently track the window clone.

Also introduce `showWindow` `animateWindow` and `isWindowAnimating` to wrap some
potentially changing structure.
2019-01-05 10:25:06 +01:00
Ole Jørgen Brønner 8af34fef92 layout: use _targetHeight in default height allocation
This fixes (mostly) issues with layout of constrained wayland windows.

eg. (* marks the selected window) slurp B:

layout
  column A* B
  ...
resize of constrained window B finishes (before A)
  trigger new layout (since target was not met)
  `allocateDefault` strive to keep A's height (yet to be changed)
  causing A to get all the height

We still have problems when the slurping the last window X (while X selected)
into a column with two constrained windows.
2019-01-05 10:16:54 +01:00
Ole Jørgen Brønner b504c95a0e Remove 'deferLayout' hack 2019-01-05 10:16:54 +01:00
Ole Jørgen Brønner fc7f89fc99 layout: Don't re-request the currently requested window size again
- We never request the window's _current_ size again
- Each time a resize is requested we mark the window with the targets
- These are cleared IF the request cause a resize
- Some windows are constrained and does not resize even when request != current
- Resizes can be async

This means that layout sometimes reach the state where:

currentSize != targetSize
targetSize == window's marked target

Happens when

a. An async window get a new size and a subsequent layout happens very quickly
   (before the window is actually resized)
b. A constrained window is laid out and both its actual size and "layout
   size" is unchanged from last layout.

   Ie. we treat a constrained window as using infinite long time to fulfill a
   request that is constrained to the window's current size.

(a) probably doesn't happen very often (?)
(b) is nice to avoid assuming such size-requests have a non-trivial cost.

    It does assume that a constrained window always responds the same way to
    requests for size S. Which obviously is not guaranteed. A window is free to
    change its constraints at any time.

    A constraint change due to changing discrete size increments will most
    likely trigger a resize though - which will trigger a relayout.

    And since we can't subscribe to constraint changes and layout isn't done on
    every action it's not obvious that we want a constraint change to suddenly
    become visible either.
2018-12-30 23:58:37 +01:00
Ole Jørgen Brønner e266004fb4 Regression after prev commit: fix layout of async wayland windows
The first async resize that completes cause a new layout which run using the
other async window's old size. This breaks layouts that request specific
heights (eg. slurp).

Most visible when slurping third window.

+ missing semicolons and treating targetHeight the same way in case of
un-resizable windows
2018-12-30 23:58:37 +01:00
Ole Jørgen Brønner ecb1e5a6ca Support vertical tiling resizing
`Space.layout` not accepts custom "column allocators" (per column)

An allocator allocates the available vertical space of the column.

The default column layout allocates the vertical space proportionally to the
member's existing height, but strives to preserve the height of the selected
window.

During a grab the grabWindow's geometry is never changed (as this is very
jarring for the user) and the column is laid out accordingly.

The layout triggered from grabEnd cleans things up (eg. if the grab-resize freed
up space not possible to allocate without moving the grab window)

Pending changes/cleanups:
- Rewrite `deferLayout` hack

Resolves #62
2018-12-30 23:58:37 +01:00
Ole Jørgen Brønner 1d84820ab1 Minimap: react to new space signal "full-layout"
full-layout: everything in the space can have changed
2018-12-30 23:58:37 +01:00
Ole Jørgen Brønner 7e0122cf86 Update selection height on resize
In preparation for vertical-tiling resizing
2018-12-30 23:58:37 +01:00
Ole Jørgen Brønner 5e4ef9478a Bugfix: moveDone triggered before all layout animations have started
`Space.layout` can cause a resize, causes a move_to, triggering `moveDone`
_before_ all layout animations are started. The actor and clones of the windows
to the right is swapped and subsequent layout animations are broken. (animating
the hidden clone)

Observable when slurping / barfing when there's 2-3 windows visible to the
right (NB: without the navigator visible)

EDIT: This fix assume layouts affecting the selected window run `ensureViewport`
manually if necessary, but note that `Space.layout` actually ensures the
selected window (although only when animating)
2018-12-30 23:58:37 +01:00
Ole Jørgen Brønner 03f21d81d8 layout: Use prefs.animation_time
ref: 529102add1
2018-12-29 04:27:50 +01:00
Tor Hedin Brønner e90e2787d9 grab: delay changing workspace until grab-op-end
`inGrab` is now an object containing some information when a grab is running.

Closes #90
2018-12-28 00:21:55 +01:00
Tor Hedin Brønner 9a53f29551 removeWindow: remove any clip on the actor
Move it from remove_handler
2018-12-27 23:10:58 +01:00
Tor Hedin Brønner 1efffd4d4a allocateClone: only set the clone's position, not size 2018-12-27 20:43:27 +01:00
Ole Jørgen Brønner 065cee5f5d log-viewer: don't break on log(multiline)
The assumption that every line was timestamped turned out to be wrong [1]
causing the skip filters to break (and distort the output)

Abandon timestamp and message on separate line. Print only the time part of the
timestamp to save horizontal space.
2018-12-23 19:03:47 +01:00
Ole Jørgen Brønner 80256f2215 examples/keybindings.js: window marks update
Goto mark when the it's already focused now selects previous (mru) window.

Quite common to just quickly check a marked window - more convenient to repeat
the binding instead of using super-tab.
2018-12-23 16:44:18 +01:00
Tor Hedin Brønner d04fcb372b Don't hide floating windows on visible workspaces 2018-12-21 16:26:44 +01:00
Ole Jørgen Brønner e9c51f30dd Minor regression: fix 2b61a909d 2018-12-20 14:21:29 +01:00
Tor Hedin Brønner 2b61a909db Another wrong global.get_pointer() usage 2018-12-19 21:28:47 +01:00
Ole Jørgen Brønner 21039ec6ec Bugfix: Pointer always warped when moving it to the bottom monitor 2018-12-19 21:24:04 +01:00
Ole Jørgen Brønner 0f745e0c86 Kill the built-in workspace animation more reliably (v3.28)
Specifically fixes (only in v3.28) that built-in workspace animation is visible
when moving mouse between monitors (changing the active monitor).

This problem appeared in 18eb343, disappeared in a8b23aa, and
reappeared in 9389d90 (consecutive commits)

I assume that prior to 18eb343 our own animation was active during the workspace
change. 18eb343 prevented a bunch of animations that didn't have any effect from
starting. Eg. ensureViewport and layout when they don't change anything. No
("paperwm") animation is thus run when changing the active monitor.

The workspace animation (v3.28) can also be suppressed by using
wm._blockAnimations prior to changing workspace.

Doing this when the navigator is active is easy, but there doesn't seem to be
suitable signals to catch all cases. (eg. we can't force our "workspace-changed"
handler to run before other handlers)

PS: This fix does not work for dialog windows so they're still
"workspace-animated" on monitor changes.
2018-12-19 21:07:29 +01:00
Ole Jørgen Brønner 1cc4c2f0d6 Regression: Prev commit (af3623e) broke new window animation
Try removing the Navigator.navigating and inPreview checks. In those cases the
clone should be visible.

Without those checks (together with the clone.get_parent check?) dialogs created
during animation is not hidden.

Also note that the unmapped description in af362e was wrong - unmapped is only
true a short period after the window is created.
2018-12-19 20:05:12 +01:00
Ole Jørgen Brønner af3632e900 Bugfix: dialogs created during animation was hidden
To reproduce: Close a window with a confirmation dialog while the minimap is
open (eg. gnome-terminal with a running program)

A umapped window is either
1. a window that has not yet been inserted into a space/the scratch layer
2. a window we don't manage (eg. dialogs) meaning its clone is unused and should
   not be shown.

Note that it's not unlikely that we'll start to manage dialog-clones in the
future (#92)
2018-12-19 17:10:50 +01:00
Ole Jørgen Brønner 7ade1ef1de Revert "Mark windows as unmapped while changing between monitors"
This reverts commit 48ac0268f6.

Did not seem to resolve the issue and it sometimes causes windows to be stuck in
a "unmapped" state. Eg. when suspending, resuming and unlocking on ubuntu 18.04
gnome 3.28 windowEnteredMonitor is called on the visible windows - marking them
as unmapped.
2018-12-19 16:39:39 +01:00
Tor Hedin Brønner 33db8b137b Fix typo 2018-12-19 13:03:38 +01:00
Tor Hedin Brønner 57cbc3f586 focus_handler: raise the first window in a space too
Starting on the first window in a space, creating a new window and then closing
it would leave the user with the second window active instead of the first as
expected. This happened because we would never fix the stack order of the first
window.
2018-12-18 17:40:22 +01:00
Tor Hedin Brønner 99e15f3a53 Remove any clips on WindowActors when floating 2018-12-18 15:24:14 +01:00
Tor Hedin Brønner 7a9548bbba fix typo 2018-12-17 22:21:57 +01:00
Tor Hedin Brønner d198a2a088 Don't use utils in extension.js
If utils fails to load we're not getting proper error messages as we're using it
outside a try block. Use `log` instead.

SyntaxErrors still doesn't return a proper trace unfortunately, though that's
perhaps better fixed in tooling. The alternative would be to run `Reflect.parse`
on the module file in the catch block returning that error instead...
2018-12-17 22:21:57 +01:00
Tor Hedin Brønner 8c086081a0 Get rid of pointer.get_position
pointer.get_position can report the wrong coordinates, use the simpler
global.get_pointer() instead.
2018-12-17 22:21:57 +01:00
Tor Hedin Brønner 529102add1 Add animation-time setting 2018-12-17 22:21:57 +01:00
Tor Hedin Brønner 74dd4bd068 Remove stray log 2018-12-17 20:54:49 +01:00
Tor Hedin Brønner 42f1c7e83e space.removeWindow: update space.visible 2018-12-16 13:56:05 +01:00
Tor Hedin Brønner a11b0cd5f3 fixup! Revert "moveDone: only move reactive windows"
Lost the tween guard in the previous revert.
2018-12-15 21:53:23 +01:00
Tor Hedin Brønner 39965a2d42 Revert "moveDone: only move reactive windows"
This reverts commit b138e9083e.

Revert "Fix fullscreen reactivity again"

This reverts commit d5bd0cf023.

This would've made it likely to trigger the mouse «freeze» on x11.
2018-12-15 21:43:16 +01:00
Tor Hedin Brønner d5bd0cf023 Fix fullscreen reactivity again
`unMovable` windows would never become reactive.

fixes b138e9083e
2018-12-14 21:12:55 +01:00
Tor Hedin Brønner c36cdebc99 Window clones: only allocate when WindowActor is allocated
Before we fixed the clone's position everytime it was allocated, eg. whenever we
would scroll a pixel.

Insetad we listen on the WindowActors allocation signal, which happens far less
as we don't move the WindowActor around much.
2018-12-14 17:51:22 +01:00
Tor Hedin Brønner b138e9083e moveDone: only move reactive windows 2018-12-14 16:44:46 +01:00
Tor Hedin Brønner fbd8f439b0 moveDone: record placeable tweening windows as visible
If we start animating before the window's tween is done we're suddenly in an
invalid state.
2018-12-14 16:42:44 +01:00
Tor Hedin Brønner 8ab7e79820 print_stacktrace: adapt to gnome-shell-mode's log handling 2018-12-14 13:14:53 +01:00
Tor Hedin Brønner e5938191e1 gestures: don't force edge alignment when selected is visible
If the selected window is still visible we don't forc alignment with the monitor
edges, making it possible to eg. center the first/last window with a touchpad.
2018-12-14 10:36:50 +01:00
Tor Hedin Brønner 48ac0268f6 Mark windows as unmapped while changing between monitors
This should fix moving windows between monitors again, and might solve the
scaling issue too.
2018-12-11 15:24:56 +01:00
Tor Hedin Brønner e7c0dd6b15 shell.sh: don't die on input from terminal 2018-12-10 22:30:39 +01:00
Tor Hedin Brønner 2d9332b283 Horizontal swipe: never end up in a offscreen window
In the case of overshooting the last/first window we could end up not having a
window under the pointer, resulting in going back to the starting window.

The code indicates that the intention was always to ensure at the end :/
2018-12-10 22:02:29 +01:00
Tor Hedin Brønner 7a894a9044 remove_handler: run removWindow before cleaning dead windows
Last commit caused a bunch of issues when closing windows as
`removeWindow` accesses the clone which no longer was there.
2018-12-10 21:29:52 +01:00
Tor Hedin Brønner b38fb8c11f Clean up window clones
This might be unnecessary, as I assume the clones will get garbage collected
automatically, but that does assume it's not part of the scene graph (ie. it
dosen't have a parent). Just as well to do it explicit.
2018-12-10 20:52:54 +01:00
Tor Hedin Brønner f092bfe642 moveDone: guard against doing anything with tweening windows
On wayland `move_frame` right after a resize might kill the resize for some
reason. We therefor delay moving windows that are tweening.
2018-12-10 20:52:54 +01:00
Ole Jørgen Brønner 8d8591d3c1 Ignore override-redirect windows completely
After a99c151 the we caused lots of
  meta_window_make_above: assertion '!window->override_redirect' failed
warnings in the log.

Most likely best to leave such windows alone.
2018-12-10 19:28:29 +01:00
Tor Hedin Brønner f59508d69b Partly revert last commit
Selection highlight logic dosen't support setting selectedWindow outside
ensureViewport.
2018-12-10 10:02:21 +01:00
Tor Hedin Brønner 32459be4db removeWindow: cleanup
Let `layout` take of `ensureViewport`.
2018-12-10 09:32:05 +01:00
Tor Hedin Brønner 4b3ff3ac93 Premeptively remove dead windows on focus
`worspace:window-removed` runs after `focus` which means ensureViewport can get
us into a bad state. Remove any dead neighbours while we're fixing the correct
stacking order.

In particular when we had this setup, where the numbers is the stacking order,
and `2` isn't fully visible:
| 3 | 1 | 2 |

closing `1` would focus `2` and `ensureViewport` would start scrolling it into
the view. `layout` would then remove `1` resulting `2` moving further (the width
of `1`) to the left.
2018-12-10 09:23:44 +01:00