Commit Graph

75 Commits

Author SHA1 Message Date
Tor Hedin Brønner
697f025c55 edge previews: remove after timeout 2019-11-13 15:38:27 +01:00
Tor Hedin Brønner
e680ba8946 ClickOverlay: Don't change monitors while in workspace preview 2019-11-12 13:45:54 +01:00
Tor Hedin Brønner
ba43c68ba8 edge overlays: start out unactivated
Be sane and start in a clean state.
2019-10-19 19:13:19 +02:00
Tor Hedin Brønner
b886665b08 clickOverlay: cover the entire monitor
We guard against small movements triggering monitor change already.
2019-10-18 16:11:21 +02:00
Tor Hedin Brønner
0653664dd3 clickOverlay: never activate when workspaces-only-on-primary
This means we can simply create clickOverlays for all the monitors, avoiding any
annyoing errors with missing overlays.
2019-10-18 16:10:41 +02:00
Tor Hedin Brønner
18fd713900 Use clutter animations
There's a few differences in how onComplete is run:
- We need to run moveDone on every clone transition, as the transitions aren't
done when cloneContainer's transition finishes
- We cannot run layout until startup is done. For some reason onComplete runs
before monitor setup is done properly.

squash! Use clutter animations

- Can't use addTween as a timeout, but transitions are now finished when
onComplete is run, so there's no need for this anymore.
2019-09-28 15:06:57 +02:00
Tor Hedin Brønner
7fb9f4a0c1 Fix full hot code reload
`getCurrentExtension()` does not work with gnome-shell-mode's eval. Use a
somewhat verbose feature detection to work around the changes made in 3.34.
2019-09-03 17:36:37 +02:00
Rasmus Eneman
f949799c37 Fix crash under Gnome 3.34 2019-08-30 08:16:23 +02:00
Ole Jørgen Brønner
4adfad7298 Bugfix: new jetbrains IDE window could crash insertWindow
In general: NPE in stackoverlay when target window is non-`TabList.NORMAL`
crashes `insertWindow` midway. (eg. size-changed signal never connected).

A `TabList.NORMAL` window is focusable and doesn't `mw.skip_taskbar`.

Example: The main window of pycharm on startup is (sometimes) non-normal(!).
Focusing the window fail so it's likely to become the stackoverlay target.

