Commit Graph

819 Commits

Author SHA1 Message Date
Tor Hedin Brønner
82ddc02716 Space.moveDone: Only block on grabbing a tiled window
When dragging a window to a shared secondary monitor, moveDone is blocked by
`inGrab`. However we only want this as long as the window haven't been detached
by window-entered-monitor.
2019-10-20 14:27:11 +02:00
Tor Hedin Brønner
196368d3ec tiling: Remove stray logging 2019-10-20 14:21:21 +02:00
Ole Jørgen Brønner
18b5507853 resize-actions: Increase "slack" and make it simpler to adjust
See https://gist.github.com/olejorgenb/434dcc616343a50d9d63f2a700ad89b7 for a
helper script to test various window constraints.

ref: #187
2019-10-20 11:48:47 +02:00
Tor Hedin Brønner
c7cbd847cc window-entered-monitor: Only act on grabbed windows 2019-10-19 20:53:11 +02: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
e290062253 insertWindow: Do not hide windows that are on all workspaces 2019-10-19 19:13:05 +02:00
Tor Hedin Brønner
c8b8d78636 insertWindow: Handle stuck windows minimally
When spawning windows on a secondary monitor, and there's
workspaces-only-on-primary, we simply want to connect the necessary signals and
make sure the window is shown.
2019-10-18 16:11:21 +02:00
Tor Hedin Brønner
d4838298d7 insertWindow: Make unstuck scratch windows stuck
When using `workspaces-only-primary` and a scratch window is moved from a
secondary monitor to the primary gnome-shell will make the window unstuck. So we
need to make it stuck again.
2019-10-18 16:11:21 +02:00
Tor Hedin Brønner
642640c66e switchMonitor: Handle workspaces-only-on-primary 2019-10-18 16:11:21 +02:00
Tor Hedin Brønner
540c07dda3 grab window: Handle workspaces only on primary correctly 2019-10-18 16:11:21 +02:00
Tor Hedin Brønner
9c962f02ba window-entered-monitor: Only handle grabs
We now have custom ways to move windows between monitors
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
8916dde666 spaces: add onlyOnPrimary property 2019-10-18 14:06:01 +02:00
Tor Hedin Brønner
10038d417a layout: Run ensureViewport on auto corrections too
`auto` doesn't ensure that the selected window is inside the viewport.
2019-10-17 23:44:03 +02:00
Tor Hedin Brønner
0239b4e7a5 Fix errors on X11 startup when auto spawning windows 2019-10-17 23:08:30 +02:00
Tor Hedin Brønner
c8dfaacb42 layout: Do not run any auto corrections when grabbing
NOTE: `animate` is false when grabbing. In general auto will cause an animate so
we disable it in the somewhat more general case.
2019-10-17 23:07:36 +02:00
Tor Hedin Brønner
710e1f9c92 layout: remove unnecessary code
This shouldn't be necessary as we update space.targetX before running
ensureViewport, so the target window will always be inside the view port.
2019-10-17 15:37:42 +02:00
Tor Hedin Brønner
ce94061df8 addWindow: On first window just center targetX, leave rest to layout
Do not set cloneContainer.x directly, this can cause jumps.

But we do want to center space.targetX so layout knows that it should center the
tiling.
2019-10-17 15:37:42 +02:00
Ole Jørgen Brønner
4c36d5d203 cycle-window-width: let Space.layout take care of moving the window
Old logic kept for scratch windows.

Combined with 8ec37f1 keep a rightmost positioned window rightmost after
shrinking.
2019-10-17 15:25:19 +02:00
Tor Hedin Brønner
81136e1b44 center first window 2019-10-16 14:06:15 +02:00
Tor Hedin Brønner
8ec37f1987 tiling: try to maximize the space when removing/adding windows
fixes #104
2019-10-16 14:06:15 +02:00
Tor Hedin Brønner
8d74e3c5f8 init: handle auto started applications
If there's a new workspace between `enable` and `startup-complete` we would miss
it, leaving us in a broken state.

In particular this happens when using dynamic workspaces and having a window
spawn on startup.
2019-10-15 19:27:48 +02:00
Tor Hedin Brønner
076cbb655e Fix new window handling in gnome shell version 3.28 to 3.32
The opacity hack does not work in 3.32 and less. In fact setting opacity on
`queue-redraw` can kill a windows visibility entirely for some reason. The
windowactor property are fine, but the actor still doesn't show up.

So lets just kludge this for compatibility :P

fixes #184
2019-10-14 16:55:29 +02:00
Tor Hedin Brønner
b3eee42762 window created: kill actor visibility on queue-redraw
Finally found a reliable solution for x11.

`first-frame` happens _after_ mutter has drawn the first frame. Meaning there's
a chance of seeing one broken frame (happens reliably with eg. gnome-tweaks).

This worked before as we hid the actor, but we now set opacity instead to work
around 3.34 not allocating hidden actors. opacity is apparently reset on the
first draw, meaning we need to set opacity between `window-created` and
`first-frame`, `queue-redraw` is the obvious choice here.
2019-10-11 11:48:07 +02:00
Tor Hedin Brønner
ad8e431b8c fixup: and animate existing window on insertion 2019-10-11 10:32:45 +02:00
Tor Hedin Brønner
cf716ea1e8 fixup: do not hide existing windows on new insert 2019-10-11 10:28:01 +02:00
Tor Hedin Brønner
fa3677e1fc Fix new window animation more
We try to make new windows be visible with opacity 0 as long as possible so
updates in the actor can be allocated correctly.
2019-10-11 09:14:17 +02:00
Tor Hedin Brønner
dd9b577e29 settings: Add use-default-background preference
Does not support timed backgrounds.

fixes #122
2019-10-10 18:40:28 +02:00
Tor Hedin Brønner
3af9d23d76 monitors: Add switch/move to monitor bindings 2019-10-10 15:15:39 +02:00
Tor Hedin Brønner
15c3f7e4fc layout: Set positions if immediately if not animating
No need for the ad-hoc fix in Space.init anymore.
2019-10-09 03:54:34 +02:00
Tor Hedin Brønner
a908d2a208 x11: fix unreactive floats on empty workspaces
Make sure space.targetX is synced, if it isn't moveDone won't get the chance to
remove the background tracker, which steals all mouse clicks.
2019-10-05 12:16:29 +02:00
Tor Hedin Brønner
fbd5dfbd5b startup: expose failures on startup
Pass the error notification utility to module.enable and use it in the startup
callback.
2019-10-01 17:11:27 +02:00
Tor Hedin Brønner
7988020aff workspaces-only-on-primary: ensure layout happens after overlay setup 2019-10-01 16:52:48 +02:00
Tor Hedin Brønner
8daee7ce38 Remove transition from tween calls 2019-09-28 16:20:42 +02:00
Tor Hedin Brønner
aa1cc2894b Fix reload visibility
Clutter's transition framework will delay painting the ease until some sort of
painting is requested or whatnat, even if duration == 0.

In particular on reload this means clones are invisible for quite a while.
Simply force positions on startup.
2019-09-28 16:19:48 +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
e5a7de21bb Fix floating clone positions
Floating windows tend not to trigger size-changed at all. Make sure we position
the clone correctly at least once.

Might of course be better to just run allocateClone when the actor is allocated
still, but I'm not entirely sure if the frame and actor is necessarily synced at
that point.
2019-09-26 13:28:52 +02:00
Tor Hedin Brønner
684b4352ba Fix resize allocation in 3.34
Instead of listening on the actor's allocation signal set the clones size when
the windew is resized. This works around 3.34 not allocating hidden actors.
2019-09-23 11:16:09 +02:00
Tor Hedin Brønner
88eacec974 3.34: fix new window animation
Clones will not update their graphic if their source is hidden. Temporally turn
opacity off to work around this limitation.
2019-09-15 07:19:41 +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
Tor Hedin Brønner
97aff27a92 3.34: work around new object.actor rule
For ClutterActors object.actor === object, which means our `clone.actor` naming
needs to change.

https://gitlab.gnome.org/GNOME/gnome-shell/blob/master/js/ui/environment.js#L232
2019-09-02 00:52:48 +02:00
Rasmus Eneman
f949799c37 Fix crash under Gnome 3.34 2019-08-30 08:16:23 +02:00
Ole Jørgen Brønner
611680e06b More robust determination of focus window when inserting new window
Seem the ordering of "focus", "window-created", "window-added" and "first-frame"
and the corresponding update of eg. global.display.focus_window and the mru list
is quite complicated and non-deterministic..

Some sampling reveals the following possible combinations on 3.28 X11:
fw = global.display.focus_window, mw = metaWindow in insertWindow (new window)

fw = mw  mw = mru0  !fw     fw = mru0  fw = mru1
false    false      false   false      false
false    false      false   true       false
false    true       false   false      true
false    true       true    false      false
true     false      false   false      true
true     true       false   true       false

So it's quite messy, but we can (hopefully) always rely on the currently
focused  ("adult") window to be in the mru.
2019-07-24 11:48:04 +02:00
Ole Jørgen Brønner
a4e7950d38 Bugfix: window actor of some floating windows was never shown
If a floating window initially was marked as is_on_all_workspaces the actor was
never shown (after the initial animateWindow)

fixes #156
2019-07-19 20:26:43 +02:00
Tor Hedin Brønner
98f4161e95 x11: force an animate cycle after workspace switches
When switching between monitors, we can get into a situation where windows
aren't taking mouse input, looks like a weird x11 bug.
2019-07-16 15:40:59 +02:00
Ole Jørgen Brønner
ba0c82f273 toggle-maximize-width: unmaximze if window is maximized
Note: the reason we doesn't simply use `maximize(Meta.MaximizeFlags.HORIZONTALLY`
for toggle-maximize-width is that maximized windows are unmovable [1] and (more
debatable) that maximized width should honor minimumMargin.

[1] doesn't play to well with paperwm, though we have some hacks in place for
    regular maximized windwos

Ref: #157
2019-07-14 13:14:13 +02:00
Rasmus Eneman
e87080e795 Unmaximize window on cycleWidth 2019-07-14 12:44:58 +02:00
Ole Jørgen Brønner
2364308681 Ensure 'startup-complete' is not connected twice
Windows sometimes was registered (`registerWindow`) twice on startup (observed
on X11 3.28) causing all sorts of problems.

Seems like the extension sometimes is enabled/disabled twice on startup causing
the 'startup-complete' signal to be connected twice. Use the `Signals` class to
manage the signal to guard against this scenario.

I added a one-shot function to `Signals` since it's an error to disconnect an
already disconnected signal and that would happen on disable if the
'startup-complete' signal disconnected the signal itself.

assoc: d8069078f2
2019-07-09 18:47:06 +02:00
Ole Jørgen Brønner
4e511e37ac Bottom margin
Kept the 'vertical-margin' key (as opposed to renaming to some variant of
top-margin) for compatibility reasons

closes #146
2019-07-08 18:36:38 +02:00
Ole Jørgen Brønner
d8069078f2 Guard against duplicate registerWindow
Seems to happen once and a while (observed on X11 3.28)
2019-07-06 18:29:17 +02:00