From e45e8a2a14dbb4f26275504011550135f5f84ed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Tue, 24 Jul 2018 12:01:35 +0200 Subject: [PATCH] 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 --- js/ui/panel.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/js/ui/panel.js b/js/ui/panel.js index 49759af4c..1bca06b10 100644 --- a/js/ui/panel.js +++ b/js/ui/panel.js @@ -1039,6 +1039,10 @@ var Panel = new Lang.Class({ return this._leftBox.opacity; }, + get solidStyle() { + return this.actor.has_style_class_name('solid'); + }, + _updatePanel() { let panel = Main.sessionMode.panel; this._hideIndicators(); @@ -1073,8 +1077,12 @@ var Panel = new Lang.Class({ }, _updateSolidStyle() { + let hadSolidStyle = this.solidStyle; + if (this.has_style_pseudo_class('overview') || !Main.sessionMode.hasWindows) { this._removeStyleClassName('solid'); + if (hadSolidStyle) + this.emit('solid-style-changed'); return; } @@ -1104,6 +1112,8 @@ var Panel = new Lang.Class({ else this._removeStyleClassName('solid'); + if (isNearEnough != hadSolidStyle) + this.emit('solid-style-changed'); }, _hideIndicators() { @@ -1213,3 +1223,4 @@ var Panel = new Lang.Class({ }); } }); +Signals.addSignalMethods(Panel.prototype);