Skip to content

Commit bda9dc5

Browse files
committed
[email protected]: Fix panel scrolling behavior.
- Filter out smooth scroll events. - Suppress tooltip during horizontal scrolling (track change) - Ignore track change when player is stopped (same as controller buttons). Fixes #11037
1 parent e2157df commit bda9dc5

File tree

1 file changed

+19
-8
lines changed

1 file changed

+19
-8
lines changed

files/usr/share/cinnamon/applets/[email protected]/applet.js

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,8 +1144,15 @@ class CinnamonSoundApplet extends Applet.TextIconApplet {
11441144
}
11451145

11461146
_onScrollEvent(actor, event) {
1147-
let direction = event.get_scroll_direction();
1147+
const direction = event.get_scroll_direction();
1148+
1149+
if (direction == Clutter.ScrollDirection.SMOOTH) {
1150+
return Clutter.EVENT_PROPAGATE;
1151+
}
1152+
11481153
let currentVolume = this._output.volume;
1154+
let volumeChange = false;
1155+
let player = this._players[this._activePlayer];
11491156

11501157
if (direction == Clutter.ScrollDirection.DOWN) {
11511158
let prev_muted = this._output.is_muted;
@@ -1159,29 +1166,33 @@ class CinnamonSoundApplet extends Applet.TextIconApplet {
11591166
if (this._output.volume!=this._volumeNorm && this._output.volume>this._volumeNorm*(1-VOLUME_ADJUSTMENT_STEP/2) && this._output.volume<this._volumeNorm*(1+VOLUME_ADJUSTMENT_STEP/2))
11601167
this._output.volume=this._volumeNorm;
11611168
}
1162-
this._output.push_volume();
1169+
1170+
volumeChange = true;
11631171
}
11641172
else if (direction == Clutter.ScrollDirection.UP) {
11651173
this._output.volume = Math.min(this._volumeMax, currentVolume + this._volumeNorm * VOLUME_ADJUSTMENT_STEP);
11661174
// 100% is magnetic:
11671175
if (this._output.volume!=this._volumeNorm && this._output.volume>this._volumeNorm*(1-VOLUME_ADJUSTMENT_STEP/2) && this._output.volume<this._volumeNorm*(1+VOLUME_ADJUSTMENT_STEP/2))
11681176
this._output.volume=this._volumeNorm;
1169-
this._output.push_volume();
1177+
11701178
this._output.change_is_muted(false);
1179+
volumeChange = true;
11711180
}
1172-
else if (this.horizontalScroll) {
1181+
else if (this.horizontalScroll && player !== null && player._playerStatus !== "Stopped") {
11731182
if (direction == Clutter.ScrollDirection.LEFT) {
11741183
this._players[this._activePlayer]._mediaServerPlayer.PreviousRemote();
11751184
}
1176-
else {
1185+
else if (direction == Clutter.ScrollDirection.RIGHT) {
11771186
this._players[this._activePlayer]._mediaServerPlayer.NextRemote();
11781187
}
11791188
}
11801189

1181-
this._applet_tooltip.show();
1182-
1183-
if (event.get_scroll_direction() != Clutter.ScrollDirection.SMOOTH) {
1190+
if (volumeChange) {
1191+
this._output.push_volume();
11841192
this._notifyVolumeChange(this._output);
1193+
this._applet_tooltip.show();
1194+
} else {
1195+
this._applet_tooltip.hide();
11851196
}
11861197
}
11871198

0 commit comments

Comments
 (0)