input: Simplify surface_under / lift element_under

This commit is contained in:
Victoria Brekenfeld 2023-12-20 20:24:13 +00:00 committed by Victoria Brekenfeld
parent 5681447508
commit 775e0ccbdc
2 changed files with 31 additions and 67 deletions

View file

@ -1741,6 +1741,21 @@ impl Shell {
}
}
pub fn element_under(
&mut self,
location: Point<f64, Global>,
output: &Output,
) -> Option<(PointerFocusTarget, Point<i32, Global>)> {
let overview = self.overview_mode.clone();
self.workspaces.sets.get_mut(output).and_then(|set| {
set.sticky_layer
.space
.element_under(location.to_local(output).as_logical())
.map(|(mapped, p)| (mapped.clone().into(), p.as_local().to_global(output)))
.or_else(|| set.workspaces[set.active].element_under(location, overview))
})
}
pub fn move_window(
state: &mut State,
seat: Option<&Seat<State>>,