[gnome-shell/wip/aggregate-menu: 33/59] slider: Make clicking anywhere on the slider menu item pass to the slider



commit e6211a60d1e8ab1eed6689bf30d2b8c4ff5c426e
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Jun 11 23:39:56 2013 -0400

    slider: Make clicking anywhere on the slider menu item pass to the slider

 js/ui/slider.js            |    5 ++++-
 js/ui/status/brightness.js |    4 ++++
 js/ui/status/volume.js     |    4 ++++
 3 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/slider.js b/js/ui/slider.js
index f41637e..3804a69 100644
--- a/js/ui/slider.js
+++ b/js/ui/slider.js
@@ -88,6 +88,10 @@ const Slider = new Lang.Class({
     },
 
     _startDragging: function(actor, event) {
+        this.startDragging(event);
+    },
+
+    startDragging: function(event) {
         if (this._dragging) // don't allow two drags at the same time
             return false;
 
@@ -102,7 +106,6 @@ const Slider = new Lang.Class({
         let absX, absY;
         [absX, absY] = event.get_coords();
         this._moveHandle(absX, absY);
-
         return true;
     },
 
diff --git a/js/ui/status/brightness.js b/js/ui/status/brightness.js
index 9721432..7f16786 100644
--- a/js/ui/status/brightness.js
+++ b/js/ui/status/brightness.js
@@ -36,6 +36,10 @@ const BrightnessSlider = new Lang.Class({
         this.item.addActor(icon, { align: St.Align.MIDDLE });
         this.item.addActor(this._slider.actor, { span: -1, expand: true });
 
+        this.item.actor.connect('button-press-event', Lang.bind(this, function(actor, event) {
+            this._slider.startDragging(event);
+        }));
+
         this._updateBrightness();
     },
 
diff --git a/js/ui/status/volume.js b/js/ui/status/volume.js
index 885b78f..7e04c54 100644
--- a/js/ui/status/volume.js
+++ b/js/ui/status/volume.js
@@ -43,6 +43,10 @@ const StreamSlider = new Lang.Class({
         this.item.addActor(this._icon, { align: St.Align.MIDDLE });
         this.item.addActor(this._slider.actor, { span: -1, expand: true });
 
+        this.item.actor.connect('button-press-event', Lang.bind(this, function(actor, event) {
+            this._slider.startDragging(event);
+        }));
+
         this._stream = null;
     },
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]