[gnome-shell] workspacesView: Allow activating empty workspaces on any monitor
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] workspacesView: Allow activating empty workspaces on any monitor
- Date: Mon, 27 Jun 2016 14:32:39 +0000 (UTC)
commit e16f63a8e424fc7a26e7e2db4753a9cad09bdca3
Author: Florian Müllner <fmuellner gnome org>
Date: Fri Jun 24 18:15:48 2016 +0200
workspacesView: Allow activating empty workspaces on any monitor
We allow activating a workspace by clicking it when we know that
the user did not try to select a window and missed (namely: the
workspace is empty). However we currently always check for an
empty workspace on the primary monitor, which doesn't make sense
when the click happened on a different monitor.
https://bugzilla.gnome.org/show_bug.cgi?id=766883
js/ui/workspacesView.js | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
---
diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js
index e516661..aaa9522 100644
--- a/js/ui/workspacesView.js
+++ b/js/ui/workspacesView.js
@@ -374,6 +374,10 @@ const ExtraWorkspaceView = new Lang.Class({
this._workspace.setActualGeometry(this._actualGeometry);
},
+ getActiveWorkspace: function() {
+ return this._workspace;
+ },
+
animateToOverview: function(animationType) {
if (animationType == AnimationType.ZOOM)
this._workspace.zoomToOverview();
@@ -421,8 +425,10 @@ const WorkspacesDisplay = new Lang.Class({
// Only switch to the workspace when there's no application
// windows open. The problem is that it's too easy to miss
// an app window and get the wrong one focused.
+ let event = Clutter.get_current_event();
+ let index = this._getMonitorIndexForEvent(event);
if ((action.get_button() == 1 || action.get_button() == 0) &&
- this._getPrimaryView().getActiveWorkspace().isEmpty())
+ this._workspacesViews[index].getActiveWorkspace().isEmpty())
Main.overview.hide();
}));
Main.overview.addAction(clickAction);
@@ -582,6 +588,12 @@ const WorkspacesDisplay = new Lang.Class({
}
},
+ _getMonitorIndexForEvent: function(event) {
+ let [x, y] = event.get_coords();
+ let rect = new Meta.Rectangle({ x: x, y: y, width: 1, height: 1 });
+ return global.screen.get_monitor_index_for_rect(rect);
+ },
+
_getPrimaryView: function() {
if (!this._workspacesViews.length)
return null;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]