From c7e1b289eefa6236cfff4de0a93cff1cbb5d5bd3 Mon Sep 17 00:00:00 2001 From: "Ryan C. Gordon" Date: Mon, 27 Jan 2020 17:15:12 -0500 Subject: [PATCH] cocoa: Fix command line apps' menu bar not working on macOS Catalina. Fixes Bugzilla #4937. --- src/video/cocoa/SDL_cocoaevents.m | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/video/cocoa/SDL_cocoaevents.m b/src/video/cocoa/SDL_cocoaevents.m index aaff506c9..09d2351ea 100644 --- a/src/video/cocoa/SDL_cocoaevents.m +++ b/src/video/cocoa/SDL_cocoaevents.m @@ -238,6 +238,11 @@ static void Cocoa_DispatchEvent(NSEvent *theEvent) * of here. https://bugzilla.libsdl.org/show_bug.cgi?id=3051 */ if (!SDL_GetHintBoolean(SDL_HINT_MAC_BACKGROUND_APP, SDL_FALSE)) { + /* Get more aggressive for Catalina: activate the Dock first so we definitely reset all activation state. */ + for (NSRunningApplication *i in [NSRunningApplication runningApplicationsWithBundleIdentifier:@"com.apple.dock"]) { + [i activateWithOptions:NSApplicationActivateIgnoringOtherApps]; + break; + } [NSApp activateIgnoringOtherApps:YES]; }