dash: Handle cancelled drags

If a drag was cancelled, do animations like size changes or zooming
out the remove target in parallel with the snapback animation.

https://bugzilla.gnome.org/show_bug.cgi?id=644324
This commit is contained in:
Florian Müllner 2011-03-09 16:56:08 +01:00
parent 7f35b2dc43
commit 2c48efa3fd

View File

@ -283,20 +283,37 @@ Dash.prototype = {
Lang.bind(this, this._onDragBegin)); Lang.bind(this, this._onDragBegin));
Main.overview.connect('item-drag-end', Main.overview.connect('item-drag-end',
Lang.bind(this, this._onDragEnd)); Lang.bind(this, this._onDragEnd));
Main.overview.connect('item-drag-cancelled',
Lang.bind(this, this._onDragCancelled));
Main.overview.connect('window-drag-begin', Main.overview.connect('window-drag-begin',
Lang.bind(this, this._onDragBegin)); Lang.bind(this, this._onDragBegin));
Main.overview.connect('window-drag-cancelled',
Lang.bind(this, this._onDragCancelled));
Main.overview.connect('window-drag-end', Main.overview.connect('window-drag-end',
Lang.bind(this, this._onDragEnd)); Lang.bind(this, this._onDragEnd));
}, },
_onDragBegin: function() { _onDragBegin: function() {
this._dragCancelled = false;
this._dragMonitor = { this._dragMonitor = {
dragMotion: Lang.bind(this, this._onDragMotion) dragMotion: Lang.bind(this, this._onDragMotion)
}; };
DND.addDragMonitor(this._dragMonitor); DND.addDragMonitor(this._dragMonitor);
}, },
_onDragCancelled: function() {
this._dragCancelled = true;
this._endDrag();
},
_onDragEnd: function() { _onDragEnd: function() {
if (this._dragCancelled)
return;
this._endDrag();
},
_endDrag: function() {
this._clearDragPlaceholder(); this._clearDragPlaceholder();
if (this._favRemoveTarget) { if (this._favRemoveTarget) {
this._favRemoveTarget.actor.hide(); this._favRemoveTarget.actor.hide();