image-copy: Adjust toplevel capture coordinate for window geometry
This commit is contained in:
parent
7a50625e78
commit
7d0d374fd8
1 changed files with 16 additions and 4 deletions
|
|
@ -37,7 +37,10 @@ use smithay::{
|
||||||
Client, DisplayHandle, Resource, backend::ObjectId, protocol::wl_surface::WlSurface,
|
Client, DisplayHandle, Resource, backend::ObjectId, protocol::wl_surface::WlSurface,
|
||||||
},
|
},
|
||||||
utils::{IsAlive, Logical, Point, Serial, Transform},
|
utils::{IsAlive, Logical, Point, Serial, Transform},
|
||||||
wayland::{seat::WaylandFocus, selection::data_device::WlOfferData, session_lock::LockSurface},
|
wayland::{
|
||||||
|
compositor::with_states, seat::WaylandFocus, selection::data_device::WlOfferData,
|
||||||
|
session_lock::LockSurface, shell::xdg::SurfaceCachedState,
|
||||||
|
},
|
||||||
xwayland::{
|
xwayland::{
|
||||||
X11Surface,
|
X11Surface,
|
||||||
xwm::{XwmId, XwmOfferData},
|
xwm::{XwmId, XwmOfferData},
|
||||||
|
|
@ -241,10 +244,19 @@ impl PointerFocusTarget {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let cursor_pos = if let Some(_wl_surface) = self.wl_surface() {
|
let cursor_pos = if let Some(wl_surface) = self.wl_surface() {
|
||||||
|
let geometry_loc = with_states(&wl_surface, |states| {
|
||||||
|
states
|
||||||
|
.cached_state
|
||||||
|
.get::<SurfaceCachedState>()
|
||||||
|
.current()
|
||||||
|
.geometry
|
||||||
|
.map(|g| g.loc.to_f64())
|
||||||
|
})
|
||||||
|
.unwrap_or_default();
|
||||||
|
|
||||||
Some(
|
Some(
|
||||||
event
|
(event.location - geometry_loc)
|
||||||
.location
|
|
||||||
.to_buffer(1.0, Transform::Normal, &toplevel.geometry().size.to_f64())
|
.to_buffer(1.0, Transform::Normal, &toplevel.geometry().size.to_f64())
|
||||||
.to_i32_round(),
|
.to_i32_round(),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue