Minimize fullscreen windows when they end up in the background
Alt-Tab away from a monitor sized on the primary monitor results into the top panel being displayed on top of the window which looks very bad. So just hide those windows by minimizing them. The icon geometry animation does not really make sense for fullscreen windows so just fade them out. https://bugzilla.gnome.org/show_bug.cgi?id=693991
This commit is contained in:
parent
7b1aab3759
commit
049695b914
@ -816,6 +816,23 @@ const LayoutManager = new Lang.Class({
|
||||
}
|
||||
|
||||
if (primaryWasInFullscreen != this.primaryMonitor.inFullscreen) {
|
||||
let windows = this._getWindowActorsForWorkspace(global.screen.get_active_workspace());
|
||||
for (let i = 0; i < windows.length - 1; i++) {
|
||||
let window = windows[i];
|
||||
let metaWindow = window.meta_window;
|
||||
|
||||
// Skip minimized windows
|
||||
if (!metaWindow.showing_on_its_workspace())
|
||||
continue;
|
||||
|
||||
// Skip windows that aren't on the primary monitor
|
||||
if (!metaWindow.is_on_primary_monitor())
|
||||
continue;
|
||||
|
||||
// Minimize monitor sized windows
|
||||
if (metaWindow.is_monitor_sized())
|
||||
metaWindow.minimize();
|
||||
}
|
||||
this.emit('primary-fullscreen-changed', this.primaryMonitor.inFullscreen);
|
||||
}
|
||||
},
|
||||
|
@ -245,28 +245,9 @@ const WindowManager = new Lang.Class({
|
||||
|
||||
this._minimizing.push(actor);
|
||||
|
||||
let xDest, yDest, xScale, yScale;
|
||||
let [success, geom] = actor.meta_window.get_icon_geometry();
|
||||
if (success) {
|
||||
xDest = geom.x;
|
||||
yDest = geom.y;
|
||||
xScale = geom.width / actor.width;
|
||||
yScale = geom.height / actor.height;
|
||||
} else {
|
||||
let monitor = Main.layoutManager.monitors[actor.meta_window.get_monitor()];
|
||||
xDest = monitor.x;
|
||||
yDest = monitor.y;
|
||||
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||
xDest += monitor.width;
|
||||
xScale = 0;
|
||||
yScale = 0;
|
||||
}
|
||||
|
||||
Tweener.addTween(actor,
|
||||
{ scale_x: xScale,
|
||||
scale_y: yScale,
|
||||
x: xDest,
|
||||
y: yDest,
|
||||
if (actor.meta_window.is_monitor_sized()) {
|
||||
Tweener.addTween(actor,
|
||||
{ opacity: 0,
|
||||
time: WINDOW_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: this._minimizeWindowDone,
|
||||
@ -276,12 +257,46 @@ const WindowManager = new Lang.Class({
|
||||
onOverwriteScope: this,
|
||||
onOverwriteParams: [shellwm, actor]
|
||||
});
|
||||
} else {
|
||||
let xDest, yDest, xScale, yScale;
|
||||
let [success, geom] = actor.meta_window.get_icon_geometry();
|
||||
if (success) {
|
||||
xDest = geom.x;
|
||||
yDest = geom.y;
|
||||
xScale = geom.width / actor.width;
|
||||
yScale = geom.height / actor.height;
|
||||
} else {
|
||||
let monitor = Main.layoutManager.monitors[actor.meta_window.get_monitor()];
|
||||
xDest = monitor.x;
|
||||
yDest = monitor.y;
|
||||
if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
|
||||
xDest += monitor.width;
|
||||
xScale = 0;
|
||||
yScale = 0;
|
||||
}
|
||||
|
||||
Tweener.addTween(actor,
|
||||
{ scale_x: xScale,
|
||||
scale_y: yScale,
|
||||
x: xDest,
|
||||
y: yDest,
|
||||
time: WINDOW_ANIMATION_TIME,
|
||||
transition: 'easeOutQuad',
|
||||
onComplete: this._minimizeWindowDone,
|
||||
onCompleteScope: this,
|
||||
onCompleteParams: [shellwm, actor],
|
||||
onOverwrite: this._minimizeWindowOverwritten,
|
||||
onOverwriteScope: this,
|
||||
onOverwriteParams: [shellwm, actor]
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
_minimizeWindowDone : function(shellwm, actor) {
|
||||
if (this._removeEffect(this._minimizing, actor)) {
|
||||
Tweener.removeTweens(actor);
|
||||
actor.set_scale(1.0, 1.0);
|
||||
actor.set_opacity(255);
|
||||
actor.move_anchor_point_from_gravity(Clutter.Gravity.NORTH_WEST);
|
||||
|
||||
shellwm.completed_minimize(actor);
|
||||
|
Loading…
Reference in New Issue
Block a user