xwayland: Don't allow spurious map_requests to map windows twice
This commit is contained in:
parent
83ed79af16
commit
5f97691ce5
2 changed files with 32 additions and 2 deletions
|
|
@ -1961,6 +1961,33 @@ impl Shell {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn is_surface_mapped<S>(&self, surface: &S) -> bool
|
||||||
|
where
|
||||||
|
CosmicSurface: PartialEq<S>,
|
||||||
|
{
|
||||||
|
self.workspaces.sets.values().any(|set| {
|
||||||
|
set.minimized_windows
|
||||||
|
.iter()
|
||||||
|
.any(|w| w.windows().any(|s| &s == surface))
|
||||||
|
|| set
|
||||||
|
.sticky_layer
|
||||||
|
.mapped()
|
||||||
|
.any(|m| m.windows().any(|(s, _)| &s == surface))
|
||||||
|
|| set.workspaces.iter().any(|w| {
|
||||||
|
w.get_fullscreen().is_some_and(|s| s == surface)
|
||||||
|
|| w.minimized_windows
|
||||||
|
.iter()
|
||||||
|
.any(|m| m.windows().any(|s| &s == surface))
|
||||||
|
|| w.floating_layer
|
||||||
|
.mapped()
|
||||||
|
.any(|m| m.windows().any(|(s, _)| &s == surface))
|
||||||
|
|| w.tiling_layer
|
||||||
|
.mapped()
|
||||||
|
.any(|(m, _)| m.windows().any(|(s, _)| &s == surface))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
pub fn space_for(&self, mapped: &CosmicMapped) -> Option<&Workspace> {
|
pub fn space_for(&self, mapped: &CosmicMapped) -> Option<&Workspace> {
|
||||||
self.workspaces.spaces().find(|workspace| {
|
self.workspaces.spaces().find(|workspace| {
|
||||||
workspace.mapped().any(|m| m == mapped)
|
workspace.mapped().any(|m| m == mapped)
|
||||||
|
|
|
||||||
|
|
@ -734,8 +734,11 @@ impl XwmHandler for State {
|
||||||
|
|
||||||
let mut shell = self.common.shell.write();
|
let mut shell = self.common.shell.write();
|
||||||
let startup_id = window.startup_id();
|
let startup_id = window.startup_id();
|
||||||
// TODO: Not correct for fullscreen (and minimized?)
|
if shell.is_surface_mapped(&window) {
|
||||||
if shell.element_for_surface(&window).is_some() {
|
warn!(
|
||||||
|
?window,
|
||||||
|
"Got map_request for already mapped window? Ignoring"
|
||||||
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue