[gnome-shell/wip/aggregate-menu: 19/57] slider: Explicitly grab the device that was clicked



commit 46c03eb4c889ae3e73f0cd9c45f6661516c81385
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Jun 11 23:43:04 2013 -0400

    slider: Explicitly grab the device that was clicked
    
    It seems the Clutter bug mentioned has been fixed.

 js/ui/slider.js |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/slider.js b/js/ui/slider.js
index 2076818..025f0db 100644
--- a/js/ui/slider.js
+++ b/js/ui/slider.js
@@ -102,15 +102,15 @@ const Slider = new Lang.Class({
     },
 
     startDragging: function(event) {
-        if (this._dragging) // don't allow two drags at the same time
+        if (this._dragging)
             return false;
 
         this._dragging = true;
 
-        // FIXME: we should only grab the specific device that originated
-        // the event, but for some weird reason events are still delivered
-        // outside the slider if using clutter_grab_pointer_for_device
-        Clutter.grab_pointer(this.actor);
+        let device = event.get_device();
+        device.grab(this.actor);
+        this._grabbedDevice = device;
+
         this._releaseId = this.actor.connect('button-release-event', Lang.bind(this, this._endDragging));
         this._motionId = this.actor.connect('motion-event', Lang.bind(this, this._motionEvent));
         let absX, absY;
@@ -124,7 +124,8 @@ const Slider = new Lang.Class({
             this.actor.disconnect(this._releaseId);
             this.actor.disconnect(this._motionId);
 
-            Clutter.ungrab_pointer();
+            this._grabbedDevice.ungrab();
+            this._grabbedDevice = null;
             this._dragging = false;
 
             this.emit('drag-end');


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