Mac related - runModal on openPanel failing on Mx chips, but fine on Intel

DSP, Plugin and Host development discussion.
Post Reply New Topic
RELATED
PRODUCTS

Post

Hope all is well, been a while since I was last in these lands :-)

I have a project that needs updating on Mac side to accommodate Mx chips natively, thus far it's been the Intel code Rosetta'd.

This is non-JUCE/iPlug code, from a dated but stable codebase. Have a VST and a standalone simple host that loads the plugin. Has been working as desired.

I now have a macmini with M1, running Ventura/OSX13, XCode 15. Loaded up all the old projects, made the necessary adjustments, recompiled. Once all the obligatory link tomfoolery is passed I have an Intel/Apple .vst and .app. All is well with the world.

There are dialogs for serial number (created on the fly) and locating a sound library (using openPanel). They don't appear to fire.

If I load the VST using a third party host/DAW the dialogs show, whether running Apple or Rosetta. Using our own standalone code - they don't.. They just return that the dialog was cancelled.

There's nothing odd about the invoking code..

Code: Select all

    NSOpenPanel* op = [NSOpenPanel openPanel];
    [op setAllowsMultipleSelection:NO];
    [op setCanChooseFiles:NO];
    [op setCanChooseDirectories:YES];
    [op setShowsHiddenFiles:YES];
    [op setShowsResizeIndicator:YES];
    [op setShowsToolbarButton:YES];

    const gfl::String& fp = inPath.GetString();
    NSURL* furl = [NSURL fileURLWithPath:(NSString*)fp.GetCFString()];
    [op setDirectoryURL:furl];

    if([op runModal] == NSModalResponseOK /*NSFileHandlingPanelOKButton*/)
    {
        NSURL* url = [op URL];
        mFilePath = gfl::FilePath([[url path] UTF8String]);
        return USER_SELECTED;
    }
    return USER_CANCELLED;
Stepping through it goes straight from the runModal line to the USER_CANCELLED.

I'm assuming it must be something changed about how one sets up an application or main form, some attribute or capability, or perhaps how the UI thread is invoked.

I see a few others having runModal issues recently on Apple & StackEx posts, but their solutions seem opaque or just unresolved.

Anyone else had this? Any ideas?

:-)
DSP

Post

I can't remember for sure, but it might have been the case that you can't use runModal anymore, but rather need to use beginSheetModalForWindow:completionHandler: which shows a sheet attached to a window instead.

Something like this: https://github.com/signaldust/dust-tool ... sx.mm#L662

The sheet is still modal, so the completion handler block serves little purpose.. but like what can you do.
Last edited by mystran on Thu Apr 04, 2024 12:48 am, edited 1 time in total.

Post


Post

Also... sandboxing and nsurl bookmarks are something fun to look forward to.

Post

How super lovely to see you both <3

Thank you for these. I did look at the latest iPlug in git, but it's such a size I wasn't sure where to look - this is very helpful.

About to turn in for the night and will start coding in the morning. Your kindness is appreciated!
Image

Post Reply

Return to “DSP and Plugin Development”