shell: Make element_for_(wl_)surface consider sticky windows
This commit is contained in:
parent
d503e44ca8
commit
e0d207fbe1
1 changed files with 21 additions and 4 deletions
|
|
@ -1264,15 +1264,32 @@ impl Shell {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn element_for_surface(&self, surface: &CosmicSurface) -> Option<&CosmicMapped> {
|
pub fn element_for_surface(&self, surface: &CosmicSurface) -> Option<&CosmicMapped> {
|
||||||
self.workspaces
|
self.workspaces.sets.values().find_map(|set| {
|
||||||
.spaces()
|
set.sticky_layer
|
||||||
|
.mapped()
|
||||||
|
.find(|w| w.windows().any(|(s, _)| &s == surface))
|
||||||
|
.or_else(|| {
|
||||||
|
set.workspaces
|
||||||
|
.iter()
|
||||||
.find_map(|w| w.element_for_surface(surface))
|
.find_map(|w| w.element_for_surface(surface))
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn element_for_wl_surface(&self, surface: &WlSurface) -> Option<&CosmicMapped> {
|
pub fn element_for_wl_surface(&self, surface: &WlSurface) -> Option<&CosmicMapped> {
|
||||||
self.workspaces
|
self.workspaces.sets.values().find_map(|set| {
|
||||||
.spaces()
|
set.sticky_layer
|
||||||
|
.mapped()
|
||||||
|
.find(|w| {
|
||||||
|
w.windows()
|
||||||
|
.any(|(s, _)| s.wl_surface().as_ref() == Some(surface))
|
||||||
|
})
|
||||||
|
.or_else(|| {
|
||||||
|
set.workspaces
|
||||||
|
.iter()
|
||||||
.find_map(|w| w.element_for_wl_surface(surface))
|
.find_map(|w| w.element_for_wl_surface(surface))
|
||||||
|
})
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn space_for(&self, mapped: &CosmicMapped) -> Option<&Workspace> {
|
pub fn space_for(&self, mapped: &CosmicMapped) -> Option<&Workspace> {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue