8000
  • Implemented files_dropped_event for macOS by Pewnack · Pull Request #619 · not-fl3/miniquad · GitHub
    [go: up one dir, main page]

    Skip to content

    Implemented files_dropped_event for macOS - #619

    Merged
    not-fl3 merged 1 commit into
    not-fl3:masterfrom
    Pewnack:file_dropping
    Apr 6, 2026
    Merged

    not-fl3 merged 1 commit into
    not-fl3:masterfrom
    Pewnack:file_dropping

    Conversation

    @Pewnack
    @Pewnack Pewnack commented Apr 6, 2026
    Copy link
    Copy Markdown
    Contributor

    This is a fix for issue #568

    Implemented the files_dropped_event for macOS. It's only triggered for files, not directories. Also returns the dropped_file_bytes same as for linux_x11.

    On macOS this only required the implementation of two events :

    • draggingEntered - Triggered when drag 'n drop targets enter the Window and decides if you are going to accept it. Here we check if we are actually dragging file URLs. If not, the drag is not accepted. File URLs also include directories though.
    • performDragOperation - Triggered when the drop takes place. Here we explicitly check if it is files we are dropping. Directories are skipped and will not trigger the files_dropped event.

    We also need to tell the view to handle drag 'n drop with a call to registerForDraggedTypes. Without this, the drag 'n drop events are not triggered at all.

    When files are dropped we read its bytes for dropped_file_bytes with std::fs::read. Mimicked this from linux_x11.rs.

    Tested it on macOS Tahoe 26.4 (currently the latest macOS version) and on the older macOS Monterey 12.7.6.

    @not-fl3
    not-fl3 commented Apr 6, 2026
    Copy link
    Copy Markdown
    Owner

    Thanks for PR!

    @not-fl3
    not-fl3 merged commit a6e3d78 into not-fl3:master Apr 6, 2026
    11 checks passed
    @Pewnack
    Pewnack commented Apr 7, 2026
    Copy link
    Copy Markdown
    Contributor Author

    Thanks for merging!

    @Pewnack
    Pewnack deleted the file_dropping branch April 7, 2026 15:38
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Labels

    None yet

    Projects

    None yet

    Development

    Successfully merging this pull request may close these issues.

    2 participants

    0