diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2025-09-19 12:11:39 +0300 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2025-09-19 15:48:07 +0300 |
| commit | 86edeb3b0b3d1a08d4d4f59705cbc99a732f5e95 (patch) | |
| tree | fe2590a4854b37f7ff27ca48138e5b7d5af77eda /src/handlers | |
| parent | d9648e6bde1d2fc4a568dec93ba65c11073192a3 (diff) | |
| download | niri-86edeb3b0b3d1a08d4d4f59705cbc99a732f5e95.tar.gz niri-86edeb3b0b3d1a08d4d4f59705cbc99a732f5e95.tar.bz2 niri-86edeb3b0b3d1a08d4d4f59705cbc99a732f5e95.zip | |
Fix DnD icon offset from surface cursor
The offset is already relative to the hotspot, no need to offset twice.
Diffstat (limited to 'src/handlers')
| -rw-r--r-- | src/handlers/mod.rs | 25 |
1 files changed, 5 insertions, 20 deletions
diff --git a/src/handlers/mod.rs b/src/handlers/mod.rs index 8518f8f9..8a025a7f 100644 --- a/src/handlers/mod.rs +++ b/src/handlers/mod.rs @@ -13,9 +13,7 @@ use smithay::backend::allocator::dmabuf::Dmabuf; use smithay::backend::drm::DrmNode; use smithay::backend::input::{InputEvent, TabletToolDescriptor}; use smithay::desktop::{PopupKind, PopupManager}; -use smithay::input::pointer::{ - CursorIcon, CursorImageStatus, CursorImageSurfaceData, PointerHandle, -}; +use smithay::input::pointer::{CursorIcon, CursorImageStatus, PointerHandle}; use smithay::input::{keyboard, Seat, SeatHandler, SeatState}; use smithay::output::Output; use smithay::reexports::rustix::fs::{fcntl_setfl, OFlags}; @@ -323,23 +321,10 @@ impl ClientDndGrabHandler for State { icon: Option<WlSurface>, _seat: Seat<Self>, ) { - let offset = if let CursorImageStatus::Surface(ref surface) = - self.niri.cursor_manager.cursor_image() - { - with_states(surface, |states| { - let hotspot = states - .data_map - .get::<CursorImageSurfaceData>() - .unwrap() - .lock() - .unwrap() - .hotspot; - Point::from((-hotspot.x, -hotspot.y)) - }) - } else { - (0, 0).into() - }; - self.niri.dnd_icon = icon.map(|surface| DndIcon { surface, offset }); + self.niri.dnd_icon = icon.map(|surface| DndIcon { + surface, + offset: Point::new(0, 0), + }); // FIXME: more granular self.niri.queue_redraw_all(); } |
