Skip to content

Commit 76ec464

Browse files
committed
Fix iOS AUv3 plugin issues with dialogs and callout boxes
1 parent b017aa5 commit 76ec464

File tree

4 files changed

+19
-3
lines changed

4 files changed

+19
-3
lines changed

Source/LookAndFeel.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,14 @@ void PlugDataLook::drawComboBox(Graphics& g, int const width, int const height,
489489

490490
PopupMenu::Options PlugDataLook::getOptionsForComboBoxPopupMenu(ComboBox& box, Label& label)
491491
{
492-
return PopupMenu::Options().withTargetComponent(&box).withItemThatMustBeVisible(box.getSelectedId()).withInitiallySelectedItem(box.getSelectedId()).withMinimumWidth(box.getWidth()).withMaximumNumColumns(1).withStandardItemHeight(22);
492+
auto options = PopupMenu::Options().withTargetComponent(&box).withItemThatMustBeVisible(box.getSelectedId()).withInitiallySelectedItem(box.getSelectedId()).withMinimumWidth(box.getWidth()).withMaximumNumColumns(1).withStandardItemHeight(22);
493+
494+
#if JUCE_IOS
495+
if(mainComponent)
496+
options = options.withParentComponent(mainComponent);
497+
#endif
498+
499+
return options;
493500
}
494501

495502
void PlugDataLook::drawGUIObjectSlider(Graphics& g, int const x, int const y, int const width, int const height, float sliderPos, float minSliderPos, float maxSliderPos, Slider& slider)

Source/LookAndFeel.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,11 @@ struct PlugDataLook final : public LookAndFeel_V4 {
204204
static inline String currentTheme = "light";
205205
static inline StringArray selectedThemes = { "light", "dark" };
206206

207+
#if JUCE_IOS
208+
void setMainComponent(Component* c) { mainComponent = c; }
209+
Component::SafePointer<Component> mainComponent;
210+
#endif
211+
207212
#if JUCE_IOS
208213
static constexpr int ioletSize = 15;
209214
#else

Source/PluginEditor.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,10 @@ PluginEditor::PluginEditor(PluginProcessor& p)
395395
}
396396
});
397397

398+
#if JUCE_IOS
399+
pd->lnf->setMainComponent(this);
400+
#endif
401+
398402
startTimerHz(90);
399403
}
400404

@@ -548,7 +552,7 @@ CallOutBox& PluginEditor::showCalloutBox(std::unique_ptr<Component> content, Rec
548552

549553
if (ProjectInfo::canUseSemiTransparentWindows()) {
550554
content->addComponentListener(new CalloutDeletionListener(this));
551-
calloutArea->addToDesktop(ComponentPeer::windowIsTemporary);
555+
calloutArea->addToDesktop(ComponentPeer::windowIsTemporary, getPeer()->getNativeHandle());
552556
calloutArea->toFront(true);
553557
auto const bounds = calloutArea->getLocalArea(nullptr, screenBounds);
554558
return CallOutBox::launchAsynchronously(std::move(content), bounds, calloutArea.get());

Source/Utility/Config.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ void ProjectInfo::closeWindow(PlugDataWindow* window)
5858
bool ProjectInfo::canUseSemiTransparentWindows()
5959
{
6060
#if JUCE_IOS
61-
return isStandalone;
61+
return true;
6262
#endif
6363
#if !JUCE_MAC || PLUGDATA_STANDALONE
6464
return Desktop::canUseSemiTransparentWindows();

0 commit comments

Comments
 (0)