shell: Clear fullscreen on new window

This commit is contained in:
Victoria Brekenfeld 2023-02-13 20:28:07 +01:00
parent 386501f980
commit 45bd385d9c
2 changed files with 24 additions and 10 deletions

View file

@ -1051,6 +1051,7 @@ impl Shell {
let (window, seat) = state.common.shell.pending_windows.remove(pos); let (window, seat) = state.common.shell.pending_windows.remove(pos);
let workspace = state.common.shell.workspaces.active_mut(output); 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.shell.toplevel_info_state.new_toplevel(&window);
state state
.common .common

View file

@ -236,17 +236,30 @@ impl Workspace {
self.set_fullscreen(window, output) self.set_fullscreen(window, output)
} }
fn set_fullscreen(&mut self, window: &CosmicSurface, output: &Output) { pub(super) fn set_fullscreen<'a>(
if let Some(mapped) = self &mut self,
.mapped() window: impl Into<Option<&'a CosmicSurface>>,
.find(|m| m.windows().any(|(w, _)| &w == window)) output: &Output,
{ ) {
mapped.set_active(window); 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.set_geometry(output.geometry());
window.send_configure(); window.send_configure();
self.fullscreen.insert(output.clone(), window.clone()); 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) { pub fn unfullscreen_request(&mut self, window: &CosmicSurface) {