Check if I'm dragging files

Godot Version

4.7

Question

I know there is files_dropped signal in the Window class. But is there a way I can check if I’m currently hovering files over my game window? For example, I want to highlight area where the files should be dropped when I’m dragging them. See how that works when you drag an image onto the Google browser.

As far as I can find there isn’t one exposed. Window only gives you files_dropped, and that fires on release, so there’s no enter or over event to hang a highlight off.

There’s an open proposal asking for this exact thing: Improve Window file drag-and-drop functionality and user feedback with filter for accepted file types · Issue #10178 · godotengine/godot-proposals · GitHub

It covers both halves of what you’re describing, the hover feedback and being able to declare which file types you’d actually accept so the cursor reflects it. Still open, so your use case would be worth adding there.

Until something lands, I think the only route is a GDExtension that hooks the platform’s own drag and drop API. Windows, macOS and X11 all fire drag enter, drag over and drag leave events, so the information does exist at the OS level, Godot just isn’t passing it up.

Been watching a tutorial on making a card battler game. You might be able to make use of that logic if you can’t find anything better.