[gnome-shell] volume: Add smooth scrolling to adjust output volume
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] volume: Add smooth scrolling to adjust output volume
- Date: Thu, 20 Dec 2012 13:40:45 +0000 (UTC)
commit 8d4855f1008b9d0d9e579c0ac81fd2ce076c3faa
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Sun Nov 4 10:53:23 2012 -0500
volume: Add smooth scrolling to adjust output volume
Allow users to smoothly scroll on the volume indicator icon
to adjust the volume. Do this by simply passing the scroll
event to the slider inside the menu.
https://bugzilla.gnome.org/show_bug.cgi?id=687573
js/ui/popupMenu.js | 7 ++++++-
js/ui/status/volume.js | 24 +++---------------------
2 files changed, 9 insertions(+), 22 deletions(-)
---
diff --git a/js/ui/popupMenu.js b/js/ui/popupMenu.js
index fd4b928..6bcc994 100644
--- a/js/ui/popupMenu.js
+++ b/js/ui/popupMenu.js
@@ -636,7 +636,7 @@ const PopupSliderMenuItem = new Lang.Class({
return true;
},
- _onScrollEvent: function (actor, event) {
+ scroll: function(event) {
let direction = event.get_scroll_direction();
let delta;
@@ -655,10 +655,15 @@ const PopupSliderMenuItem = new Lang.Class({
}
this._value = Math.min(Math.max(0, this._value + delta), 1);
+
this._slider.queue_repaint();
this.emit('value-changed', this._value);
},
+ _onScrollEvent: function(actor, event) {
+ this.scroll(event);
+ },
+
_motionEvent: function(actor, event) {
let absX, absY;
[absX, absY] = event.get_coords();
diff --git a/js/ui/status/volume.js b/js/ui/status/volume.js
index 99b003b..faccf84 100644
--- a/js/ui/status/volume.js
+++ b/js/ui/status/volume.js
@@ -69,26 +69,8 @@ const VolumeMenu = new Lang.Class({
this._onControlStateChanged();
},
- scroll: function(direction) {
- let currentVolume = this._output.volume;
-
- if (direction == Clutter.ScrollDirection.DOWN) {
- let prev_muted = this._output.is_muted;
- this._output.volume = Math.max(0, currentVolume - this._volumeMax * VOLUME_ADJUSTMENT_STEP);
- if (this._output.volume < 1) {
- this._output.volume = 0;
- if (!prev_muted)
- this._output.change_is_muted(true);
- }
- this._output.push_volume();
- }
- else if (direction == Clutter.ScrollDirection.UP) {
- this._output.volume = Math.min(this._volumeMax, currentVolume + this._volumeMax * VOLUME_ADJUSTMENT_STEP);
- this._output.change_is_muted(false);
- this._output.push_volume();
- }
-
- this._notifyVolumeChange();
+ scroll: function(event) {
+ this._outputSlider.scroll(event);
},
_onControlStateChanged: function() {
@@ -279,6 +261,6 @@ const Indicator = new Lang.Class({
},
_onScrollEvent: function(actor, event) {
- this._volumeMenu.scroll(event.get_scroll_direction());
+ this._volumeMenu.scroll(event);
}
});
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]