Only show windows from the primary monitor on the overview workspace
This means a bunch of windows will not be visible at all in the overview. Those will be added back with per-screen workspaces on the non-primary monitors. https://bugzilla.gnome.org/show_bug.cgi?id=609258
This commit is contained in:
parent
0e6458a630
commit
cdd1209b55
@ -543,12 +543,12 @@ const WindowPositionFlags = {
|
|||||||
/**
|
/**
|
||||||
* @metaWorkspace: a #Meta.Workspace
|
* @metaWorkspace: a #Meta.Workspace
|
||||||
*/
|
*/
|
||||||
function Workspace(metaWorkspace) {
|
function Workspace(metaWorkspace, monitorIndex) {
|
||||||
this._init(metaWorkspace);
|
this._init(metaWorkspace, monitorIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
Workspace.prototype = {
|
Workspace.prototype = {
|
||||||
_init : function(metaWorkspace) {
|
_init : function(metaWorkspace, monitorIndex) {
|
||||||
// When dragging a window, we use this slot for reserve space.
|
// When dragging a window, we use this slot for reserve space.
|
||||||
this._reservedSlot = null;
|
this._reservedSlot = null;
|
||||||
this.metaWorkspace = metaWorkspace;
|
this.metaWorkspace = metaWorkspace;
|
||||||
@ -557,6 +557,8 @@ Workspace.prototype = {
|
|||||||
this._width = 0;
|
this._width = 0;
|
||||||
this._height = 0;
|
this._height = 0;
|
||||||
|
|
||||||
|
this.monitorIndex = monitorIndex;
|
||||||
|
this._monitor = global.get_monitors()[this.monitorIndex];
|
||||||
this._windowOverlaysGroup = new Clutter.Group();
|
this._windowOverlaysGroup = new Clutter.Group();
|
||||||
// Without this the drop area will be overlapped.
|
// Without this the drop area will be overlapped.
|
||||||
this._windowOverlaysGroup.set_size(0, 0);
|
this._windowOverlaysGroup.set_size(0, 0);
|
||||||
@ -572,7 +574,7 @@ Workspace.prototype = {
|
|||||||
|
|
||||||
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
this.actor.connect('destroy', Lang.bind(this, this._onDestroy));
|
||||||
|
|
||||||
let windows = Main.getWindowActorsForWorkspace(this.metaWorkspace.index());
|
let windows = global.get_window_actors().filter(this._isMyWindow, this);
|
||||||
|
|
||||||
// Create clones for windows that should be
|
// Create clones for windows that should be
|
||||||
// visible in the Overview
|
// visible in the Overview
|
||||||
@ -589,6 +591,10 @@ Workspace.prototype = {
|
|||||||
Lang.bind(this, this._windowAdded));
|
Lang.bind(this, this._windowAdded));
|
||||||
this._windowRemovedId = this.metaWorkspace.connect('window-removed',
|
this._windowRemovedId = this.metaWorkspace.connect('window-removed',
|
||||||
Lang.bind(this, this._windowRemoved));
|
Lang.bind(this, this._windowRemoved));
|
||||||
|
this._windowEnteredMonitorId = global.screen.connect('window-entered-monitor',
|
||||||
|
Lang.bind(this, this._windowEnteredMonitor));
|
||||||
|
this._windowLeftMonitorId = global.screen.connect('window-left-monitor',
|
||||||
|
Lang.bind(this, this._windowLeftMonitor));
|
||||||
this._repositionWindowsId = 0;
|
this._repositionWindowsId = 0;
|
||||||
|
|
||||||
this.leavingOverview = false;
|
this.leavingOverview = false;
|
||||||
@ -1036,7 +1042,7 @@ Workspace.prototype = {
|
|||||||
this._windowOverlaysGroup.hide();
|
this._windowOverlaysGroup.hide();
|
||||||
},
|
},
|
||||||
|
|
||||||
_windowRemoved : function(metaWorkspace, metaWin) {
|
_doRemoveWindow : function(metaWin) {
|
||||||
let win = metaWin.get_compositor_private();
|
let win = metaWin.get_compositor_private();
|
||||||
|
|
||||||
// find the position of the window in our list
|
// find the position of the window in our list
|
||||||
@ -1045,6 +1051,10 @@ Workspace.prototype = {
|
|||||||
if (index == -1)
|
if (index == -1)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// Check if window still should be here
|
||||||
|
if (win && this._isMyWindow(win))
|
||||||
|
return;
|
||||||
|
|
||||||
let clone = this._windows[index];
|
let clone = this._windows[index];
|
||||||
|
|
||||||
this._windows.splice(index, 1);
|
this._windows.splice(index, 1);
|
||||||
@ -1088,7 +1098,7 @@ Workspace.prototype = {
|
|||||||
Lang.bind(this, this._delayedWindowRepositioning));
|
Lang.bind(this, this._delayedWindowRepositioning));
|
||||||
},
|
},
|
||||||
|
|
||||||
_windowAdded : function(metaWorkspace, metaWin) {
|
_doAddWindow : function(metaWin) {
|
||||||
if (this.leavingOverview)
|
if (this.leavingOverview)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -1100,13 +1110,18 @@ Workspace.prototype = {
|
|||||||
Mainloop.idle_add(Lang.bind(this,
|
Mainloop.idle_add(Lang.bind(this,
|
||||||
function () {
|
function () {
|
||||||
if (this.actor && metaWin.get_compositor_private())
|
if (this.actor && metaWin.get_compositor_private())
|
||||||
this._windowAdded(metaWorkspace, metaWin);
|
this._doAddWindow(metaWin);
|
||||||
return false;
|
return false;
|
||||||
}));
|
}));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this._isOverviewWindow(win))
|
// We might have the window in our list already if it was on all workspaces and
|
||||||
|
// now was moved to this workspace
|
||||||
|
if (this._lookupIndex (metaWin) != -1)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (!this._isMyWindow(win) || !this._isOverviewWindow(win))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let clone = this._addWindowClone(win);
|
let clone = this._addWindowClone(win);
|
||||||
@ -1131,6 +1146,26 @@ Workspace.prototype = {
|
|||||||
this.positionWindows(WindowPositionFlags.ANIMATE);
|
this.positionWindows(WindowPositionFlags.ANIMATE);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_windowAdded : function(metaWorkspace, metaWin) {
|
||||||
|
this._doAddWindow(metaWin);
|
||||||
|
},
|
||||||
|
|
||||||
|
_windowRemoved : function(metaWorkspace, metaWin) {
|
||||||
|
this._doRemoveWindow(metaWin);
|
||||||
|
},
|
||||||
|
|
||||||
|
_windowEnteredMonitor : function(metaScreen, monitorIndex, metaWin) {
|
||||||
|
if (monitorIndex == this.monitorIndex) {
|
||||||
|
this._doAddWindow(metaWin);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
_windowLeftMonitor : function(metaScreen, monitorIndex, metaWin) {
|
||||||
|
if (monitorIndex == this.monitorIndex) {
|
||||||
|
this._doRemoveWindow(metaWin);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
// check for maximized windows on the workspace
|
// check for maximized windows on the workspace
|
||||||
hasMaximizedWindows: function() {
|
hasMaximizedWindows: function() {
|
||||||
for (let i = 0; i < this._windows.length; i++) {
|
for (let i = 0; i < this._windows.length; i++) {
|
||||||
@ -1213,6 +1248,8 @@ Workspace.prototype = {
|
|||||||
|
|
||||||
this.metaWorkspace.disconnect(this._windowAddedId);
|
this.metaWorkspace.disconnect(this._windowAddedId);
|
||||||
this.metaWorkspace.disconnect(this._windowRemovedId);
|
this.metaWorkspace.disconnect(this._windowRemovedId);
|
||||||
|
global.screen.disconnect(this._windowEnteredMonitorId);
|
||||||
|
global.screen.disconnect(this._windowLeftMonitorId);
|
||||||
|
|
||||||
if (this._repositionWindowsId > 0)
|
if (this._repositionWindowsId > 0)
|
||||||
Mainloop.source_remove(this._repositionWindowsId);
|
Mainloop.source_remove(this._repositionWindowsId);
|
||||||
@ -1231,9 +1268,10 @@ Workspace.prototype = {
|
|||||||
this.leavingOverview = false;
|
this.leavingOverview = false;
|
||||||
},
|
},
|
||||||
|
|
||||||
// Tests if @win belongs to this workspaces
|
// Tests if @win belongs to this workspaces and monitor
|
||||||
_isMyWindow : function (win) {
|
_isMyWindow : function (win) {
|
||||||
return Main.isWindowActorDisplayedOnWorkspace(win, this.metaWorkspace.index());
|
return Main.isWindowActorDisplayedOnWorkspace(win, this.metaWorkspace.index()) &&
|
||||||
|
(!win.get_meta_window() || win.get_meta_window().get_monitor() == this.monitorIndex);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Tests if @win should be shown in the Overview
|
// Tests if @win should be shown in the Overview
|
||||||
|
@ -549,6 +549,8 @@ WorkspacesDisplay.prototype = {
|
|||||||
controls.connect('scroll-event',
|
controls.connect('scroll-event',
|
||||||
Lang.bind(this, this._onScrollEvent));
|
Lang.bind(this, this._onScrollEvent));
|
||||||
|
|
||||||
|
this._monitorIndex = global.get_primary_monitor_index();
|
||||||
|
this._monitor = global.get_monitors()[this._monitorIndex];
|
||||||
|
|
||||||
this._thumbnailsBox = new WorkspaceThumbnail.ThumbnailsBox();
|
this._thumbnailsBox = new WorkspaceThumbnail.ThumbnailsBox();
|
||||||
controls.add_actor(this._thumbnailsBox.actor);
|
controls.add_actor(this._thumbnailsBox.actor);
|
||||||
@ -577,7 +579,7 @@ WorkspacesDisplay.prototype = {
|
|||||||
this._workspaces = [];
|
this._workspaces = [];
|
||||||
for (let i = 0; i < global.screen.n_workspaces; i++) {
|
for (let i = 0; i < global.screen.n_workspaces; i++) {
|
||||||
let metaWorkspace = global.screen.get_workspace_by_index(i);
|
let metaWorkspace = global.screen.get_workspace_by_index(i);
|
||||||
this._workspaces[i] = new Workspace.Workspace(metaWorkspace);
|
this._workspaces[i] = new Workspace.Workspace(metaWorkspace, this._monitorIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.workspacesView)
|
if (this.workspacesView)
|
||||||
@ -763,7 +765,7 @@ WorkspacesDisplay.prototype = {
|
|||||||
// Assume workspaces are only added at the end
|
// Assume workspaces are only added at the end
|
||||||
for (let w = oldNumWorkspaces; w < newNumWorkspaces; w++) {
|
for (let w = oldNumWorkspaces; w < newNumWorkspaces; w++) {
|
||||||
let metaWorkspace = global.screen.get_workspace_by_index(w);
|
let metaWorkspace = global.screen.get_workspace_by_index(w);
|
||||||
this._workspaces[w] = new Workspace.Workspace(metaWorkspace);
|
this._workspaces[w] = new Workspace.Workspace(metaWorkspace, this._monitorIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
this._thumbnailsBox.addThumbnails(oldNumWorkspaces, newNumWorkspaces - oldNumWorkspaces);
|
this._thumbnailsBox.addThumbnails(oldNumWorkspaces, newNumWorkspaces - oldNumWorkspaces);
|
||||||
|
Loading…
Reference in New Issue
Block a user