feat(application): parent FileKit dialogs to a Nucleus window - #722
Merged
Merged
Conversation
NucleusWindow.withFileKitDialogSettings { } fills FileKitDialogSettings.parent
from the window's platform identity: HWND on Windows, x11:<xid> on X11, an
xdg_foreign export held for the dialog's duration on Wayland. macOS stays
unparented (FileKit 0.15 only accepts an AWT parent there).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
NucleusWindow.withFileKitDialogSettings { settings -> … }tonucleus-application: it runs the block withFileKitDialogSettings.parentset from the window's platform identity, so FileKit pickers attach to the window instead of floating free.filekit-dialogsiscompileOnly(likefilekit-core): never forced on consumers, only callable by an app that already ships it.FileKitDialogParent,FileKitDialogSettingsandMacOSFilePickerare identical).FileKitDialogSettings.createDefault()always returnsparent = null), and reflection / patching FileKit's bytecode are off the table. A follow-up upstream PR adding a parent provider to FileKit would letnucleusApplicationregister it and make a bareFileKit.openFilePicker()parented.Documentation
Attach a FileKit dialog to a window
Wrap the FileKit call in
withFileKitDialogSettingson the window that opens it:Pass your own settings as the first argument to keep a title or macOS options; only
parentis filled in:FileKitDialogParent.windows)x11:<xid>(FileKitDialogParent.x11)xdg_foreignexport (FileKitDialogParent.wayland), opened before the block and closed when it returns or throwsNSOpenPanel/NSSavePanel.runModal()runsNSApplication.runModal(for:), which is app-modal (no other window takes events while it is up). A parent would only turn it into a sheet, a presentation choiceBehaviour:
parentare passed through untouched.Dispatchers.IO; calling from the UI thread is fine.nucleusWindow.unsafe.taoWindow?.nativeHandle/xdgPortalParent()) still works for other portal dialogs.Test plan
FileKitDialogsTest: parent applied and lease released after the dialog, lease released when the picker throws, caller-chosen parent kept, no identity → unparented:nucleus-application:detekt,ktlintCheck,apiDump(API dump committed)