[gnome-shell/wip/laney/volume-slider-ignore-own-changes] volume: Ignore slider changes we initiated ourselves
- From: Iain Lane <iainl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell/wip/laney/volume-slider-ignore-own-changes] volume: Ignore slider changes we initiated ourselves
- Date: Thu, 5 Sep 2019 10:16:52 +0000 (UTC)
commit d5f2b481d3689e0be0387484c6afcde3b6b407ae
Author: Iain Lane <iainl gnome org>
Date: Thu Sep 5 10:45:37 2019 +0100
volume: Ignore slider changes we initiated ourselves
Commit 21e14bd46f9774e6c0146cb2169d938e782dba3c fixed this for the
brightness slider, but we have the same problem for volume too. When the
volume is muted - for example in Settings or via a media key, we update
the slider to '0' to indicate this visually. But we also actually invoke
the slider's callback to *set* the volume to zero. That means that the
previous level is overwritten so it can't be restored when unmuting.
The fix is the same - when we update the slider internally ourselves,
don't call the signal handler.
js/ui/status/volume.js | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/js/ui/status/volume.js b/js/ui/status/volume.js
index 470e1f7b44..37d89e98b0 100644
--- a/js/ui/status/volume.js
+++ b/js/ui/status/volume.js
@@ -36,7 +36,8 @@ var StreamSlider = class {
this._soundSettings.connect(`changed::${ALLOW_AMPLIFIED_VOLUME_KEY}`,
this._amplifySettingsChanged.bind(this));
this._amplifySettingsChanged();
- this._slider.connect('notify::value', this._sliderChanged.bind(this));
+ this._sliderChangedId = this._slider.connect('notify::value',
+ this._sliderChanged.bind(this));
this._slider.connect('drag-end', this._notifyVolumeChange.bind(this));
this._icon = new St.Icon({ style_class: 'popup-menu-icon' });
@@ -129,10 +130,16 @@ var StreamSlider = class {
this._volumeCancellable);
}
+ _changeSlider(value) {
+ GObject.signal_handler_block(this._slider, this._sliderChangedId);
+ this._slider.value = value;
+ GObject.signal_handler_unblock(this._slider, this._sliderChangedId);
+ }
+
_updateVolume() {
let muted = this._stream.is_muted;
- this._slider.value = muted
- ? 0 : (this._stream.volume / this._control.get_vol_max_norm());
+ this._changeSlider (muted
+ ? 0 : (this._stream.volume / this._control.get_vol_max_norm()));
this.emit('stream-updated');
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]