Skip to content

Commit

Permalink
Fix background dimming
Browse files Browse the repository at this point in the history
  • Loading branch information
timoloewe committed Apr 7, 2015
1 parent a795ceb commit 9d333a9
Showing 1 changed file with 63 additions and 63 deletions.
126 changes: 63 additions & 63 deletions [email protected]/platform.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,17 +69,17 @@ AbstractPlatform.prototype = {
elastic_mode: false,
};
},

getPrimaryModifier: function(mask) {
return imports.ui.altTab.primaryModifier(mask);
},

initBackground: function() {
this._background = Meta.BackgroundActor.new_for_screen(global.screen);
this._background.hide();
global.overlay_group.add_actor(this._background);
},

dimBackground: function() {
this._background.show();
Tweener.addTween(this._background, {
Expand All @@ -88,7 +88,7 @@ AbstractPlatform.prototype = {
transition: TRANSITION_TYPE
});
},

undimBackground: function(onCompleteBind) {
Tweener.removeTweens(this._background);
Tweener.addTween(this._background, {
Expand All @@ -98,7 +98,7 @@ AbstractPlatform.prototype = {
onComplete: onCompleteBind,
});
},

removeBackground: function() {
global.overlay_group.remove_actor(this._background);
}
Expand Down Expand Up @@ -209,10 +209,10 @@ PlatformCinnamon18.prototype = {
this._settings.updateTitlePosition = function() {
this.title_position = (this.titlePosition == 'Top' ? POSITION_TOP : POSITION_BOTTOM);
};


let Settings = imports.ui.settings;

// Init settings
let extSettings = new Settings.ExtensionSettings(this._settings, "[email protected]");
function noop() {}
Expand All @@ -225,7 +225,7 @@ PlatformCinnamon18.prototype = {
extSettings.bindProperty(Settings.BindingDirection.ONE_WAY, "enforce-primary-monitor", "enforce_primary_monitor", noop);
extSettings.bindProperty(Settings.BindingDirection.ONE_WAY, "elastic-mode", "elastic_mode", noop);
extSettings.bindProperty(Settings.BindingDirection.ONE_WAY, "switcher-style", "switcher_style", this._settings.updateSwitcherStyle);

this._settings.updateSwitcherStyle();
this._settings.updateTitlePosition();
},
Expand All @@ -247,11 +247,11 @@ PlatformCinnamon18.prototype = {
getSettings: function() {
return this._settings;
},

getPrimaryModifier: function(mask) {
return imports.ui.appSwitcher.appSwitcher.primaryModifier(mask);
}

};

function PlatformGnomeShell() {
Expand Down Expand Up @@ -350,14 +350,14 @@ PlatformGnomeShell38.prototype = {
_init: function() {
PlatformGnomeShell.prototype._init.apply(this, arguments);
},

getPrimaryModifier: function(mask) {
return imports.ui.switcherPopup.primaryModifier(mask);
},

initBackground: function() {
let Background = imports.ui.background;

this._backgroundGroup = new Meta.BackgroundGroup();
global.overlay_group.add_child(this._backgroundGroup);
this._backgroundGroup.hide();
Expand All @@ -366,10 +366,10 @@ PlatformGnomeShell38.prototype = {
monitorIndex: i, });
}
},

dimBackground: function() {
let Background = imports.ui.background;

this._backgroundGroup.show();
let backgrounds = this._backgroundGroup.get_children();
for (let i = 0; i < backgrounds.length; i++) {
Expand All @@ -382,10 +382,10 @@ PlatformGnomeShell38.prototype = {
});
}
},

undimBackground: function(onCompleteBind) {
let Background = imports.ui.background;

let backgrounds = this._backgroundGroup.get_children();
for (let i = 0; i < backgrounds.length; i++) {
let background = backgrounds[i]._delegate;
Expand All @@ -398,7 +398,7 @@ PlatformGnomeShell38.prototype = {
});
}
},

removeBackground: function() {
global.overlay_group.remove_child(this._backgroundGroup);
}
Expand All @@ -414,14 +414,14 @@ PlatformGnomeShell310.prototype = {
_init: function() {
PlatformGnomeShell.prototype._init.apply(this, arguments);
},

getPrimaryModifier: function(mask) {
return imports.ui.switcherPopup.primaryModifier(mask);
},

initBackground: function() {
let Background = imports.ui.background;

this._backgroundGroup = new Meta.BackgroundGroup();
Main.uiGroup.add_child(this._backgroundGroup);
this._backgroundGroup.lower_bottom();
Expand All @@ -431,10 +431,10 @@ PlatformGnomeShell310.prototype = {
monitorIndex: i, });
}
},

