xwm: Fix edge-cases for fullscreening

This commit is contained in:
Victoria Brekenfeld 2024-07-08 20:33:25 +02:00 committed by Victoria Brekenfeld
parent 66d1016003
commit 3eb3e3b1c0
2 changed files with 27 additions and 28 deletions

View file

@ -788,7 +788,7 @@ impl Workspace {
self.fullscreen
.as_ref()
.filter(|f| f.alive())
.filter(|f| f.ended_at.is_none() && f.start_at.is_none())
.filter(|f| f.ended_at.is_none())
.map(|f| &f.surface)
}
@ -800,11 +800,9 @@ impl Workspace {
amount: i32,
) -> bool {
if let Some(toplevel) = focused.toplevel() {
if self
.fullscreen
.as_ref()
.is_some_and(|f| f.surface.wl_surface().as_deref() == Some(&toplevel))
{
if self.fullscreen.as_ref().is_some_and(|f| {
f.ended_at.is_none() && f.surface.wl_surface().as_deref() == Some(&toplevel)
}) {
return false;
}
}
@ -934,7 +932,7 @@ impl Workspace {
pub fn is_fullscreen(&self, mapped: &CosmicMapped) -> bool {
self.fullscreen
.as_ref()
.is_some_and(|f| f.surface == mapped.active_window())
.is_some_and(|f| f.ended_at.is_none() && f.surface == mapped.active_window())
|| self
.minimized_windows
.iter()

View file

@ -213,20 +213,20 @@ impl Common {
.map(|m| &m.window),
)
.flat_map(|mapped| {
let active = mapped.active_window();
std::iter::once(active.clone()).chain(
mapped
.is_stack()
.then(move || {
mapped
.windows()
.map(|(s, _)| s)
.filter(move |s| s != &active)
})
.into_iter()
.flatten(),
)
}),
let active = mapped.active_window();
std::iter::once(active.clone()).chain(
mapped
.is_stack()
.then(move || {
mapped
.windows()
.map(|(s, _)| s)
.filter(move |s| s != &active)
})
.into_iter()
.flatten(),
)
}),
)
}),
)
@ -376,14 +376,15 @@ impl XwmHandler for State {
// We only allow floating X11 windows to resize themselves. Nothing else
let shell = self.common.shell.read().unwrap();
if let Some(mapped) = shell.element_for_surface(&window) {
if let Some(mapped) = shell
.element_for_surface(&window)
.filter(|mapped| !mapped.is_minimized())
{
let current_geo = if let Some(workspace) = shell.space_for(mapped) {
workspace.is_floating(mapped).then_some(
workspace
.element_geometry(mapped)
.unwrap()
.to_global(workspace.output()),
)
workspace
.element_geometry(mapped)
.filter(|_| workspace.is_floating(mapped))
.map(|geo| geo.to_global(workspace.output()))
} else if let Some((output, set)) = shell
.workspaces
.sets