slider: Explicitly grab the device that was clicked

It seems the Clutter bug mentioned has been fixed.

https://bugzilla.gnome.org/show_bug.cgi?id=704368
This commit is contained in:
Jasper St. Pierre 2013-06-11 23:43:04 -04:00
parent 0cee0e08e9
commit 44f8fecf84

View File

@ -102,15 +102,15 @@ const Slider = new Lang.Class({
}, },
startDragging: function(event) { startDragging: function(event) {
if (this._dragging) // don't allow two drags at the same time if (this._dragging)
return false; return false;
this._dragging = true; this._dragging = true;
// FIXME: we should only grab the specific device that originated let device = event.get_device();
// the event, but for some weird reason events are still delivered device.grab(this.actor);
// outside the slider if using clutter_grab_pointer_for_device this._grabbedDevice = device;
Clutter.grab_pointer(this.actor);
this._releaseId = this.actor.connect('button-release-event', Lang.bind(this, this._endDragging)); 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)); this._motionId = this.actor.connect('motion-event', Lang.bind(this, this._motionEvent));
let absX, absY; let absX, absY;
@ -124,7 +124,8 @@ const Slider = new Lang.Class({
this.actor.disconnect(this._releaseId); this.actor.disconnect(this._releaseId);
this.actor.disconnect(this._motionId); this.actor.disconnect(this._motionId);
Clutter.ungrab_pointer(); this._grabbedDevice.ungrab();
this._grabbedDevice = null;
this._dragging = false; this._dragging = false;
this.emit('drag-end'); this.emit('drag-end');