Skip to content
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

Request: Add x and y params to filedropped() and directorydropped() event callbacks #2019

Open
AverniteDF opened this issue Feb 9, 2024 · 3 comments
Labels
feature New feature or request library dependency Related to a library used by LÖVE SDL3 Features and changes that depend on upgrading from SDL2 to SDL3

Comments

@AverniteDF
Copy link

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.

@slime73
Copy link
Member

slime73 commented Feb 9, 2024

Unfortunately SDL2 doesn't provide this with the event, but SDL3 will.

@EngineerSmith
Copy link
Contributor

Sounds like my library can jump in here https://github.com/EngineerSmith/isdropping

@slime73 slime73 added feature New feature or request library dependency Related to a library used by LÖVE SDL3 Features and changes that depend on upgrading from SDL2 to SDL3 labels Feb 9, 2024
@AverniteDF
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request library dependency Related to a library used by LÖVE SDL3 Features and changes that depend on upgrading from SDL2 to SDL3
Projects
None yet
Development

No branches or pull requests

3 participants