From 36664cc487ee386fb44f3b1eb50328f32d95e8b8 Mon Sep 17 00:00:00 2001 From: reuk Date: Mon, 19 Oct 2020 17:19:32 +0100 Subject: [PATCH] FileChooser: Fix behaviour of macOS FilePreviewComponent Previously, when the FileChooser::Native instance entered the modal state, it was preventing the inner FilePreviewComponent from receiving events. --- modules/juce_gui_basics/native/juce_mac_FileChooser.mm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/juce_gui_basics/native/juce_mac_FileChooser.mm b/modules/juce_gui_basics/native/juce_mac_FileChooser.mm index 27dc8e9fe6..14dd570518 100644 --- a/modules/juce_gui_basics/native/juce_mac_FileChooser.mm +++ b/modules/juce_gui_basics/native/juce_mac_FileChooser.mm @@ -97,11 +97,11 @@ public: if (preview != nullptr) { nsViewPreview = [[NSView alloc] initWithFrame: makeNSRect (preview->getLocalBounds())]; + [panel setAccessoryView: nsViewPreview]; + preview->addToDesktop (0, (void*) nsViewPreview); preview->setVisible (true); - [panel setAccessoryView: nsViewPreview]; - if (! isSave) { auto* openPanel = static_cast (panel); @@ -187,6 +187,9 @@ public: if (targetComponent == nullptr) return false; + if (targetComponent == preview) + return true; + return targetComponent->findParentComponentOfClass() != nullptr; }