workspacesView: Add API to hide workspaces without destroying

This will be used by the next commit to hide workspaces when ViewSelector
switches to the search page, without destroying the workspaces so their
state is preserved.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/1593>
This commit is contained in:
Georges Basile Stavracas Neto 2020-06-05 02:23:53 -03:00 committed by Marge Bot
parent 78f886f42c
commit a29e002a41

View File

@ -404,6 +404,7 @@ class WorkspacesDisplay extends St.Widget {
this._syncWorkspacesActualGeometry();
});
this._primaryVisible = true;
this._primaryIndex = Main.layoutManager.primaryIndex;
this._workspacesViews = [];
@ -570,6 +571,18 @@ class WorkspacesDisplay extends St.Widget {
return this._getPrimaryView().navigate_focus(from, direction, false);
}
setPrimaryWorkspaceVisible(visible) {
if (this._primaryVisible === visible)
return;
this._primaryVisible = visible;
const primaryIndex = Main.layoutManager.primaryIndex;
const primaryWorkspace = this._workspacesViews[primaryIndex];
if (primaryWorkspace)
primaryWorkspace.visible = visible;
}
animateToOverview(fadeOnPrimary) {
this.show();
this._updateWorkspacesViews();
@ -672,6 +685,8 @@ class WorkspacesDisplay extends St.Widget {
this._workspacesViews.push(view);
Main.layoutManager.overviewGroup.add_actor(view);
}
this._workspacesViews[this._primaryIndex].visible = this._primaryVisible;
}
_getMonitorIndexForEvent(event) {