Add Event::OpenFiles
Emit an event when the application is opened by clicking on files in Finder or by dropping files on the Dock icon. This is macOS specific, as other OSs usually communicate that information through std::env::args().
I am not sure with the current implementation, i.e. maybe the OpenFiles event should be defined in a macOS specific event enum type?
This basically implements #1751.
To test the event, a application bundle is required:
Winit.App
- Contents
- Info.plist
- MacOS
- <executable>
The Info.plist should look like this:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleExecutable</key>
<string>
<!-- Name of executable -->
</string>
</dict>
</plist>
Also, you need to implement fn ApplicationHandler::open_files(&mut self, files: Vec<PathBuf>).
- [ ] Tested on all platforms changed
- [ ] Added an entry to the
changelogmodule if knowledge of this change could be valuable to users - [ ] Updated documentation to reflect any user-facing changes, including notes of platform-specific behavior
- [ ] Created or updated an example program if it would help users understand this functionality
- [ ] Updated [feature matrix](https://github.com/rust-windowing/winit
Thanks for the PR, though I'm going to resolve this in a different way, see https://github.com/rust-windowing/winit/issues/1751#issuecomment-2186560639.