Adapt to Mutter background changes

The rewrite of Mutter's background code (see bug 735637) requires
corresponding changes here - we no longer need to layer multiple
MetaBackgroundActors together.

The general strategy is that a BackgroundSource object is created
per GSettings schema, and keeps either one Background/MetaBackground pair,
or, for animation, a Background/Metabackground pair for each monitor.

https://bugzilla.gnome.org/show_bug.cgi?id=735638
This commit is contained in:
Owen W. Taylor 2014-08-11 18:15:45 +02:00
parent 70099872ab
commit 650dea017b
4 changed files with 373 additions and 497 deletions

File diff suppressed because it is too large Load Diff

View File

@ -361,7 +361,7 @@ const LayoutManager = new Lang.Class({
}, },
_addBackgroundMenu: function(bgManager) { _addBackgroundMenu: function(bgManager) {
BackgroundMenu.addBackgroundMenu(bgManager.background.actor, this); BackgroundMenu.addBackgroundMenu(bgManager.backgroundActor, this);
}, },
_createBackgroundManager: function(monitorIndex) { _createBackgroundManager: function(monitorIndex) {
@ -378,10 +378,10 @@ const LayoutManager = new Lang.Class({
_showSecondaryBackgrounds: function() { _showSecondaryBackgrounds: function() {
for (let i = 0; i < this.monitors.length; i++) { for (let i = 0; i < this.monitors.length; i++) {
if (i != this.primaryIndex) { if (i != this.primaryIndex) {
let background = this._bgManagers[i].background; let backgroundActor = this._bgManagers[i].backgroundActor;
background.actor.show(); backgroundActor.show();
background.actor.opacity = 0; backgroundActor.opacity = 0;
Tweener.addTween(background.actor, Tweener.addTween(backgroundActor,
{ opacity: 255, { opacity: 255,
time: BACKGROUND_FADE_ANIMATION_TIME, time: BACKGROUND_FADE_ANIMATION_TIME,
transition: 'easeOutQuad' }); transition: 'easeOutQuad' });
@ -404,7 +404,7 @@ const LayoutManager = new Lang.Class({
this._bgManagers.push(bgManager); this._bgManagers.push(bgManager);
if (i != this.primaryIndex && this._startingUp) if (i != this.primaryIndex && this._startingUp)
bgManager.background.actor.hide(); bgManager.backgroundActor.hide();
} }
}, },

View File

@ -185,7 +185,7 @@ const Overview = new Lang.Class({
for (let i = 0; i < Main.layoutManager.monitors.length; i++) { for (let i = 0; i < Main.layoutManager.monitors.length; i++) {
let bgManager = new Background.BackgroundManager({ container: this._backgroundGroup, let bgManager = new Background.BackgroundManager({ container: this._backgroundGroup,
monitorIndex: i, monitorIndex: i,
effects: Meta.BackgroundEffects.VIGNETTE }); vignette: true });
this._bgManagers.push(bgManager); this._bgManagers.push(bgManager);
} }
}, },
@ -193,11 +193,9 @@ const Overview = new Lang.Class({
_unshadeBackgrounds: function() { _unshadeBackgrounds: function() {
let backgrounds = this._backgroundGroup.get_children(); let backgrounds = this._backgroundGroup.get_children();
for (let i = 0; i < backgrounds.length; i++) { for (let i = 0; i < backgrounds.length; i++) {
let background = backgrounds[i]._delegate; Tweener.addTween(backgrounds[i],
Tweener.addTween(background,
{ brightness: 1.0, { brightness: 1.0,
vignetteSharpness: 0.0, vignette_sharpness: 0.0,
time: SHADE_ANIMATION_TIME, time: SHADE_ANIMATION_TIME,
transition: 'easeOutQuad' transition: 'easeOutQuad'
}); });
@ -207,11 +205,9 @@ const Overview = new Lang.Class({
_shadeBackgrounds: function() { _shadeBackgrounds: function() {
let backgrounds = this._backgroundGroup.get_children(); let backgrounds = this._backgroundGroup.get_children();
for (let i = 0; i < backgrounds.length; i++) { for (let i = 0; i < backgrounds.length; i++) {
let background = backgrounds[i]._delegate; Tweener.addTween(backgrounds[i],
Tweener.addTween(background,
{ brightness: Lightbox.VIGNETTE_BRIGHTNESS, { brightness: Lightbox.VIGNETTE_BRIGHTNESS,
vignetteSharpness: Lightbox.VIGNETTE_SHARPNESS, vignette_sharpness: Lightbox.VIGNETTE_SHARPNESS,
time: SHADE_ANIMATION_TIME, time: SHADE_ANIMATION_TIME,
transition: 'easeOutQuad' transition: 'easeOutQuad'
}); });

View File

@ -306,7 +306,7 @@ const WorkspaceThumbnail = new Lang.Class({
_createBackground: function() { _createBackground: function() {
this._bgManager = new Background.BackgroundManager({ monitorIndex: Main.layoutManager.primaryIndex, this._bgManager = new Background.BackgroundManager({ monitorIndex: Main.layoutManager.primaryIndex,
container: this._contents, container: this._contents,
effects: Meta.BackgroundEffects.NONE }); vignette: false });
}, },
setPorthole: function(x, y, width, height) { setPorthole: function(x, y, width, height) {
@ -332,7 +332,7 @@ const WorkspaceThumbnail = new Lang.Class({
let clone = this._windows[i]; let clone = this._windows[i];
let metaWindow = clone.metaWindow; let metaWindow = clone.metaWindow;
if (i == 0) { if (i == 0) {
clone.setStackAbove(this._bgManager.background.actor); clone.setStackAbove(this._bgManager.backgroundActor);
} else { } else {
let previousClone = this._windows[i - 1]; let previousClone = this._windows[i - 1];
clone.setStackAbove(previousClone.actor); clone.setStackAbove(previousClone.actor);
@ -531,7 +531,7 @@ const WorkspaceThumbnail = new Lang.Class({
this._contents.add_actor(clone.actor); this._contents.add_actor(clone.actor);
if (this._windows.length == 0) if (this._windows.length == 0)
clone.setStackAbove(this._bgManager.background.actor); clone.setStackAbove(this._bgManager.backgroundActor);
else else
clone.setStackAbove(this._windows[this._windows.length - 1].actor); clone.setStackAbove(this._windows[this._windows.length - 1].actor);