From a80e88e33e6a7f55354270dfa1ae8fc8cabc1890 Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Tue, 8 Mar 2011 14:44:47 +0100 Subject: [PATCH] dnd: Add a drag-cancelled signal This lets us start the workspace zoom out animation right when the snapback starts, rather than waiting for the snapback to finish. https://bugzilla.gnome.org/show_bug.cgi?id=643786 --- js/ui/dnd.js | 1 + js/ui/overview.js | 4 ++++ js/ui/workspace.js | 9 +++++++++ 3 files changed, 14 insertions(+) diff --git a/js/ui/dnd.js b/js/ui/dnd.js index 87515563f..46d32fdd3 100644 --- a/js/ui/dnd.js +++ b/js/ui/dnd.js @@ -498,6 +498,7 @@ _Draggable.prototype = { }, _cancelDrag: function(eventTime) { + this.emit('drag-cancelled', eventTime); this._dragInProgress = false; let [snapBackX, snapBackY, snapBackScale] = this._getRestoreLocation(); diff --git a/js/ui/overview.js b/js/ui/overview.js index d5f739272..2d672868f 100644 --- a/js/ui/overview.js +++ b/js/ui/overview.js @@ -481,6 +481,10 @@ Overview.prototype = { this.emit('window-drag-begin'); }, + cancelledWindowDrag: function(source) { + this.emit('window-drag-cancelled'); + }, + endWindowDrag: function(source) { this.emit('window-drag-end'); }, diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 8a6c05eeb..a6798cef2 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -125,6 +125,7 @@ WindowClone.prototype = { dragActorMaxSize: WINDOW_DND_SIZE, dragActorOpacity: DRAGGING_WINDOW_OPACITY }); this._draggable.connect('drag-begin', Lang.bind(this, this._onDragBegin)); + this._draggable.connect('drag-cancelled', Lang.bind(this, this._onDragCancelled)); this._draggable.connect('drag-end', Lang.bind(this, this._onDragEnd)); this.inDrag = false; @@ -292,6 +293,10 @@ WindowClone.prototype = { this.emit('drag-begin'); }, + _onDragCancelled : function (draggable, time) { + this.emit('drag-cancelled'); + }, + _onDragEnd : function (draggable, time, snapback) { this.inDrag = false; @@ -1231,6 +1236,10 @@ Workspace.prototype = { Main.overview.beginWindowDrag(); overlay.hide(); })); + clone.connect('drag-cancelled', + Lang.bind(this, function(clone) { + Main.overview.cancelledWindowDrag(); + })); clone.connect('drag-end', Lang.bind(this, function(clone) { Main.overview.endWindowDrag();