Skip to content

Conversation

@Moulberry
Copy link
Contributor

The DnD should start at the hotspot aka the pointer location. The (0, 0) coordinate already corresponds to the pointer location. By offseting by -hotspot, the dnd is initiated at the top-left of the cursor's surface instead of the hotspot.

You can verify the behaviour is incorrect by running weston-dnd:
Without the patch, when initiating the dnd the element gets offset to the left.
With the patch, the element does not get offset.

(P.S. Even with this patch, there is still a very tiny offset when doing the DnD for me. I believe this is due to conversions between integer and floating point locations using round() instead of floor(). In my experience, floor() produces more correct results than round(). But that's an entirely separate and it might just be my setup.)

@YaLTeR
Copy link
Contributor

YaLTeR commented Sep 19, 2025

Tested the same change in niri, seems to work fine.

Copy link
Member

@Drakulix Drakulix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We had a few overhauls in regards to the hotspot code, so this might just be a left-over artifact. Thanks for cleaning it up!

@Drakulix Drakulix force-pushed the anvil/fix_wrong_dnd_offset branch from c95e3c7 to 543cefc Compare November 14, 2025 12:00
@Drakulix Drakulix merged commit e04af68 into Smithay:master Nov 14, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants