[gnome-shell/overview-relayout: 3/18] overview: Do not zoom the desktop background
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/overview-relayout: 3/18] overview: Do not zoom the desktop background
- Date: Fri, 12 Nov 2010 20:48:18 +0000 (UTC)
commit 1c4dd42561d893b301894e0bfb16cbfccbc8a2a0
Author: Florian Müllner <fmuellner gnome org>
Date: Thu Jul 15 16:21:32 2010 +0200
overview: Do not zoom the desktop background
While scaling the desktop background with the window previews represents
workspaces quite intuitively, the approach is not without problems.
As window previews in the overview behave quite differently to "real"
windows, the representation of workspaces as miniature versions of
"real" workspaces is flawed. The scaling also makes the transitions
to and from the overview much more visually expensive, without adding
much benefit.
Leaving the background in place provides more visual stability to the
transitions and emphasizes the distinctive behavior of elements in the
overview.
data/theme/gnome-shell.css | 4 --
js/ui/overview.js | 39 ++++++++++++++++++++++
js/ui/workspace.js | 76 ++++---------------------------------------
js/ui/workspacesView.js | 5 +++
4 files changed, 51 insertions(+), 73 deletions(-)
---
diff --git a/data/theme/gnome-shell.css b/data/theme/gnome-shell.css
index 67b1bc3..3f4e26c 100644
--- a/data/theme/gnome-shell.css
+++ b/data/theme/gnome-shell.css
@@ -242,10 +242,6 @@ StTooltip {
/* Overview */
-.overview {
- background-color: #111;
-}
-
.new-workspace-area {
border: 2px solid rgba(255, 255, 255, 0.8);
border-radius: 10px;
diff --git a/js/ui/overview.js b/js/ui/overview.js
index c29a12f..1504bf4 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -1,6 +1,7 @@
/* -*- mode: js2; js2-basic-offset: 4; indent-tabs-mode: nil -*- */
const Clutter = imports.gi.Clutter;
+const Meta = imports.gi.Meta;
const Mainloop = imports.mainloop;
const Signals = imports.signals;
const Lang = imports.lang;
@@ -171,6 +172,9 @@ function Overview() {
Overview.prototype = {
_init : function() {
+ this._desktop = new St.Bin();
+ global.overlay_group.add_actor(this._desktop);
+
this._group = new St.Group({ style_class: 'overview' });
this._group._delegate = this;
this._group.connect('destroy', Lang.bind(this,
@@ -237,6 +241,15 @@ Overview.prototype = {
this.workspaces = null;
},
+ _getDesktopClone: function() {
+ let windows = global.get_window_actors().filter(function(w) {
+ return w.meta_window.get_window_type() == Meta.WindowType.DESKTOP;
+ });
+ if (windows.length == 0)
+ return null;
+ return new Clutter.Clone({ source: windows[0].get_texture() });
+ },
+
_onViewChanged: function() {
if (!this.visible)
return;
@@ -455,6 +468,19 @@ Overview.prototype = {
this._group.add_actor(this._workspacesBar);
this._workspacesBar.raise(this.workspaces.actor);
+ if (!this._desktop.child)
+ this._desktop.child = this._getDesktopClone();
+
+ if (!this.workspaces.getActiveWorkspace().hasMaximizedWindows()) {
+ this._desktop.opacity = 255;
+ this._desktop.show();
+ Tweener.addTween(this._desktop,
+ { opacity: 0,
+ time: ANIMATION_TIME,
+ transition: 'easeOutQuad'
+ });
+ }
+
// All the the actors in the window group are completely obscured,
// hiding the group holding them while the Overview is displayed greatly
// increases performance of the Overview especially when there are many
@@ -501,6 +527,17 @@ Overview.prototype = {
this.animationInProgress = true;
this._hideInProgress = true;
+
+ let active = global.screen.get_active_workspace_index();
+ if (!this.workspaces.getActiveWorkspace().hasMaximizedWindows()) {
+ this._desktop.opacity = 0;
+ this._desktop.show();
+ Tweener.addTween(this._desktop,
+ { opacity: 255,
+ time: ANIMATION_TIME,
+ transition: 'easeOutQuad' });
+ }
+
if (this._activeDisplayPane != null)
this._activeDisplayPane.close();
this.workspaces.hide();
@@ -558,6 +595,7 @@ Overview.prototype = {
return;
this.animationInProgress = false;
+ this._desktop.hide();
this._coverPane.lower_bottom();
this.emit('shown');
@@ -575,6 +613,7 @@ Overview.prototype = {
this._workspacesManager = null;
this._dash.hide();
+ this._desktop.hide();
this._group.hide();
this.visible = false;
diff --git a/js/ui/workspace.js b/js/ui/workspace.js
index c4a225c..574f8e4 100644
--- a/js/ui/workspace.js
+++ b/js/ui/workspace.js
@@ -293,64 +293,22 @@ WindowClone.prototype = {
Signals.addSignalMethods(WindowClone.prototype);
-function DesktopClone(window) {
- this._init(window);
+function DesktopClone() {
+ this._init();
}
DesktopClone.prototype = {
- _init : function(window) {
+ _init : function() {
this.actor = new Clutter.Group({ reactive: true });
let background = new Clutter.Clone({ source: Main.background.source });
this.actor.add_actor(background);
-
- if (window) {
- this._desktop = new Clutter.Clone({ source: window.get_texture() });
- this.actor.add_actor(this._desktop);
- this._desktop.hide();
- } else {
- this._desktop = null;
- }
+ background.hide();
this.actor.connect('button-release-event',
Lang.bind(this, this._onButtonRelease));
},
- zoomFromOverview: function(fadeInIcons) {
- if (this._desktop == null)
- return;
-
- if (fadeInIcons) {
- this._desktop.opacity = 0;
- this._desktop.show();
- Tweener.addTween(this._desktop,
- { opacity: 255,
- time: Overview.ANIMATION_TIME,
- transition: 'easeOutQuad' });
- }
- },
-
- zoomToOverview: function(fadeOutIcons) {
- if (this._desktop == null)
- return;
-
- if (fadeOutIcons) {
- this._desktop.opacity = 255;
- this._desktop.show();
- Tweener.addTween(this._desktop,
- { opacity: 0,
- time: Overview.ANIMATION_TIME,
- transition: 'easeOutQuad',
- onComplete: Lang.bind(this,
- function() {
- this._desktop.hide();
- })
- });
- } else {
- this._desktop.hide();
- }
- },
-
_onButtonRelease : function (actor, event) {
this.emit('selected', event.get_time());
}
@@ -604,17 +562,8 @@ Workspace.prototype = {
let windows = global.get_window_actors().filter(this._isMyWindow, this);
- // Find the desktop window
- for (let i = 0; i < windows.length; i++) {
- if (windows[i].meta_window.get_window_type() == Meta.WindowType.DESKTOP) {
- this._desktop = new DesktopClone(windows[i]);
- break;
- }
- }
- // If there wasn't one, fake it
- if (!this._desktop)
- this._desktop = new DesktopClone();
-
+ // Create desktop for selecting/dragging
+ this._desktop = new DesktopClone();
this._desktop.connect('selected',
Lang.bind(this,
function(clone, time) {
@@ -1309,7 +1258,7 @@ Workspace.prototype = {
},
// check for maximized windows on the workspace
- _haveMaximizedWindows: function() {
+ hasMaximizedWindows: function() {
for (let i = 1; i < this._windows.length; i++) {
let metaWindow = this._windows[i].metaWindow;
if (metaWindow.showing_on_its_workspace() &&
@@ -1331,12 +1280,6 @@ Workspace.prototype = {
else
this.positionWindows(WindowPositionFlags.ZOOM);
- let active = global.screen.get_active_workspace();
- let fadeInIcons = (Main.overview.animationInProgress &&
- active == this.metaWorkspace &&
- !this._haveMaximizedWindows());
- this._desktop.zoomToOverview(fadeInIcons);
-
this._visible = true;
},
@@ -1383,11 +1326,6 @@ Workspace.prototype = {
}
}
- let active = global.screen.get_active_workspace();
- let fadeOutIcons = (active == this.metaWorkspace &&
- !this._haveMaximizedWindows());
- this._desktop.zoomFromOverview(fadeOutIcons);
-
this._visible = false;
},
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index 344296d..becd287 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -117,6 +117,11 @@ GenericWorkspacesView.prototype = {
}
},
+ getActiveWorkspace: function() {
+ let active = global.screen.get_active_workspace_index();
+ return this._workspaces[active];
+ },
+
_clearApplicationWindowSelection: function(reposition) {
if (this._windowSelectionAppId == null)
return;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]