xdg-popup: Unconstrain sticky window popups as well

This commit is contained in:
Victoria Brekenfeld 2023-12-20 20:42:07 +00:00 • committed by Victoria Brekenfeld
parent e67e139e15
commit d0136194f4

View file

@ -30,11 +30,34 @@ impl Shell {
pub fn unconstrain_popup(&self, surface: &PopupSurface) { pub fn unconstrain_popup(&self, surface: &PopupSurface) {
if let Some(parent) = get_popup_toplevel(&surface) { if let Some(parent) = get_popup_toplevel(&surface) {
if let Some(elem) = self.element_for_wl_surface(&parent) { if let Some(elem) = self.element_for_wl_surface(&parent) {
let workspace = self.space_for(elem).unwrap(); let (mut element_geo, output, is_tiled) =
let mut element_geo = workspace if let Some(workspace) = self.space_for(elem) {
.element_geometry(elem) (
.unwrap() workspace
.to_global(workspace.output()); .element_geometry(elem)
.unwrap()
.to_global(workspace.output()),
workspace.output.clone(),
workspace.is_tiled(elem),
)
} else if let Some((output, set)) = self
.workspaces
.sets
.iter()
.find(|(_, set)| set.sticky_layer.mapped().any(|m| m == elem))
{
(
set.sticky_layer
.element_geometry(elem)
.unwrap()
.to_global(output),
output.clone(),
false,
)
} else {
return;
};
let (window, offset) = elem let (window, offset) = elem
.windows() .windows()
.find(|(w, _)| w.wl_surface().as_ref() == Some(&parent)) .find(|(w, _)| w.wl_surface().as_ref() == Some(&parent))
@ -42,13 +65,13 @@ impl Shell {
let window_geo_offset = window.geometry().loc; let window_geo_offset = window.geometry().loc;
let window_loc: Point<i32, Global> = let window_loc: Point<i32, Global> =
element_geo.loc + offset.as_global() + window_geo_offset.as_global(); element_geo.loc + offset.as_global() + window_geo_offset.as_global();
if workspace.is_tiled(elem) { if is_tiled {
element_geo.loc = (0, 0).into(); element_geo.loc = (0, 0).into();
if !unconstrain_xdg_popup_tile(surface, element_geo.as_logical()) { if !unconstrain_xdg_popup_tile(surface, element_geo.as_logical()) {
unconstrain_xdg_popup(surface, window_loc, workspace.output().geometry()); unconstrain_xdg_popup(surface, window_loc, output.geometry());
} }
} else { } else {
unconstrain_xdg_popup(surface, window_loc, workspace.output().geometry()); unconstrain_xdg_popup(surface, window_loc, output.geometry());
} }
} else if let Some((output, layer_surface)) = self.outputs().find_map(|o| { } else if let Some((output, layer_surface)) = self.outputs().find_map(|o| {
let map = layer_map_for_output(o); let map = layer_map_for_output(o);