mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
Fix DnD icon offset from surface cursor
The offset is already relative to the hotspot, no need to offset twice.
This commit is contained in:
+5
-20
@@ -13,9 +13,7 @@ use smithay::backend::allocator::dmabuf::Dmabuf;
|
|||||||
use smithay::backend::drm::DrmNode;
|
use smithay::backend::drm::DrmNode;
|
||||||
use smithay::backend::input::{InputEvent, TabletToolDescriptor};
|
use smithay::backend::input::{InputEvent, TabletToolDescriptor};
|
||||||
use smithay::desktop::{PopupKind, PopupManager};
|
use smithay::desktop::{PopupKind, PopupManager};
|
||||||
use smithay::input::pointer::{
|
use smithay::input::pointer::{CursorIcon, CursorImageStatus, PointerHandle};
|
||||||
CursorIcon, CursorImageStatus, CursorImageSurfaceData, PointerHandle,
|
|
||||||
};
|
|
||||||
use smithay::input::{keyboard, Seat, SeatHandler, SeatState};
|
use smithay::input::{keyboard, Seat, SeatHandler, SeatState};
|
||||||
use smithay::output::Output;
|
use smithay::output::Output;
|
||||||
use smithay::reexports::rustix::fs::{fcntl_setfl, OFlags};
|
use smithay::reexports::rustix::fs::{fcntl_setfl, OFlags};
|
||||||
@@ -323,23 +321,10 @@ impl ClientDndGrabHandler for State {
|
|||||||
icon: Option<WlSurface>,
|
icon: Option<WlSurface>,
|
||||||
_seat: Seat<Self>,
|
_seat: Seat<Self>,
|
||||||
) {
|
) {
|
||||||
let offset = if let CursorImageStatus::Surface(ref surface) =
|
self.niri.dnd_icon = icon.map(|surface| DndIcon {
|
||||||
self.niri.cursor_manager.cursor_image()
|
surface,
|
||||||
{
|
offset: Point::new(0, 0),
|
||||||
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 });
|
|
||||||
// FIXME: more granular
|
// FIXME: more granular
|
||||||
self.niri.queue_redraw_all();
|
self.niri.queue_redraw_all();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user