-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Drag source icon not centered on mouse cursor during DnD (possibly wayland surface offsets unsupported?) #9564
Comments
can you send a video, this is probably fixed in -git; mind trying that as well? |
Kooha-2025-03-08-20-35-10.mp4I'll try to make time to install/test against -git. |
that looks normal to me, what does it normally look like? |
The icon should be under the mouse cursor, not shifted down and to the right. Maybe this shows it a little more clearly: Kooha-2025-03-08-21-09-07.mp4In the above I have a dock on the right of the screen, and the dragged icon appears mostly off-screen because the offset is not respected. When setting the icon for a dragsource in GTK, you specify coordinates for the image to be shifted by, relative to the mouse hotspot. GTK implements this under wayland by sending an offset request with a negative offset on the wayland surface for the icon (you can see the offset request being sent in the wayland debug output above, and wayland docs suggest this is correct), however this doesn't appear to have any effect under Hyprland - the icon always appears as if it's rendered at 0,0 offset, and the wl_surface.offset request appears to be ignored. |
i'm not sure to be honest, i dont really use a file manager / dnd try going back a couple releases to see if it still happens, this probably has always been like this |
Yes, quite possible it's always been like this. Looks like this likely affects all drag source icons - QT also appears to issue an offset request for the icon. No different on -git. |
yes, we always render the item to the bottom right of the cursor, no matter what. Does the spec mandate something? |
The documentation for wl_data_device::wl_drag_start says:
So with Hyprland rendering at the bottom-right, there are two issues:
|
personal opinion: I like it the way it is. |
One of the problems with the current implementation (besides just not operating as expected/documented in the protocol) is that near right or bottom screen edges (e.g. when iteracting with panels/docks) the icon gets pushed off-screen, with no way for the application to do anything about it. |
meh, what is it like on kde? can you send a vid? |
we could just dynamically adjust the icon so it never goes out of bounds |
Do you mean with a QT application, or under the kwin compositor? For the former, the icon is rendered exactly the same as for GTK under Hyprland, though QT also sends an offset request when the application specifies one. For the latter, I don't have a KDE install currently, but I assume they implement the spec correctly, based on their own apps (e.g. Dolphin) sending an offset req.
Wouldn't that be more complicated than just doing what the protocol says - render at hotspot initially, and then honor offset requests (if any)? I can also imagine a scenario where an application author expects the drag icon to be displayed at the requested location for e.g. slotting an image into a hole on a surface visually. |
meh, under 15 loc change probs |
check this out |
But like... why not just do the correct thing? |
i dont know, i ahven't read like 99% of this issue to be honest, i would like to see a video of how kde does dnd that would make me not have to read all the mountain of words. my brain is a bit smol |
I'm not sure this can be implemented correctly without some words being involved, but in as few words as possible the protocol docs say:
|
I don't have KDE installed atm, but under GNOME this is what it looks like: nautilus.mp4dolphin.mp4I also tested under Weston and it produces the same positiong, as both compositors both follow the protocol docs and apply the offset requested by the application(s). |
okay, ill check it out : ) and see what i can do |
Already reported ? *
Regression?
Probably not a regression / I don't remember it happening before
System Info and Hyprland Version
System/Version info
Description
When dragging a DnD item in a GTK4 application, the surface representing the dragged item is displaced right and down from the mouse cursor position (potentially off-screen near screen edges).
How to reproduce
Attach not paste
Checklist of files to include below
hyprctl systeminfo -c
(always include)Additional info & File uploads
hyprland_config_dump.txt
WAYLAND_DEBUG.txt
The above WAYLAND_DEBUG output snippet is from a toy app I put together to reproduce -
wl_surface#48
is the dragsource, and it can be seen in the output that GTK requestswl_surface#48.offset(-43, -564)
but this doesn't seem to be honored under Hyprland.The text was updated successfully, but these errors were encountered: