From 4ba81fda597ba8f061c07f652a6f000e3c386c8b Mon Sep 17 00:00:00 2001 From: reuk Date: Wed, 24 May 2023 11:49:10 +0100 Subject: [PATCH] FileChooser: Fix bug where native FileChooser could not be closed when hosted in Cantabile Previously, the top-level modal dismiss broadcaster would attempt to dismiss all modals when the native file chooser was brought to the front or clicked. This would end up calling Component::inputAttemptWhenModal, which would bring the FileChooser's Component to the front, interrupting the mouse click. The fix is to avoid bringing the plugin window to the front when the FileChooser is in a modal state. As the chooser is a native window, the system should take care of enforcing the expected modal behaviour. It's not clear why this issue only affects Cantabile. It seems that in Cantabile, events from the native FileChooser get sent to the plugin editor's parent HWND, whereas this doesn't happen in other hosts. Perhaps Cantabile is hooking/intercepting window messages in some way. --- modules/juce_gui_basics/native/juce_FileChooser_windows.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/modules/juce_gui_basics/native/juce_FileChooser_windows.cpp b/modules/juce_gui_basics/native/juce_FileChooser_windows.cpp index f3fdaeb47b..351eb4f94d 100644 --- a/modules/juce_gui_basics/native/juce_FileChooser_windows.cpp +++ b/modules/juce_gui_basics/native/juce_FileChooser_windows.cpp @@ -876,6 +876,8 @@ public: return targetComponent->findParentComponentOfClass() != nullptr; } + void inputAttemptWhenModal() override {} + private: FileChooser& owner; std::shared_ptr nativeFileChooser;