[gnome-shell/gbsneto/40-stuff: 42/68] viewSelector: Move edge drag gesture to overview




commit 49e694e5b80aae09b671db5e97c9dcf1e2cf5b35
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Tue Jan 5 10:33:59 2021 -0300

    viewSelector: Move edge drag gesture to overview
    
    It doesn't use any ViewSelector's API anymore, only Overview's, so move it
    to its natural place.

 js/ui/overview.js     | 19 +++++++++++++++++++
 js/ui/viewSelector.js | 18 +-----------------
 2 files changed, 20 insertions(+), 17 deletions(-)
---
diff --git a/js/ui/overview.js b/js/ui/overview.js
index b24aa89a67..835665003c 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -9,6 +9,7 @@ const Signals = imports.signals;
 var ANIMATION_TIME = 250;
 
 const DND = imports.ui.dnd;
+const EdgeDragAction = imports.ui.edgeDragAction;
 const LayoutManager = imports.ui.layout;
 const Main = imports.ui.main;
 const MessageTray = imports.ui.messageTray;
@@ -236,6 +237,24 @@ var Overview = class {
             Meta.KeyBindingFlags.IGNORE_AUTOREPEAT,
             Shell.ActionMode.NORMAL | Shell.ActionMode.OVERVIEW,
             this.toggle.bind(this));
+
+
+        let side;
+        if (Clutter.get_default_text_direction() === Clutter.TextDirection.RTL)
+            side = St.Side.RIGHT;
+        else
+            side = St.Side.LEFT;
+
+        const gesture =
+            new EdgeDragAction.EdgeDragAction(side, Shell.ActionMode.NORMAL);
+
+        gesture.connect('activated', () => {
+            if (Main.overview.visible)
+                this.hide();
+            else
+                this.showApps();
+        });
+        global.stage.add_action(gesture);
     }
 
     addSearchProvider(provider) {
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 16e580c55e..d77bdf9737 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -11,7 +11,6 @@ const Params = imports.misc.params;
 const Search = imports.ui.search;
 const ShellEntry = imports.ui.shellEntry;
 const WorkspacesView = imports.ui.workspacesView;
-const EdgeDragAction = imports.ui.edgeDragAction;
 
 var PINCH_GESTURE_THRESHOLD = 0.7;
 
@@ -281,22 +280,7 @@ var ViewSelector = GObject.registerClass({
             }
         });
 
-        let side;
-        if (Clutter.get_default_text_direction() == Clutter.TextDirection.RTL)
-            side = St.Side.RIGHT;
-        else
-            side = St.Side.LEFT;
-        let gesture = new EdgeDragAction.EdgeDragAction(side,
-                                                        Shell.ActionMode.NORMAL);
-        gesture.connect('activated', () => {
-            if (Main.overview.visible)
-                Main.overview.hide();
-            else
-                Main.overview.showApps();
-        });
-        global.stage.add_action(gesture);
-
-        gesture = new ShowOverviewAction();
+        let gesture = new ShowOverviewAction();
         gesture.connect('activated', this._pinchGestureActivated.bind(this));
         global.stage.add_action(gesture);
 


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