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

View file

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