windowManager: Disable the window dimmer when we close all attached dialogs
This saves some GLSL resources and an FBO. https://bugzilla.gnome.org/show_bug.cgi?id=683073
This commit is contained in:
parent
c815979f2a
commit
f8805e8311
@ -27,16 +27,24 @@ const WindowDimmer = new Lang.Class({
|
|||||||
this._brightnessEffect = new Clutter.BrightnessContrastEffect();
|
this._brightnessEffect = new Clutter.BrightnessContrastEffect();
|
||||||
actor.add_effect(this._brightnessEffect);
|
actor.add_effect(this._brightnessEffect);
|
||||||
this.actor = actor;
|
this.actor = actor;
|
||||||
|
this._enabled = true;
|
||||||
this._dimFactor = 0.0;
|
this._dimFactor = 0.0;
|
||||||
|
this._syncEnabled();
|
||||||
|
},
|
||||||
|
|
||||||
|
_syncEnabled: function() {
|
||||||
|
this._brightnessEffect.enabled = (this._enabled && this._dimFactor > 0);
|
||||||
},
|
},
|
||||||
|
|
||||||
setEnabled: function(enabled) {
|
setEnabled: function(enabled) {
|
||||||
this._brightnessEffect.enabled = enabled;
|
this._enabled = enabled;
|
||||||
|
this._syncEnabled();
|
||||||
},
|
},
|
||||||
|
|
||||||
set dimFactor(factor) {
|
set dimFactor(factor) {
|
||||||
this._dimFactor = factor;
|
this._dimFactor = factor;
|
||||||
this._brightnessEffect.set_brightness(factor * DIM_BRIGHTNESS);
|
this._brightnessEffect.set_brightness(factor * DIM_BRIGHTNESS);
|
||||||
|
this._syncEnabled();
|
||||||
},
|
},
|
||||||
|
|
||||||
get dimFactor() {
|
get dimFactor() {
|
||||||
@ -45,10 +53,17 @@ const WindowDimmer = new Lang.Class({
|
|||||||
});
|
});
|
||||||
|
|
||||||
function getWindowDimmer(actor) {
|
function getWindowDimmer(actor) {
|
||||||
if (!actor._windowDimmer)
|
let enabled = Meta.prefs_get_attach_modal_dialogs();
|
||||||
actor._windowDimmer = new WindowDimmer(actor);
|
if (actor._windowDimmer)
|
||||||
|
actor._windowDimmer.setEnabled(enabled);
|
||||||
|
|
||||||
return actor._windowDimmer;
|
if (enabled) {
|
||||||
|
if (!actor._windowDimmer)
|
||||||
|
actor._windowDimmer = new WindowDimmer(actor);
|
||||||
|
return actor._windowDimmer;
|
||||||
|
} else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const WindowManager = new Lang.Class({
|
const WindowManager = new Lang.Class({
|
||||||
@ -255,9 +270,7 @@ const WindowManager = new Lang.Class({
|
|||||||
if (!actor)
|
if (!actor)
|
||||||
return;
|
return;
|
||||||
let dimmer = getWindowDimmer(actor);
|
let dimmer = getWindowDimmer(actor);
|
||||||
let enabled = Meta.prefs_get_attach_modal_dialogs();
|
if (!dimmer)
|
||||||
dimmer.setEnabled(enabled);
|
|
||||||
if (!enabled)
|
|
||||||
return;
|
return;
|
||||||
Tweener.addTween(dimmer,
|
Tweener.addTween(dimmer,
|
||||||
{ dimFactor: 1.0,
|
{ dimFactor: 1.0,
|
||||||
@ -271,15 +284,12 @@ const WindowManager = new Lang.Class({
|
|||||||
if (!actor)
|
if (!actor)
|
||||||
return;
|
return;
|
||||||
let dimmer = getWindowDimmer(actor);
|
let dimmer = getWindowDimmer(actor);
|
||||||
let enabled = Meta.prefs_get_attach_modal_dialogs();
|
if (!dimmer)
|
||||||
dimmer.setEnabled(enabled);
|
|
||||||
if (!enabled)
|
|
||||||
return;
|
return;
|
||||||
Tweener.addTween(dimmer,
|
Tweener.addTween(dimmer,
|
||||||
{ dimFactor: 0.0,
|
{ dimFactor: 0.0,
|
||||||
time: UNDIM_TIME,
|
time: UNDIM_TIME,
|
||||||
transition: 'linear'
|
transition: 'linear' });
|
||||||
});
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_mapWindow : function(shellwm, actor) {
|
_mapWindow : function(shellwm, actor) {
|
||||||
|
Loading…
Reference in New Issue
Block a user