tiling: Consider window contents outside tile for input

This commit is contained in:
Victoria Brekenfeld 2024-02-28 19:50:03 +01:00 committed by Victoria Brekenfeld
parent a668df27ae
commit 70a0aa8da3

View file

@ -2852,7 +2852,7 @@ impl TilingLayout {
pub fn element_under( pub fn element_under(
&mut self, &mut self,
location: Point<f64, Local>, location_f64: Point<f64, Local>,
overview: OverviewMode, overview: OverviewMode,
) -> Option<(PointerFocusTarget, Point<i32, Local>)> { ) -> Option<(PointerFocusTarget, Point<i32, Local>)> {
let gaps = self.gaps(); let gaps = self.gaps();
@ -2860,7 +2860,7 @@ impl TilingLayout {
let placeholder_id = &self.placeholder_id; let placeholder_id = &self.placeholder_id;
let tree = &self.queue.trees.back().unwrap().0; let tree = &self.queue.trees.back().unwrap().0;
let root = tree.root_node_id()?; let root = tree.root_node_id()?;
let location = location.to_i32_round(); let location = location_f64.to_i32_round();
{ {
let output_geo = let output_geo =
@ -2876,6 +2876,15 @@ impl TilingLayout {
} }
if matches!(overview, OverviewMode::None) { if matches!(overview, OverviewMode::None) {
for (mapped, geo) in self.mapped() {
if !mapped.bbox().contains((location - geo.loc).as_logical()) {
continue;
}
if mapped.is_in_input_region(&(location_f64 - geo.loc.to_f64()).as_logical()) {
return Some((mapped.clone().into(), geo.loc));
}
}
let mut result = None; let mut result = None;
let mut lookup = Some(root.clone()); let mut lookup = Some(root.clone());
while let Some(node) = lookup { while let Some(node) = lookup {