[gnome-shell/eos3.8: 63/255] Allow returning to desktop when clicking on an empty overview area



commit bf40d94197257b60fb68863f1f5cd57af3c43e42
Author: Mario Sanchez Prada <mario endlessm com>
Date:   Wed Jun 7 21:49:01 2017 +0100

    Allow returning to desktop when clicking on an empty overview area
    
    This allows exiting the window picker mode by clicking any empty
    space in the overview (i.e. outside any cloned window).
    
     * 2020-03-16: Squash with e2f0ae943

 js/ui/overview.js       | 19 ++++++++++++++++---
 js/ui/viewSelector.js   |  6 ++++++
 js/ui/workspacesView.js | 11 ++++++++---
 3 files changed, 30 insertions(+), 6 deletions(-)
---
diff --git a/js/ui/overview.js b/js/ui/overview.js
index 371d3971d7..589526aa50 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -322,9 +322,19 @@ var Overview = class {
         if (this.isDummy)
             return;
 
+        // this._allMonitorsGroup is a simple actor that covers all monitors,
+        // used to install actions that apply to all monitors
+        this._allMonitorsGroup = new Clutter.Actor({
+            reactive: true,
+            x_expand: true,
+            y_expand: true,
+        });
+
         this._overview = new OverviewActor();
         this._overview._delegate = this;
-        Main.layoutManager.overviewGroup.add_child(this._overview);
+        this._allMonitorsGroup.add_actor(this._overview);
+
+        Main.layoutManager.overviewGroup.add_child(this._allMonitorsGroup);
 
         this._shellInfo = new ShellInfo();
 
@@ -436,11 +446,14 @@ var Overview = class {
         return Clutter.EVENT_PROPAGATE;
     }
 
-    addAction(action) {
+    addAction(action, isPrimary = true) {
         if (this.isDummy)
             return;
 
-        this._backgroundGroup.add_action(action);
+        if (isPrimary)
+            this._overview.add_action(action);
+        else
+            this._allMonitorsGroup.add_action(action);
     }
 
     _getDesktopClone() {
diff --git a/js/ui/viewSelector.js b/js/ui/viewSelector.js
index 4678afb11e..f1413faac6 100644
--- a/js/ui/viewSelector.js
+++ b/js/ui/viewSelector.js
@@ -170,6 +170,8 @@ var ViewSelector = GObject.registerClass({
 
         this._workspacesDisplay =
             new WorkspacesView.WorkspacesDisplay(workspaceAdjustment);
+        this._workspacesDisplay.connect('empty-space-clicked',
+            this._onEmptySpaceClicked.bind(this));
         this._workspacesPage = this._addPage(this._workspacesDisplay,
                                              _("Windows"), 'focus-windows-symbolic');
 
@@ -263,6 +265,10 @@ var ViewSelector = GObject.registerClass({
             Main.overview.show();
     }
 
+    _onEmptySpaceClicked() {
+        this.setActivePage(ViewPage.APPS);
+    }
+
     showApps() {
         Main.overview.show();
     }
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index 52ea5fdbf5..8073edf638 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -389,8 +389,11 @@ class ExtraWorkspaceView extends WorkspacesViewBase {
     }
 });
 
-var WorkspacesDisplay = GObject.registerClass(
-class WorkspacesDisplay extends St.Widget {
+var WorkspacesDisplay = GObject.registerClass({
+    Signals: {
+        'empty-space-clicked': {},
+    },
+}, class WorkspacesDisplay extends St.Widget {
     _init(scrollAdjustment) {
         super._init({ clip_to_allocation: true });
         this.connect('notify::allocation', this._updateWorkspacesActualGeometry.bind(this));
@@ -416,8 +419,10 @@ class WorkspacesDisplay extends St.Widget {
             if ((action.get_button() == 1 || action.get_button() == 0) &&
                 this._workspacesViews[index].getActiveWorkspace().isEmpty())
                 Main.overview.hide();
+
+            this.emit('empty-space-clicked');
         });
-        Main.overview.addAction(clickAction);
+        Main.overview.addAction(clickAction, false);
         this.bind_property('mapped', clickAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
         this._clickAction = clickAction;
 


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