image-copy: Fix cursor pos for toplevels with SSD

This commit is contained in:
Ian Douglas Scott 2026-05-28 13:11:14 -07:00 committed by Ian Douglas Scott
parent 8aea6cc158
commit 7a50625e78

View file

@ -241,12 +241,17 @@ impl PointerFocusTarget {
return;
}
let cursor_pos = Some(
event
.location
.to_buffer(1.0, Transform::Normal, &toplevel.geometry().size.to_f64())
.to_i32_round(),
);
let cursor_pos = if let Some(_wl_surface) = self.wl_surface() {
Some(
event
.location
.to_buffer(1.0, Transform::Normal, &toplevel.geometry().size.to_f64())
.to_i32_round(),
)
} else {
// If cursor is in SSD, instead of a `wl_surface`, it is outside the captured bounds
None
};
let cursor_hotspot = if let Some((_, hotspot)) =
seat.cursor_geometry((0.0, 0.0), Duration::from_millis(event.time as u64).into())