Skip to content

Commit

Permalink
Fix macOS multi file
Browse files Browse the repository at this point in the history
  • Loading branch information
Meakk committed Jan 11, 2025
1 parent 456f0f2 commit 04a2737
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions application/F3DNSDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,26 @@
// This is a subclass of NSApplicationDelegate.
@interface F3DNSDelegateInternal : NSObject<NSApplicationDelegate>
@property F3DStarter* Starter;
@property BOOL ShouldHandleFileOpening;
@end

@implementation F3DNSDelegateInternal
@synthesize Starter;
@synthesize ShouldHandleFileOpening;

// ----------------------------------------------------------------------------
- (BOOL)application:(NSApplication*)theApplication openFile:(NSString*)filename
{
(void)theApplication;
Starter->AddFile([filename UTF8String]);
Starter->LoadFileGroup();
Starter->Render();
if (ShouldHandleFileOpening)
{
int index = Starter->AddFile([filename UTF8String]);
if (index > -1)
{
Starter->LoadFileGroup(index);
}
Starter->Render();
}
return YES;
}

Expand Down Expand Up @@ -105,6 +113,13 @@ - (void)applicationWillFinishLaunching:(NSNotification *)notification
action:@selector(toggleFullScreen:)
keyEquivalent:@"f"]
setKeyEquivalentModifierMask:NSEventModifierFlagControl | NSEventModifierFlagCommand];

ShouldHandleFileOpening = false;
}

- (void)applicationDidFinishLaunching:(NSNotification *)notification
{
ShouldHandleFileOpening = true;
}

@end
Expand Down

0 comments on commit 04a2737

Please sign in to comment.