panel: Notify when solid style changes

In order to improve the transparent top bar's legibility with lighter
wallpapers, we want the background to adapt to the top bar style. To
allow for that in a clean way, export that information in a property
and notify when it changes.

https://bugzilla.gnome.org/show_bug.cgi?id=783913
This commit is contained in:
Florian Müllner 2018-07-24 12:01:35 +02:00
parent 38c1ebba62
commit e45e8a2a14

View File

@ -1039,6 +1039,10 @@ var Panel = new Lang.Class({
return this._leftBox.opacity; return this._leftBox.opacity;
}, },
get solidStyle() {
return this.actor.has_style_class_name('solid');
},
_updatePanel() { _updatePanel() {
let panel = Main.sessionMode.panel; let panel = Main.sessionMode.panel;
this._hideIndicators(); this._hideIndicators();
@ -1073,8 +1077,12 @@ var Panel = new Lang.Class({
}, },
_updateSolidStyle() { _updateSolidStyle() {
let hadSolidStyle = this.solidStyle;
if (this.has_style_pseudo_class('overview') || !Main.sessionMode.hasWindows) { if (this.has_style_pseudo_class('overview') || !Main.sessionMode.hasWindows) {
this._removeStyleClassName('solid'); this._removeStyleClassName('solid');
if (hadSolidStyle)
this.emit('solid-style-changed');
return; return;
} }
@ -1104,6 +1112,8 @@ var Panel = new Lang.Class({
else else
this._removeStyleClassName('solid'); this._removeStyleClassName('solid');
if (isNearEnough != hadSolidStyle)
this.emit('solid-style-changed');
}, },
_hideIndicators() { _hideIndicators() {
@ -1213,3 +1223,4 @@ var Panel = new Lang.Class({
}); });
} }
}); });
Signals.addSignalMethods(Panel.prototype);