You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is mostly a stub issue to keep track of progress on improvements to the drag/drop API:
Dropping lists of files
Dropping non-file data
Dropping multiple types of data at once (i.e. receiving unformatted text and a formatted, HTML version of that text)
Potential datatypes to support:
Text
HTML
Image
Audio
I did some research into platform-specific clipboard APIs, and as far as I can tell those are the datatypes that we can probably support across all platforms. I'm hesitant to support audio data sine there seems to be way more variance in how platforms support that than the other datatypes, but from what I've seen most platforms expose it in one way or another.
Reacted by runiq, ErnestasSku, stefnotch and LinuxForAll
I think out of all these issues #1550 would be the best starting point, also given that it has the most upvotes.
Essentially this boils down to allowing the cursor position to be read while the mouse is dragging something over the window.
This is completely impossible currently.
Why not just tell how it is sent? 😄 CursorMoved is not getting sent, unless bevy uses some very old version of winit or somehow breaks it.
Do you mean DeviceEvent::MouseMotion?
Ah okay, I think I now get it, Cursor... are WindowEvents, so they're "fixed" to the window. When you drop a file into a window, it is inactive and therefore no cursor events fire, only MouseMotion.
That still means #1550 would be greatly appreciated, but I could hack together my own window-relative coordinates on drag.
Probably something like:
save cursor position in a Vec2
when dragging a file and entering the window, HoveredFile is sent
now start adjusting the saved cursor position based on MouseMotion (and clamp to window size)
when window is left while dragging, HoveredFileCancelled is sent / when dragging stops on window, DroppedFile is sent
now stop adjusting the saved cursor position
Oh wait, this doesn't make sense, as you would have to enter the window with your cursor at the exact position you left it :)
So instead, you would have to save the exact position of the cursor even while outside of the window.
@janus-culsans The cursor position should be broadcasted during the drag and drop. It could be that a particular platform isn't doing so which could indicate a bug. The events are coming not from the drag and drop events, but from Cursor window events, so maybe on a platforms you're testing it's lacking.
@kchibisov I have no knowledge of your internals and no time left, otherwise I would have probably understood your other comments and taken a shot.
I'm sorry, it's just frustrating.
DnD has this weird half-OS half-App-UX problem, which the web standards also could not solve well. Then sometimes you want file DnD, sometimes whiteboardish DnD..
My usecase is also basic drop containers. And I want to show something while hovering over such a container without dropping.
The path stuff will be gone eventually, since it doesn't make much sense in general. It also causes issues on Wayland, because you just get fd most of the time and a bunch of mime types you can pick from, so it'll probably just move to a mimetype + request() on some object.
Activity
maroider commentedon Jul 15, 2021
A couple of relevant issues have cropped up since this issue was created:
janus-culsans commentedon Oct 24, 2022
I think out of all these issues #1550 would be the best starting point, also given that it has the most upvotes.
Essentially this boils down to allowing the cursor position to be read while the mouse is dragging something over the window.
This is completely impossible currently.
kchibisov commentedon Oct 24, 2022
The mouse coordinates are sent during dnd? You clearly know where file is dropped. It's just not attached to the event itself and is sent separately.
janus-culsans commentedon Oct 25, 2022
Why not just tell how it is sent? 😄
CursorMovedis not getting sent, unless bevy uses some very old version of winit or somehow breaks it.Do you mean
DeviceEvent::MouseMotion?Ah okay, I think I now get it,
Cursor...areWindowEvents, so they're "fixed" to the window. When you drop a file into a window, it is inactive and therefore no cursor events fire, onlyMouseMotion.That still means #1550 would be greatly appreciated, but I could hack together my own window-relative coordinates on drag.
Probably something like:
Oh wait, this doesn't make sense, as you would have to enter the window with your cursor at the exact position you left it :)
So instead, you would have to save the exact position of the cursor even while outside of the window.
TLDR; There is no workaround.
kchibisov commentedon Nov 5, 2022
@janus-culsans The cursor position should be broadcasted during the drag and drop. It could be that a particular platform isn't doing so which could indicate a bug. The events are coming not from the drag and drop events, but from
Cursorwindow events, so maybe on a platforms you're testing it's lacking.goolord commentedon Apr 25, 2023
it would be nice to support both drag & drop as a target AND as a source
janus-culsans commentedon Nov 21, 2023
@kchibisov if the unsupported platform is MSWindows, okay?
kchibisov commentedon Nov 21, 2023
@janus-culsans are you planning to implement something mentioned here?
janus-culsans commentedon Nov 21, 2023
@kchibisov I have no knowledge of your internals and no time left, otherwise I would have probably understood your other comments and taken a shot.
I'm sorry, it's just frustrating.
DnD has this weird half-OS half-App-UX problem, which the web standards also could not solve well. Then sometimes you want file DnD, sometimes whiteboardish DnD..
My usecase is also basic drop containers. And I want to show something while hovering over such a container without dropping.
stefnotch commentedon Dec 31, 2025
The wasm backend of winit doesn't seem to support file dropping. While it should be straightforward to hook that up around here
winit/winit-web/src/event_loop/runner.rs
Line 388 in da62200
PathBuf, and instead get a handle to the file.kchibisov commentedon Dec 31, 2025
The path stuff will be gone eventually, since it doesn't make much sense in general. It also causes issues on Wayland, because you just get
fdmost of the time and a bunch of mime types you can pick from, so it'll probably just move to amimetype+request()on some object.umajho commentedon Jul 22, 2026
I saw that #4571 has been merged.
I have not look through the PR in detail, but it seems we now have a
DragPositionWindowEvent.