diff --git a/src/shell/mod.rs b/src/shell/mod.rs index 5332b503..431cb7e5 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -530,13 +530,14 @@ impl Shell { .refresh(Some(&self.workspace_state)); } - pub fn map_window(&mut self, window: &Window, output: &Output) { + pub fn map_window(&mut self, window: &Window, output: &Output, dh: &DisplayHandle) { let pos = self .pending_windows .iter() .position(|(w, _)| w == window) .unwrap(); let (window, seat) = self.pending_windows.remove(pos); + let surface = window.toplevel().wl_surface().clone(); let workspace = match &self.workspace_mode { WorkspaceMode::OutputBound => { @@ -555,12 +556,12 @@ impl Shell { .remove_workspace_state(&workspace.handle, WState::Hidden); self.toplevel_info_state .toplevel_enter_workspace(&window, &workspace.handle); - let focus_stack = workspace.focus_stack(&seat); if layout::should_be_floating(&window) { workspace .floating_layer .map_window(&mut workspace.space, window, &seat); } else { + let focus_stack = workspace.focus_stack(&seat); workspace.tiling_layer.map_window( &mut workspace.space, window, @@ -569,6 +570,8 @@ impl Shell { ); } + self.set_focus(dh, Some(&surface), &seat, None); + for window in self.active_space(output).space.windows() { self.update_reactive_popups(window); } diff --git a/src/wayland/handlers/compositor.rs b/src/wayland/handlers/compositor.rs index dc89cf61..a0570014 100644 --- a/src/wayland/handlers/compositor.rs +++ b/src/wayland/handlers/compositor.rs @@ -120,7 +120,7 @@ impl CompositorHandler for State { Kind::Xdg(toplevel) => { if self.toplevel_ensure_initial_configure(&toplevel) { let output = active_output(&seat, &self.common); - self.common.shell.map_window(&window, &output); + self.common.shell.map_window(&window, &output, dh); } else { return; }