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:
Adel Gadllah 2013-02-18 19:26:13 +01:00
parent 7b1aab3759
commit 049695b914
2 changed files with 54 additions and 22 deletions

View File

@ -816,6 +816,23 @@ const LayoutManager = new Lang.Class({
} }
if (primaryWasInFullscreen != this.primaryMonitor.inFullscreen) { 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); this.emit('primary-fullscreen-changed', this.primaryMonitor.inFullscreen);
} }
}, },

View File

@ -245,6 +245,19 @@ const WindowManager = new Lang.Class({
this._minimizing.push(actor); this._minimizing.push(actor);
if (actor.meta_window.is_monitor_sized()) {
Tweener.addTween(actor,
{ opacity: 0,
time: WINDOW_ANIMATION_TIME,
transition: 'easeOutQuad',
onComplete: this._minimizeWindowDone,
onCompleteScope: this,
onCompleteParams: [shellwm, actor],
onOverwrite: this._minimizeWindowOverwritten,
onOverwriteScope: this,
onOverwriteParams: [shellwm, actor]
});
} else {
let xDest, yDest, xScale, yScale; let xDest, yDest, xScale, yScale;
let [success, geom] = actor.meta_window.get_icon_geometry(); let [success, geom] = actor.meta_window.get_icon_geometry();
if (success) { if (success) {
@ -276,12 +289,14 @@ const WindowManager = new Lang.Class({
onOverwriteScope: this, onOverwriteScope: this,
onOverwriteParams: [shellwm, actor] onOverwriteParams: [shellwm, actor]
}); });
}
}, },
_minimizeWindowDone : function(shellwm, actor) { _minimizeWindowDone : function(shellwm, actor) {
if (this._removeEffect(this._minimizing, actor)) { if (this._removeEffect(this._minimizing, actor)) {
Tweener.removeTweens(actor); Tweener.removeTweens(actor);
actor.set_scale(1.0, 1.0); actor.set_scale(1.0, 1.0);
actor.set_opacity(255);
actor.move_anchor_point_from_gravity(Clutter.Gravity.NORTH_WEST); actor.move_anchor_point_from_gravity(Clutter.Gravity.NORTH_WEST);
shellwm.completed_minimize(actor); shellwm.completed_minimize(actor);