dimBackground: function() {
let Background = imports.ui.background;

this._backgroundGroup.show();
let backgrounds = this._backgroundGroup.get_children();
for (let i = 0; i < backgrounds.length; i++) {
Expand All @@ -446,10 +446,10 @@ PlatformGnomeShell310.prototype = {
});
}
},

undimBackground: function(onCompleteBind) {
let Background = imports.ui.background;

let backgrounds = this._backgroundGroup.get_children();
for (let i = 0; i < backgrounds.length; i++) {
let background = backgrounds[i]._delegate;
Expand All @@ -461,7 +461,7 @@ PlatformGnomeShell310.prototype = {
});
}
},

removeBackground: function() {
Main.uiGroup.remove_child(this._backgroundGroup);
}
Expand All @@ -479,52 +479,52 @@ PlatformGnomeShell314.prototype = {
_init: function() {
PlatformGnomeShell.prototype._init.apply(this, arguments);
},

getPrimaryModifier: function(mask) {
return imports.ui.switcherPopup.primaryModifier(mask);
},

initBackground: function() {
let Background = imports.ui.background;

this._backgroundGroup = new Meta.BackgroundGroup();
Main.uiGroup.add_child(this._backgroundGroup);
this._backgroundGroup.lower_bottom();
this._backgroundGroup.hide();
for (let i = 0; i < Main.layoutManager.monitors.length; i++) {
new Background.BackgroundManager({ container: this._backgroundGroup,
monitorIndex: i, });
}
Main.layoutManager.uiGroup.add_child(this._backgroundGroup);
this._backgroundGroup.lower_bottom();
this._backgroundGroup.hide();
for (let i = 0; i < Main.layoutManager.monitors.length; i++) {
new Background.BackgroundManager({ container: this._backgroundGroup,
monitorIndex: i,
vignette: true });
}
},
dimBackground: function() {

dimBackground: function() {
this._backgroundGroup.show();
let backgrounds = this._backgroundGroup.get_children();
for (let i = 0; i < backgrounds.length; i++) {
let background = backgrounds[i];
Tweener.addTween(background,
{ brightness: this.getSettings().dim_factor,
time: this.getSettings().animation_time,
transition: TRANSITION_TYPE
});
}
let backgrounds = this._backgroundGroup.get_children();
for (let i = 0; i < backgrounds.length; i++) {
Tweener.addTween(backgrounds[i],
{ brightness: 0.8,
vignette_sharpness: 1 - this.getSettings().dim_factor,
time: this.getSettings().animation_time,
transition: TRANSITION_TYPE
});
}
},
undimBackground: function(onCompleteBind) {
let backgrounds = this._backgroundGroup.get_children();
for (let i = 0; i < backgrounds.length; i++) {
let background = backgrounds[i];
Tweener.addTween(background,
{ brightness: 1.0,
time: this.getSettings().animation_time,
transition: TRANSITION_TYPE,
onComplete: onCompleteBind,
});
}

undimBackground: function(onCompleteBind) {
let backgrounds = this._backgroundGroup.get_children();
for (let i = 0; i < backgrounds.length; i++) {
Tweener.addTween(backgrounds[i],
{ brightness: 1.0,
vignette_sharpness: 0.0,
time: this.getSettings().animation_time,
transition: TRANSITION_TYPE,
onComplete: onCompleteBind
});
}
},

removeBackground: function() {
Main.uiGroup.remove_child(this._backgroundGroup);
Main.layoutManager.uiGroup.remove_child(this._backgroundGroup);
}
};

0 comments on commit 9d333a9

Please sign in to comment.