diff --git a/js/ui/overview.js b/js/ui/overview.js index 061175dd3..0dcb00056 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -622,7 +622,7 @@ const Overview = new Lang.Class({ this.animationInProgress = true; this.visibleTarget = false; - this.viewSelector.zoomFromOverview(); + this.viewSelector.leaveOverview(); // Make other elements fade out. Tweener.addTween(this._stack, diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js index ab16fdde8..453000cdb 100644 --- a/js/ui/viewSelector.js +++ b/js/ui/viewSelector.js @@ -118,13 +118,11 @@ const ViewSelector = new Lang.Class({ this._stageKeyPressId = 0; Main.overview.connect('showing', Lang.bind(this, function () { - this._showAppsButton.checked = false; this._stageKeyPressId = global.stage.connect('key-press-event', Lang.bind(this, this._onStageKeyPress)); })); Main.overview.connect('hiding', Lang.bind(this, function () { - this._showAppsButton.checked = false; if (this._stageKeyPressId != 0) { global.stage.disconnect(this._stageKeyPressId); this._stageKeyPressId = 0; @@ -160,6 +158,11 @@ const ViewSelector = new Lang.Class({ show: function() { this.reset(); + this._showAppsBlocked = true; + this._showAppsButton.checked = false; + this._showAppsBlocked = false; + + this._workspacesPage.opacity = 255; this._workspacesDisplay.show(); this._activePage = null; this._syncActivePage(); @@ -168,11 +171,13 @@ const ViewSelector = new Lang.Class({ Main.overview.fadeOutDesktop(); }, - zoomFromOverview: function() { - this._workspacesDisplay.zoomFromOverview(); - + leaveOverview: function() { if (!this._workspacesDisplay.activeWorkspaceHasMaximizedWindows()) Main.overview.fadeInDesktop(); + + // If we're not on the windows page, don't zoom back the primary monitor. + let zoomPrimary = (this._activePage == this._workspacesPage); + this._workspacesDisplay.leaveOverview(zoomPrimary); }, setWorkspacesFullGeometry: function(geom) { @@ -181,6 +186,9 @@ const ViewSelector = new Lang.Class({ hide: function() { this._workspacesDisplay.hide(); + if (this._activePage) + this._activePage.hide(); + this._activePage = null; }, _addPage: function(actor, name, a11yIcon, params) { @@ -215,13 +223,13 @@ const ViewSelector = new Lang.Class({ this._activePage.navigate_focus(null, Gtk.DirectionType.TAB_FORWARD, false); this._activePage.show(); Tweener.addTween(this._activePage, - { opacity: 255, - time: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME, - transition: 'easeOutQuad' - }); + { opacity: 255, + time: OverviewControls.SIDE_CONTROLS_ANIMATION_TIME, + transition: 'easeOutQuad' + }); }, - _showPage: function(page) { + _setActivePage: function(page) { if (page == this._activePage) return; @@ -261,11 +269,12 @@ const ViewSelector = new Lang.Class({ let activePage = this._getActivePage(); if (activePage == this._activePage) return; - this._showPage(activePage); + this._setActivePage(activePage); }, _onShowAppsButtonToggled: function() { - this._syncActivePage(); + if (!this._showAppsBlocked) + this._syncActivePage(); }, _onStageKeyPress: function(actor, event) { diff --git a/js/ui/workspace.js b/js/ui/workspace.js index d048dd247..4aa0e08cc 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -1521,34 +1521,39 @@ const Workspace = new Lang.Class({ this._recalculateWindowPositions(WindowPositionFlags.ANIMATE | WindowPositionFlags.INITIAL); }, - // Animates the return from Overview mode - zoomFromOverview : function() { + _leavingOverview: function() { let currentWorkspace = global.screen.get_active_workspace(); + if (this.metaWorkspace != null && this.metaWorkspace != currentWorkspace) + return false; this.leavingOverview = true; + this._overviewHiddenId = Main.overview.connect('hidden', Lang.bind(this, + this._doneLeavingOverview)); for (let i = 0; i < this._windows.length; i++) { let clone = this._windows[i]; Tweener.removeTweens(clone.actor); + + let overlay = this._windowOverlays[i]; + if (overlay) + overlay.hide(); } if (this._repositionWindowsId > 0) { Mainloop.source_remove(this._repositionWindowsId); this._repositionWindowsId = 0; } - this._overviewHiddenId = Main.overview.connect('hidden', Lang.bind(this, - this._doneLeavingOverview)); - if (this.metaWorkspace != null && this.metaWorkspace != currentWorkspace) + return true; + }, + + // Animates the return from Overview mode + zoomFromOverview : function() { + if (!this._leavingOverview()) return; - // Position and scale the windows. for (let i = 0; i < this._windows.length; i++) { let clone = this._windows[i]; - let overlay = this._windowOverlays[i]; - - if (overlay) - overlay.hide(); if (clone.metaWindow.showing_on_its_workspace()) { let [origX, origY] = clone.getOriginalPosition(); @@ -1575,6 +1580,31 @@ const Workspace = new Lang.Class({ } }, + fadeFromOverview: function() { + if (!this._leavingOverview()) + return; + + for (let i = 0; i < this._windows.length; i++) { + let clone = this._windows[i]; + + if (clone.metaWindow.showing_on_its_workspace()) { + clone.actor.x = clone.origX; + clone.actor.y = clone.origY; + clone.actor.scale_x = 1.0; + clone.actor.scale_y = 1.0; + clone.actor.opacity = 0; + + Tweener.addTween(clone.actor, + { opacity: 255, + time: Overview.ANIMATION_TIME, + transition: 'easeOutQuad' + }); + } else { + clone.actor.hide(); + } + } + }, + destroy : function() { this.actor.destroy(); }, diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js index 59e968275..ad5315fd8 100644 --- a/js/ui/workspacesView.js +++ b/js/ui/workspacesView.js @@ -145,11 +145,22 @@ const WorkspacesView = new Lang.Class({ this._updateWorkspaceActors(false); }, - zoomFromOverview: function() { + _leaveOverview: function() { this.actor.remove_clip(); + }, - for (let w = 0; w < this._workspaces.length; w++) - this._workspaces[w].zoomFromOverview(); + zoomFromOverview: function() { + this._leaveOverview(); + this._workspaces.forEach(function(w) { + w.zoomFromOverview(); + }); + }, + + fadeFromOverview: function() { + this._leaveOverview(); + this._workspaces.forEach(function(w) { + w.fadeFromOverview(); + }); }, syncStacking: function(stackIndices) { @@ -365,6 +376,10 @@ const ExtraWorkspaceView = new Lang.Class({ this._workspace.zoomFromOverview(); }, + fadeFromOverview: function() { + this._workspace.fadeFromOverview(); + }, + syncStacking: function(stackIndices) { this._workspace.syncStacking(stackIndices); }, @@ -466,9 +481,18 @@ const WorkspacesDisplay = new Lang.Class({ this._scrollEventId = Main.overview.connect('scroll-event', Lang.bind(this, this._onScrollEvent)); }, - zoomFromOverview: function() { - for (let i = 0; i < this._workspacesViews.length; i++) - this._workspacesViews[i].zoomFromOverview(); + leaveOverview: function(zoomPrimary) { + for (let i = 0; i < this._workspacesViews.length; i++) { + let view = this._workspacesViews[i]; + if (i == this._primaryIndex) { + if (zoomPrimary) + view.zoomFromOverview(); + else + view.fadeFromOverview(); + } else { + view.zoomFromOverview(); + } + } }, hide: function() {