Move restacking handling from WorkspacesView to WorkspacesDisplay
Moving the base tracking of restacking to WorkspacesDisplay will allow us to use it to update stacking in the workspace thumbnails as well as in the main workspaces. https://bugzilla.gnome.org/show_bug.cgi?id=640996
This commit is contained in:
parent
cde3ce2e27
commit
277cff3013
@ -77,7 +77,6 @@ WorkspacesView.prototype = {
|
|||||||
this._overviewShowingId =
|
this._overviewShowingId =
|
||||||
Main.overview.connect('showing',
|
Main.overview.connect('showing',
|
||||||
Lang.bind(this, function() {
|
Lang.bind(this, function() {
|
||||||
this._onRestacked();
|
|
||||||
for (let w = 0; w < this._workspaces.length; w++)
|
for (let w = 0; w < this._workspaces.length; w++)
|
||||||
this._workspaces[w].zoomToOverview();
|
this._workspaces[w].zoomToOverview();
|
||||||
}));
|
}));
|
||||||
@ -99,9 +98,6 @@ WorkspacesView.prototype = {
|
|||||||
this._switchWorkspaceNotifyId =
|
this._switchWorkspaceNotifyId =
|
||||||
global.window_manager.connect('switch-workspace',
|
global.window_manager.connect('switch-workspace',
|
||||||
Lang.bind(this, this._activeWorkspaceChanged));
|
Lang.bind(this, this._activeWorkspaceChanged));
|
||||||
this._restackedNotifyId =
|
|
||||||
global.screen.connect('restacked',
|
|
||||||
Lang.bind(this, this._onRestacked));
|
|
||||||
|
|
||||||
this._itemDragBeginId = Main.overview.connect('item-drag-begin',
|
this._itemDragBeginId = Main.overview.connect('item-drag-begin',
|
||||||
Lang.bind(this, this._dragBegin));
|
Lang.bind(this, this._dragBegin));
|
||||||
@ -207,15 +203,7 @@ WorkspacesView.prototype = {
|
|||||||
return this._workspaces[0].scale;
|
return this._workspaces[0].scale;
|
||||||
},
|
},
|
||||||
|
|
||||||
_onRestacked: function() {
|
syncStacking: function(stackIndices) {
|
||||||
let stack = global.get_window_actors();
|
|
||||||
let stackIndices = {};
|
|
||||||
|
|
||||||
for (let i = 0; i < stack.length; i++) {
|
|
||||||
// Use the stable sequence for an integer to use as a hash key
|
|
||||||
stackIndices[stack[i].get_meta_window().get_stable_sequence()] = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (let i = 0; i < this._workspaces.length; i++)
|
for (let i = 0; i < this._workspaces.length; i++)
|
||||||
this._workspaces[i].syncStacking(stackIndices);
|
this._workspaces[i].syncStacking(stackIndices);
|
||||||
},
|
},
|
||||||
@ -502,7 +490,6 @@ WorkspacesView.prototype = {
|
|||||||
this._scrollAdjustment.run_dispose();
|
this._scrollAdjustment.run_dispose();
|
||||||
Main.overview.disconnect(this._overviewShowingId);
|
Main.overview.disconnect(this._overviewShowingId);
|
||||||
global.window_manager.disconnect(this._switchWorkspaceNotifyId);
|
global.window_manager.disconnect(this._switchWorkspaceNotifyId);
|
||||||
global.screen.disconnect(this._restackedNotifyId);
|
|
||||||
|
|
||||||
if (this._timeoutId) {
|
if (this._timeoutId) {
|
||||||
Mainloop.source_remove(this._timeoutId);
|
Mainloop.source_remove(this._timeoutId);
|
||||||
@ -892,6 +879,12 @@ WorkspacesDisplay.prototype = {
|
|||||||
this._nWorkspacesNotifyId =
|
this._nWorkspacesNotifyId =
|
||||||
global.screen.connect('notify::n-workspaces',
|
global.screen.connect('notify::n-workspaces',
|
||||||
Lang.bind(this, this._workspacesChanged));
|
Lang.bind(this, this._workspacesChanged));
|
||||||
|
|
||||||
|
this._restackedNotifyId =
|
||||||
|
global.screen.connect('restacked',
|
||||||
|
Lang.bind(this, this._onRestacked));
|
||||||
|
|
||||||
|
this._onRestacked();
|
||||||
},
|
},
|
||||||
|
|
||||||
hide: function() {
|
hide: function() {
|
||||||
@ -899,6 +892,12 @@ WorkspacesDisplay.prototype = {
|
|||||||
|
|
||||||
if (this._nWorkspacesNotifyId > 0)
|
if (this._nWorkspacesNotifyId > 0)
|
||||||
global.screen.disconnect(this._nWorkspacesNotifyId);
|
global.screen.disconnect(this._nWorkspacesNotifyId);
|
||||||
|
|
||||||
|
if (this._restackedNotifyId > 0){
|
||||||
|
global.screen.disconnect(this._restackedNotifyId);
|
||||||
|
this._restackedNotifyId = 0;
|
||||||
|
}
|
||||||
|
|
||||||
this.workspacesView.destroy();
|
this.workspacesView.destroy();
|
||||||
this.workspacesView = null;
|
this.workspacesView = null;
|
||||||
for (let w = 0; w < this._workspaces.length; w++) {
|
for (let w = 0; w < this._workspaces.length; w++) {
|
||||||
@ -907,6 +906,20 @@ WorkspacesDisplay.prototype = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_onRestacked: function() {
|
||||||
|
let stack = global.get_window_actors();
|
||||||
|
let stackIndices = {};
|
||||||
|
|
||||||
|
for (let i = 0; i < stack.length; i++) {
|
||||||
|
// Use the stable sequence for an integer to use as a hash key
|
||||||
|
stackIndices[stack[i].get_meta_window().get_stable_sequence()] = i;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.workspacesView.syncStacking(stackIndices);
|
||||||
|
for (let i = 0; i < this._workspaceThumbnails.length; i++)
|
||||||
|
this._workspaceThumbnails[i].syncStacking(stackIndices);
|
||||||
|
},
|
||||||
|
|
||||||
_workspacesChanged: function() {
|
_workspacesChanged: function() {
|
||||||
let oldNumWorkspaces = this._workspaces.length;
|
let oldNumWorkspaces = this._workspaces.length;
|
||||||
let newNumWorkspaces = global.screen.n_workspaces;
|
let newNumWorkspaces = global.screen.n_workspaces;
|
||||||
|
Loading…
Reference in New Issue
Block a user