menu: Allow toggling sticky state

This commit is contained in:
Victoria Brekenfeld 2023-12-20 20:19:42 +00:00 committed by Victoria Brekenfeld
parent e0d207fbe1
commit d2e394b957
7 changed files with 187 additions and 24 deletions

View file

@ -692,12 +692,27 @@ impl Program for CosmicStackInternal {
if let Some(mapped) =
state.common.shell.element_for_wl_surface(&surface).cloned()
{
if let Some(workspace) = state.common.shell.space_for_mut(&mapped) {
let position = workspace
let position = if let Some((output, set)) =
state.common.shell.workspaces.sets.iter().find(|(_, set)| {
set.sticky_layer.mapped().any(|m| m == &mapped)
}) {
set.sticky_layer
.element_geometry(&mapped)
.unwrap()
.loc
.to_global(&workspace.output);
.to_global(output)
} else if let Some(workspace) =
state.common.shell.space_for_mut(&mapped)
{
workspace
.element_geometry(&mapped)
.unwrap()
.loc
.to_global(&workspace.output)
} else {
return;
};
let mut cursor = seat
.get_pointer()
.unwrap()
@ -712,7 +727,6 @@ impl Program for CosmicStackInternal {
cursor - position.as_logical(),
true,
);
}
}
});
}