[gnome-shell] dnd: Add a drag-cancelled signal



commit a80e88e33e6a7f55354270dfa1ae8fc8cabc1890
Author: Alexander Larsson <alexl redhat com>
Date:   Tue Mar 8 14:44:47 2011 +0100

    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(+), 0 deletions(-)
---
diff --git a/js/ui/dnd.js b/js/ui/dnd.js
index 8751556..46d32fd 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 d5f7392..2d67286 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 8a6c05e..a6798ce 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();



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