Overview: Remove invisible animations

Given that the grid view is gone there is no point in animating the
window previews on all workspaces anymore so just do it for the current
one avoid taking a slow down caused by animating windows on other workspaces.

https://bugzilla.gnome.org/show_bug.cgi?id=637353
This commit is contained in:
Adel Gadllah 2010-12-16 20:21:12 +01:00
parent e41b0bc16d
commit 7279cc1db8

View File

@ -396,7 +396,7 @@ WindowOverlay.prototype = {
// These parameters are not the values retrieved with // These parameters are not the values retrieved with
// get_transformed_position() and get_transformed_size(), // get_transformed_position() and get_transformed_size(),
// as windowClone might be moving. // as windowClone might be moving.
// See Workspace._fadeInWindowOverlay // See Workspace._showWindowOverlay
updatePositions: function(cloneX, cloneY, cloneWidth, cloneHeight) { updatePositions: function(cloneX, cloneY, cloneWidth, cloneHeight) {
let button = this.closeButton; let button = this.closeButton;
let title = this.title; let title = this.title;
@ -946,6 +946,9 @@ Workspace.prototype = {
let slots = this._computeAllWindowSlots(visibleClones.length); let slots = this._computeAllWindowSlots(visibleClones.length);
visibleClones = this._orderWindowsByMotionAndStartup(visibleClones, slots); visibleClones = this._orderWindowsByMotionAndStartup(visibleClones, slots);
let currentWorkspace = global.screen.get_active_workspace();
let isOnCurrentWorkspace = this.metaWorkspace == currentWorkspace;
for (let i = 0; i < visibleClones.length; i++) { for (let i = 0; i < visibleClones.length; i++) {
let slot = slots[i]; let slot = slots[i];
let clone = visibleClones[i]; let clone = visibleClones[i];
@ -962,7 +965,7 @@ Workspace.prototype = {
if (overlay) if (overlay)
overlay.hide(); overlay.hide();
if (animate) { if (animate && isOnCurrentWorkspace) {
if (!metaWindow.showing_on_its_workspace()) { if (!metaWindow.showing_on_its_workspace()) {
/* Hidden windows should fade in and grow /* Hidden windows should fade in and grow
* therefore we need to resize them now so they * therefore we need to resize them now so they
@ -992,13 +995,13 @@ Workspace.prototype = {
time: Overview.ANIMATION_TIME, time: Overview.ANIMATION_TIME,
transition: 'easeOutQuad', transition: 'easeOutQuad',
onComplete: Lang.bind(this, function() { onComplete: Lang.bind(this, function() {
this._fadeInWindowOverlay(clone, overlay); this._showWindowOverlay(clone, overlay, true);
}) })
}); });
} else { } else {
clone.actor.set_position(x, y); clone.actor.set_position(x, y);
clone.actor.set_scale(scale, scale); clone.actor.set_scale(scale, scale);
this._fadeInWindowOverlay(clone, overlay); this._showWindowOverlay(clone, overlay, isOnCurrentWorkspace);
} }
} }
}, },
@ -1019,7 +1022,7 @@ Workspace.prototype = {
} }
}, },
_fadeInWindowOverlay: function(clone, overlay) { _showWindowOverlay: function(clone, overlay, fade) {
if (clone.inDrag) if (clone.inDrag)
return; return;
@ -1041,17 +1044,21 @@ Workspace.prototype = {
if (overlay) { if (overlay) {
overlay.updatePositions(cloneX, cloneY, cloneWidth, cloneHeight); overlay.updatePositions(cloneX, cloneY, cloneWidth, cloneHeight);
if (fade)
overlay.fadeIn(); overlay.fadeIn();
else
overlay.show();
} }
}, },
_fadeInAllOverlays: function() { _showAllOverlays: function() {
let currentWorkspace = global.screen.get_active_workspace();
for (let i = 0; i < this._windows.length; i++) { for (let i = 0; i < this._windows.length; i++) {
let clone = this._windows[i]; let clone = this._windows[i];
let overlay = this._windowOverlays[i]; let overlay = this._windowOverlays[i];
if (this._showOnlyWindows != null && !(clone.metaWindow in this._showOnlyWindows)) if (this._showOnlyWindows != null && !(clone.metaWindow in this._showOnlyWindows))
continue; continue;
this._fadeInWindowOverlay(clone, overlay); this._showWindowOverlay(clone, overlay, this.metaWorkspace == currentWorkspace);
} }
}, },
@ -1087,7 +1094,7 @@ Workspace.prototype = {
showWindowsOverlays: function() { showWindowsOverlays: function() {
this._windowOverlaysGroup.show(); this._windowOverlaysGroup.show();
this._fadeInAllOverlays(); this._showAllOverlays();
}, },
hideWindowsOverlays: function() { hideWindowsOverlays: function() {
@ -1208,6 +1215,8 @@ Workspace.prototype = {
// Animates the return from Overview mode // Animates the return from Overview mode
zoomFromOverview : function() { zoomFromOverview : function() {
let currentWorkspace = global.screen.get_active_workspace();
this.leavingOverview = true; this.leavingOverview = true;
this._hideAllOverlays(); this._hideAllOverlays();
@ -1219,6 +1228,9 @@ Workspace.prototype = {
this._overviewHiddenId = Main.overview.connect('hidden', Lang.bind(this, this._overviewHiddenId = Main.overview.connect('hidden', Lang.bind(this,
this._doneLeavingOverview)); this._doneLeavingOverview));
if (this._metaWorkspace == currentWorkspace)
return;
// Position and scale the windows. // Position and scale the windows.
for (let i = 0; i < this._windows.length; i++) { for (let i = 0; i < this._windows.length; i++) {
let clone = this._windows[i]; let clone = this._windows[i];