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
This commit is contained in:
Alexander Larsson 2011-03-08 14:44:47 +01:00
parent 0207f1f29b
commit a80e88e33e
3 changed files with 14 additions and 0 deletions

View File

@ -498,6 +498,7 @@ _Draggable.prototype = {
}, },
_cancelDrag: function(eventTime) { _cancelDrag: function(eventTime) {
this.emit('drag-cancelled', eventTime);
this._dragInProgress = false; this._dragInProgress = false;
let [snapBackX, snapBackY, snapBackScale] = this._getRestoreLocation(); let [snapBackX, snapBackY, snapBackScale] = this._getRestoreLocation();

View File

@ -481,6 +481,10 @@ Overview.prototype = {
this.emit('window-drag-begin'); this.emit('window-drag-begin');
}, },
cancelledWindowDrag: function(source) {
this.emit('window-drag-cancelled');
},
endWindowDrag: function(source) { endWindowDrag: function(source) {
this.emit('window-drag-end'); this.emit('window-drag-end');
}, },

View File

@ -125,6 +125,7 @@ WindowClone.prototype = {
dragActorMaxSize: WINDOW_DND_SIZE, dragActorMaxSize: WINDOW_DND_SIZE,
dragActorOpacity: DRAGGING_WINDOW_OPACITY }); dragActorOpacity: DRAGGING_WINDOW_OPACITY });
this._draggable.connect('drag-begin', Lang.bind(this, this._onDragBegin)); 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._draggable.connect('drag-end', Lang.bind(this, this._onDragEnd));
this.inDrag = false; this.inDrag = false;
@ -292,6 +293,10 @@ WindowClone.prototype = {
this.emit('drag-begin'); this.emit('drag-begin');
}, },
_onDragCancelled : function (draggable, time) {
this.emit('drag-cancelled');
},
_onDragEnd : function (draggable, time, snapback) { _onDragEnd : function (draggable, time, snapback) {
this.inDrag = false; this.inDrag = false;
@ -1231,6 +1236,10 @@ Workspace.prototype = {
Main.overview.beginWindowDrag(); Main.overview.beginWindowDrag();
overlay.hide(); overlay.hide();
})); }));
clone.connect('drag-cancelled',
Lang.bind(this, function(clone) {
Main.overview.cancelledWindowDrag();
}));
clone.connect('drag-end', clone.connect('drag-end',
Lang.bind(this, function(clone) { Lang.bind(this, function(clone) {
Main.overview.endWindowDrag(); Main.overview.endWindowDrag();