On Mon, May 17, 2021 at 08:22:01PM +1000, Joel Hockey wrote:
I'm one of the Chrome OS developers. I would like to make it possible for wine apps running in the crostini linux VM to use the Chrome OS native FilesApp for file chooser when possible. Using the native FilesApp improves the UX consistency, and also allows us to let VM apps get access to files outside the VM which can be shared on-demand when a user selects.
Does wine already have any APIs where a native file chooser dialog can be configured either during compile or at runtime? I don't see anything.
This is something we've done in CrossOver for our some of our macOS ports. Looking at our source, the places where we call into native code are GetOpenFileName and GetSaveFileName in comdlg32, and SHBrowseForFolder in shell32. It looks like we actually don't change GetFileDialog95 at all.
Like André said, your biggest difficulty will be many applications expect these dialogs to be and behave like real Windows dialogs, so this kind of hack doesn't work for every application. For example they might walk the window tree to find some internal control to mess with; and they can specify custom dialog templates and hook functions, which are difficult or impossible to support with a native dialog. It's not something you can safely turn on for all applications.
Andrew