[gnome-shell/T27795: 83/138] Make clicks on empty areas work with multiple monitors



commit e96f8e5a484099c61166080afb219ce2d82fd210
Author: Cosimo Cecchi <cosimo endlessm com>
Date:   Wed Jun 19 13:28:15 2013 -0700

    Make clicks on empty areas work with multiple monitors
    
    Add an isPrimary argument to Main.overview.addAction() that determines
    whether the action only applies to the primary monitor.
    At the same time, add an additional actor that spans the whole overlay
    group to catch events behind overview elements on all monitors.
    
    [endlessm/eos-shell#332]

 js/ui/overview.js       | 18 +++++++++++++++---
 js/ui/workspacesView.js |  4 ++--
 2 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/js/ui/overview.js b/js/ui/overview.js
index c7f51db1aa..8271361971 100644
--- a/js/ui/overview.js
+++ b/js/ui/overview.js
@@ -174,13 +174,22 @@ var Overview = class {
 
         this._overviewCreated = true;
 
+        // 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 });
+        this._allMonitorsGroup.add_constraint(
+            new Clutter.BindConstraint({ source: Main.layoutManager.overviewGroup,
+                                         coordinate: Clutter.BindCoordinate.ALL }));
+
         this._overview = new St.BoxLayout({ name: 'overview',
                                             /* Translators: This is the main view to select
                                                activities. See also note for "Activities" string. */
                                             accessible_name: _("Overview"),
+                                            reactive: true,
                                             vertical: true });
         this._overview.add_constraint(new Monitor.MonitorConstraint({ primary: true }));
         this._overview._delegate = this;
+        this._allMonitorsGroup.add_actor(this._overview);
 
         // The main Background actors are inside global.window_group which are
         // hidden when displaying the overview, so we create a new
@@ -212,7 +221,7 @@ var Overview = class {
         Main.layoutManager.overviewGroup.add_child(this._coverPane);
         this._coverPane.connect('event', () => Clutter.EVENT_STOP);
 
-        Main.layoutManager.overviewGroup.add_child(this._overview);
+        Main.layoutManager.overviewGroup.add_child(this._allMonitorsGroup);
 
         this._coverPane.hide();
 
@@ -403,11 +412,14 @@ var Overview = class {
         return Clutter.EVENT_PROPAGATE;
     }
 
-    addAction(action) {
+    addAction(action, isPrimary) {
         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/workspacesView.js b/js/ui/workspacesView.js
index 4f3e5735a9..65f5af219c 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -468,7 +468,7 @@ var WorkspacesDisplay = class {
 
             this.emit('empty-space-clicked');
         });
-        Main.overview.addAction(clickAction);
+        Main.overview.addAction(clickAction, false);
         this.actor.bind_property('mapped', clickAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
 
         let panAction = new Clutter.PanAction({ threshold_trigger_edge: Clutter.GestureTriggerEdge.AFTER });
@@ -491,7 +491,7 @@ var WorkspacesDisplay = class {
             clickAction.release();
             this._endSwipeScroll();
         });
-        Main.overview.addAction(panAction);
+        Main.overview.addAction(panAction, true);
         this.actor.bind_property('mapped', panAction, 'enabled', GObject.BindingFlags.SYNC_CREATE);
 
         let allowedModes = Shell.ActionMode.OVERVIEW;


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