diff --git a/src/shell/mod.rs b/src/shell/mod.rs index 4685fc14..17fc79ca 100644 --- a/src/shell/mod.rs +++ b/src/shell/mod.rs @@ -1051,6 +1051,7 @@ impl Shell { let (window, seat) = state.common.shell.pending_windows.remove(pos); let workspace = state.common.shell.workspaces.active_mut(output); + workspace.set_fullscreen(None, output); state.common.shell.toplevel_info_state.new_toplevel(&window); state .common diff --git a/src/shell/workspace.rs b/src/shell/workspace.rs index 11ee61c7..3945b3d7 100644 --- a/src/shell/workspace.rs +++ b/src/shell/workspace.rs @@ -236,17 +236,30 @@ impl Workspace { self.set_fullscreen(window, output) } - fn set_fullscreen(&mut self, window: &CosmicSurface, output: &Output) { - if let Some(mapped) = self - .mapped() - .find(|m| m.windows().any(|(w, _)| &w == window)) - { - mapped.set_active(window); - } + pub(super) fn set_fullscreen<'a>( + &mut self, + window: impl Into>, + output: &Output, + ) { + match window.into() { + Some(window) => { + if let Some(mapped) = self + .mapped() + .find(|m| m.windows().any(|(w, _)| &w == window)) + { + mapped.set_active(window); + } - window.set_geometry(output.geometry()); - window.send_configure(); - self.fullscreen.insert(output.clone(), window.clone()); + window.set_geometry(output.geometry()); + window.send_configure(); + self.fullscreen.insert(output.clone(), window.clone()); + } + None => { + if let Some(surface) = self.fullscreen.get(output).cloned() { + self.unfullscreen_request(&surface); + } + } + } } pub fn unfullscreen_request(&mut self, window: &CosmicSurface) {