[gnome-shell/wip/hot-corner-barriers: 8/11] layout: Extract toggling overview logic into one function



commit 560c6e9b557da9514a141be507de12742be13b13
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Sun Mar 3 14:03:29 2013 -0500

    layout: Extract toggling overview logic into one function
    
    Since barriers will continue to get events even when another client
    is grabbed, we have to track the current status of XDnD to determine
    whether to take a grab ourselves or not.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=663661

 js/ui/layout.js      |   23 +++++++++++++++--------
 js/ui/xdndHandler.js |    3 +++
 2 files changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/js/ui/layout.js b/js/ui/layout.js
index 4adf3a0..646457d 100644
--- a/js/ui/layout.js
+++ b/js/ui/layout.js
@@ -1195,14 +1195,23 @@ const HotCorner = new Lang.Class({
         this._animRipple(this._ripple3, 0.35,  1.0,   0.0,   0.3,     1);
     },
 
+    _toggleOverview: function() {
+        if (Main.xdndHandler.inDrag) {
+            if (!Main.overview.visible && !Main.overview.animationInProgress) {
+                Main.overview.showTemporarily();
+                this.rippleAnimation();
+            }
+        } else {
+            Main.overview.toggle();
+            this.rippleAnimation();
+        }
+    },
+
     handleDragOver: function(source, actor, x, y, time) {
         if (source != Main.xdndHandler)
             return DND.DragMotionResult.CONTINUE;
 
-        if (!Main.overview.visible && !Main.overview.animationInProgress) {
-            this.rippleAnimation();
-            Main.overview.showTemporarily();
-        }
+        this._toggleOverview();
 
         return DND.DragMotionResult.CONTINUE;
     },
@@ -1210,10 +1219,8 @@ const HotCorner = new Lang.Class({
     _onCornerEntered : function() {
         if (!this._entered) {
             this._entered = true;
-            if (Main.overview.shouldToggleByCornerOrButton()) {
-                this.rippleAnimation();
-                Main.overview.toggle();
-            }
+            if (Main.overview.shouldToggleByCornerOrButton())
+                this._toggleOverview();
         }
         return false;
     },
diff --git a/js/ui/xdndHandler.js b/js/ui/xdndHandler.js
index 85af2fa..d4179bd 100644
--- a/js/ui/xdndHandler.js
+++ b/js/ui/xdndHandler.js
@@ -28,6 +28,7 @@ const XdndHandler = new Lang.Class({
         global.connect('xdnd-leave', Lang.bind(this, this._onLeave));
 
         this._windowGroupVisibilityHandlerId = 0;
+        this.inDrag = false;
     },
 
     // Called when the user cancels the drag (i.e release the button)
@@ -41,6 +42,7 @@ const XdndHandler = new Lang.Class({
             this._cursorWindowClone = null;
         }
 
+        this.inDrag = false;
         this.emit('drag-end');
     },
 
@@ -49,6 +51,7 @@ const XdndHandler = new Lang.Class({
                 global.window_group.connect('notify::visible',
                     Lang.bind(this, this._onWindowGroupVisibilityChanged));
 
+        this.inDrag = true;
         this.emit('drag-begin', global.get_current_time());
     },
 


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