[gnome-shell] windowManager: Disable the window dimmer when we close all attached dialogs
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] windowManager: Disable the window dimmer when we close all attached dialogs
- Date: Fri, 31 Aug 2012 19:47:25 +0000 (UTC)
commit f8805e83111f82d9bedaaf9011ad10d2b2b54624
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Thu Aug 30 16:32:44 2012 -0300
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
js/ui/windowManager.js | 36 +++++++++++++++++++++++-------------
1 files changed, 23 insertions(+), 13 deletions(-)
---
diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js
index 9d438a9..6a52037 100644
--- a/js/ui/windowManager.js
+++ b/js/ui/windowManager.js
@@ -27,16 +27,24 @@ const WindowDimmer = new Lang.Class({
this._brightnessEffect = new Clutter.BrightnessContrastEffect();
actor.add_effect(this._brightnessEffect);
this.actor = actor;
+ this._enabled = true;
this._dimFactor = 0.0;
+ this._syncEnabled();
+ },
+
+ _syncEnabled: function() {
+ this._brightnessEffect.enabled = (this._enabled && this._dimFactor > 0);
},
setEnabled: function(enabled) {
- this._brightnessEffect.enabled = enabled;
+ this._enabled = enabled;
+ this._syncEnabled();
},
set dimFactor(factor) {
this._dimFactor = factor;
this._brightnessEffect.set_brightness(factor * DIM_BRIGHTNESS);
+ this._syncEnabled();
},
get dimFactor() {
@@ -45,10 +53,17 @@ const WindowDimmer = new Lang.Class({
});
function getWindowDimmer(actor) {
- if (!actor._windowDimmer)
- actor._windowDimmer = new WindowDimmer(actor);
-
- return actor._windowDimmer;
+ let enabled = Meta.prefs_get_attach_modal_dialogs();
+ if (actor._windowDimmer)
+ actor._windowDimmer.setEnabled(enabled);
+
+ if (enabled) {
+ if (!actor._windowDimmer)
+ actor._windowDimmer = new WindowDimmer(actor);
+ return actor._windowDimmer;
+ } else {
+ return null;
+ }
}
const WindowManager = new Lang.Class({
@@ -255,9 +270,7 @@ const WindowManager = new Lang.Class({
if (!actor)
return;
let dimmer = getWindowDimmer(actor);
- let enabled = Meta.prefs_get_attach_modal_dialogs();
- dimmer.setEnabled(enabled);
- if (!enabled)
+ if (!dimmer)
return;
Tweener.addTween(dimmer,
{ dimFactor: 1.0,
@@ -271,15 +284,12 @@ const WindowManager = new Lang.Class({
if (!actor)
return;
let dimmer = getWindowDimmer(actor);
- let enabled = Meta.prefs_get_attach_modal_dialogs();
- dimmer.setEnabled(enabled);
- if (!enabled)
+ if (!dimmer)
return;
Tweener.addTween(dimmer,
{ dimFactor: 0.0,
time: UNDIM_TIME,
- transition: 'linear'
- });
+ transition: 'linear' });
},
_mapWindow : function(shellwm, actor) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]