diff --git a/js/ui/windowManager.js b/js/ui/windowManager.js index e9d2be390..2c83b0091 100644 --- a/js/ui/windowManager.js +++ b/js/ui/windowManager.js @@ -1851,8 +1851,10 @@ export class WindowManager { if (!Main.sessionMode.hasWorkspaces) return; - if (!workspace.active) + if (!workspace.active) { workspace.activate(global.get_current_time()); + global.stage.set_key_focus(null); + } } actionMoveWindow(window, workspace) { diff --git a/js/ui/workspace.js b/js/ui/workspace.js index 09fe3abdb..dd2265e82 100644 --- a/js/ui/workspace.js +++ b/js/ui/workspace.js @@ -1029,6 +1029,13 @@ class WorkspaceBackground extends Shell.WorkspaceBackground { } }); +const WorkspaceWindowContainer = GObject.registerClass( +class WorkspaceWindowContainer extends St.Widget { + vfunc_get_focus_chain() { + return this.layout_manager.getFocusChain(); + } +}); + export const Workspace = GObject.registerClass( class Workspace extends St.Widget { /** @@ -1052,13 +1059,9 @@ class Workspace extends St.Widget { this.add_child(this._background); // Window previews - this._container = new Clutter.Actor({ - reactive: true, - x_expand: true, - y_expand: true, - }); - this._container.layout_manager = layoutManager; + this._container = new WorkspaceWindowContainer({layoutManager}); this.add_child(this._container); + global.focus_manager.add_group(this._container); this.metaWorkspace = metaWorkspace; @@ -1118,8 +1121,8 @@ class Workspace extends St.Widget { return overviewState > OverviewControls.ControlsState.WINDOW_PICKER; } - vfunc_get_focus_chain() { - return this._container.layout_manager.getFocusChain(); + vfunc_navigate_focus(from, direction) { + return this._container.navigate_focus(from, direction, false); } _lookupIndex(metaWindow) { diff --git a/js/ui/workspacesView.js b/js/ui/workspacesView.js index 0e962aa4a..ca2b9a3ef 100644 --- a/js/ui/workspacesView.js +++ b/js/ui/workspacesView.js @@ -38,7 +38,6 @@ const WorkspacesViewBase = GObject.registerClass({ y_expand: true, }); this.connect('destroy', this._onDestroy.bind(this)); - global.focus_manager.add_group(this); this._monitorIndex = monitorIndex; @@ -395,6 +394,10 @@ class WorkspacesView extends WorkspacesViewBase { return this._workspaces[active]; } + vfunc_navigate_focus(from, direction) { + return this.getActiveWorkspace().navigate_focus(from, direction, false); + } + prepareToLeaveOverview() { for (let w = 0; w < this._workspaces.length; w++) this._workspaces[w].prepareToLeaveOverview();