(java applications is a WM's worst nightmare..)
2019-08-24 09:20:14 +02:00
Tor Hedin Brønner
8e667c0c11 Require a threshold motion to trigger workspace switch
On multi monitor setups we usually want the monitor focus to follow the mouse
pointer since non-active workspaces don't react to the pointer at all.

Unfortunately it's not possible to warp the pointer from gnome-shell extensions
in wayland yet. The pointer will be left on an inactive monitor when switching
workspaces using the keyboard. This makes it extremely easy to trigger an motion
event and inadvertently switching monitor focus (in fact this simply happens the
moment we activate the motion listener).

So add a motion threshold to filter out pointer motions without user intent.
2019-07-01 22:07:57 +02:00
Tor Hedin Brønner
ff8d8c4d45 Stability: null out destroyed actors
Acting on destroyed actors crashes 3.32 so make sure to null out references.
2019-04-15 21:01:02 +02:00
Tor Hedin Brønner
c9bcebd1be stackoverlay: protect against acting on unmapped clone 2019-04-10 19:51:05 +02:00
Tor Hedin Brønner
621b7b728f Port to class in preparation for 3.32
see:
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/361

TODO: port the LayoutManager in minimap.js, though it looks like gjs won't
deprecrate Lang.Class yet, so it's probably fine to keep using it for now.
2019-03-24 03:49:36 +01:00
Tor Hedin Brønner
450359cd8a Make pressure barrier optional (false by default for now)
Set to false until we can figure out a good way to get it to work for multiple
monitors.
2019-03-02 18:29:42 +01:00
Tor Hedin Brønner
1ca729dc8a edge overlay: delay previews a tiny bit
This should prevent triggering previews when going across the overlay.
2019-03-01 12:19:53 +01:00
Tor Hedin Brønner
5456036e69 edge: Put into window group
This fixes a rather annoying bug where we're not able to interact with windows
floating above the edge overlays. (doesn't work on X11 I think).

It also makes the interaction with a fixed dock on the edges better.
2019-02-14 16:30:59 +01:00
Tor Hedin Brønner
1c5f5d9bad pressure barrier: position on monitor edges until workarea is fixed 2019-02-12 23:52:47 +01:00
Tor Hedin Brønner
98ea1ccb9b edge: Allow moving the pointer to other monitors after pressure
Mostly taken from dash-to-dock.

We remove the edge barrier after pressure is triggered, allowing the pointer to
move across monitors.

ref #94
2019-02-12 21:23:15 +01:00
Tor Hedin Brønner
2546b0d9e3 edge overlays: On fullscreen, only show with applied pressure 2019-02-05 10:39:26 +01:00
Ole Jørgen Brønner
19dd7b7ea2 Prevent clicks from reaching non-placable windows (X11)
When window_gap is largish it was possible to click on the non-placable
metawindow (between the stackoverlay and the neigbour window) - triggering #80.

L: left non-placable (clone)
R: right non-placable (clone)
G: gap/2
A/B: placable window

LGGAA..BBBGGR

Allocate `LGG - "guaranteed-resize-edge-width"` to the stackoverlay to ensure
it's impossible to click on the non-placable window below.

Ideally we'd only allocate L or maybe LG to the overlay. Note: We could add
special logic for wayland since #80 only affects X11.
2019-01-20 15:16:36 +01:00
Tor Hedin Brønner
cf5df363bf bug fix: always cover non placeable windows with overlay fully
fixes c8603d961a
2019-01-20 14:44:00 +01:00
Tor Hedin Brønner
a76bf3f2c8 edgeoverlays: react to button release
This is good practice as it gives the user a way to «undo» the action by moving
the pointer away.
2019-01-13 15:10:14 +01:00
Tor Hedin Brønner
d3e6e6ff61 edgeoverlays on-enter: only act on the target window 2019-01-11 17:12:31 +01:00
Tor Hedin Brønner
c8603d961a edgeoverlays: make it possible to mouse resize full width windows
Make sure the overlay is always at least 1 pixel wide, otherwise just cover the
windows at the edges.
2019-01-10 17:12:34 +01:00
Tor Hedin Brønner
0c79e8955b workspace overlay: add some negative padding
Interacting with a shared monitor edge could be pretty jarring as it was very
easy to trigger a workspace change.

We add some (10px) negative padding to decrease the problem.
2018-12-05 06:08:28 +01:00
Tor Hedin Brønner
6a6cc6699b workspace overlay: activate the highest stacked window on monitor
Ideally we wouldn't change window focus at all when moving the pointer to
another monitor. Unfortunately windows on a unactive workspace doesn't react to
pointer input (eg. scroll).

When the activate window is «stuck» we can preserve focus however. Otherwise we
select the top window on the newly active monitor.

An alternative would be to wait for button events to change workspace. This
could work okay, but the pointer wouldn't react to eg. window edges.
2018-12-05 06:03:23 +01:00
Tor Hedin Brønner
e1c92b5b6f workspace overlay: use motion-event
squash! workspace overlay: use motion-event

The motion-event is better suited to making sure the pointer is always able to
interact with the windows on a monitor.

Activating another workspace when moving scratch windows across monitors will
now cause issues. For instance moving a scratch window to another monitor with
they keyboard would reset focus back to the original monitor. So we simply let
the motion-event always take care of this.
2018-12-04 10:16:40 +01:00
Tor Hedin Brønner
ff2a7694de Separate overlay and visibility handling
We only need to calculate visible windows when we're ready to show window
actors again. This makes the tracking more robust as it should always be called
at the correct time.

`fixVisible` is replaced by `space.isPlaceable(metaWindow)` which checks if the
window actor can be placed at its clone's position. We simply call isPlaceable
from the main `moveDone` loop.
2018-08-27 20:33:34 +02:00
Tor Hedin Brønner
bc6e4da22f clickoverlays: don't show while the overview is active
fixes #72
2018-07-18 13:49:02 +02:00
Tor Hedin Brønner
a605dc4668 Clip tiled window actors to the monitor
fixes #61
2018-07-04 20:47:04 +02:00
Tor Hedin Brønner
2f27acc789 Hide clickoverlays when showing the overview 2018-07-03 00:08:40 +02:00
Tor Hedin Brønner
3548f219a2 Rename prefs.js to settings.js
prefs.js causes issues as its used to lauch the settings gui from eg. tweaks.
2018-07-02 22:31:55 +02:00
Tor Hedin Brønner
8e67ac3c49 Animate the cloneContainer instead of the clones
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`.
2018-07-02 15:01:03 +02:00
Tor Hedin Brønner
f783a56940 Ovelays are no longer in the window_group, so don't bother raising 2018-06-30 12:01:06 +02:00
Tor Hedin Brønner
3f381b0c5f edge overlays: Add overlays to the uiGroup
There's no reason to deal with stacking problems of the window_group
2018-06-29 13:56:06 +02:00
Tor Hedin Brønner
f011c6e0e9 Cleanup and some comments 2018-06-27 11:28:23 +02:00
Tor Hedin Brønner
be15267cb0 Track monitor overlay 2018-06-27 10:22:07 +02:00
Tor Hedin Brønner
b48ed8b2bd Activate workspace with focus when the mouse enters a monitor 2018-06-27 10:22:07 +02:00
Tor Hedin Brønner
ccc6249283 edge-overlays: Always cover the gap when targets are almost hidden
Instead of removing the gap when we're dealing with fullscreen or maximized
windows we remove it when the overlay is wider than 75 pixels.

Also fully cover all windows that aren't marked as `visible` by the space.
2018-06-25 16:50:44 +02:00
Tor Hedin Brønner
a7cc11107f edge-overlays: setTarget(metaWindow) -> setTarget(space, index)
Let the edge-overlays act on columns.
2018-06-25 16:50:44 +02:00
Tor Hedin Brønner
fc3628bad4 Refactor space into an array of columns
This sets us up for supporting vertical tiling.
2018-06-25 16:50:43 +02:00
Tor Hedin Brønner
ff17aa1aa3 clickoverlays: destroy any lingering previews on disable 2018-06-17 11:28:57 +02:00
Tor Hedin Brønner
f6c12ae55d clickoverlays: show a preview on hover 2018-06-05 21:23:42 +02:00
Tor Hedin Brønner
5827606a63 Constrain clickoverlays to 75 pixel width
We only replace windows with clones when their position isn't possible, ie. when
they're less than 75 pixels inside the space, they're maximized or fullescreen.

The clickoverlays is now mostly decoupled from the visible status of the window
actor. They now always target the first window with an edge outside the
monitor. The width however is limited to 75 pixels (unless the window isn't
visible) making eg. drag and drop and drop possible while edge clicking will
never send input to the window.

The clickoverlays will now also span the window gap which makes it possible to
click on windows that's just off the monitor.
2018-06-03 14:21:18 +02:00
Tor Hedin Brønner
632ff93ce7 Hide the clickoverlay when unwanted, show again on focus
This should fix the issues with the clickoverlay and the scratch layer, where
the overlay would be inactive after closing the scratch layer.
2018-06-03 00:49:49 +02:00
Tor Hedin Brønner
e0f2d4b12b Fix stupid typo 2018-05-15 19:58:09 +02:00
Tor Hedin Brønner
6942df947f Monitor preference changes
Introduces `prefs.js` with simple `settings::change` signal handling.

Also put workspace colors in the schema and draw them from there.
2018-05-15 16:31:01 +02:00
Tor Hedin Brønner
8dd4fcb82d ClickOverlay: Use button-press-event to activate windows
More reponsive than release
2018-05-08 12:19:09 +02:00
Tor Hedin Brønner
4297c8a6e2 Replace metaWindow.destinationX with moving windows pre-animation
Had to reorder setting the click overlay targets after calling `move`.
2018-05-01 15:40:11 +02:00
Tor Hedin Brønner
42aedba3b6 Use var for all top level declarations to avoid warnings
We're assessing all top level declarations from outside the original scope when
we're evaluating code. So everything should be `var`.

Classes are `let` bound so we should use var for `ClickOverlay` too, but there's
a bug in gnome-shell-mode making such statements not evaluate. We therefor wait
for that to be fixed.
2018-04-30 00:03:08 +02:00