shell: Focus new windows

This commit is contained in:
Victoria Brekenfeld 2022-07-06 23:35:17 +02:00
parent ae33728a4e
commit 65046f1265
2 changed files with 6 additions and 3 deletions

View file

@ -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);
}

View file

@ -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;
}