Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/window/cocoa/cocoa_display_backend.mm
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,19 @@ - (void)timerFired:(NSTimer*)nstimer
return std::make_unique<CocoaDisplayBackend>();
}


CocoaDisplayBackend::CocoaDisplayBackend()
{
// CRITICAL: Initialize NSApp and set activation policy for keyboard events
// Initialize NSApp if not already done
[NSApplication sharedApplication];
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
[NSApp finishLaunching];

// Only configure NSApp if we're the owner (no delegate set yet)
if ([NSApp delegate] == nil)
{
// We're the primary app - set activation policy for keyboard events
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
[NSApp finishLaunching];
}
// else: Parent app is managing NSApp lifecycle, don't interfere
}

CocoaDisplayBackend::~CocoaDisplayBackend()
Expand Down Expand Up @@ -143,4 +149,4 @@ - (void)timerFired:(NSTimer*)nstimer
std::unique_ptr<OpenFolderDialog> CocoaDisplayBackend::CreateOpenFolderDialog(DisplayWindow* owner)
{
return std::make_unique<CocoaOpenFolderDialog>(owner);
}
}