love
love copied to clipboard
Request: Add x and y params to filedropped() and directorydropped() event callbacks
filedropped(file) => filedropped(file, x, y) directorydropped(path) => directorydropped(path, x, y)
In most cases the correct coords can be obtained using mouse.getPosition() inside those two callbacks but not always. Consider the case where the Love2D application has halted because it's waiting for a file dialog to close. If you drag a file or directory from the file dialog onto the halted application window and then close the file dialog, the application has no way of knowing the actual coords of the drop because the mouse has possibly moved between the time of the drop and the closing of the dialog. Adding x and y params to those callbacks will allow the programmer to always know the exact location of the drop.
Unfortunately SDL2 doesn't provide this with the event, but SDL3 will.
Sounds like my library can jump in here https://github.com/EngineerSmith/isdropping
Perhaps SDL could have an option for automatically bringing a window to the foreground (or making an attempt to) when a drag and drop event occurs (on the release of the mouse button). I think this would be acceptable window behavior (ie. not focus-stealing). Maybe also have an option for bringing the window to the foreground when a mousewheel event occurs. These options could be set with a call like SDL_SetWindowForeground(SDL_DROPFILE | SDL_MOUSEWHEEL) or something better.