From 53f2d52b7aede62164cd5eb413cc5c8912f45715 Mon Sep 17 00:00:00 2001 From: culler Date: Fri, 11 Oct 2019 02:52:02 +0000 Subject: Fix bug[bf93d098d7]: Menubar is sometimes unresponsive on app startup --- macosx/tkMacOSXInit.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/macosx/tkMacOSXInit.c b/macosx/tkMacOSXInit.c index 848b500..2ba4d28 100644 --- a/macosx/tkMacOSXInit.c +++ b/macosx/tkMacOSXInit.c @@ -116,12 +116,18 @@ static char scriptPath[PATH_MAX + 1] = ""; -(void)applicationDidFinishLaunching:(NSNotification *)notification { - /* * It is not safe to force activation of the NSApp until this method is * called. Activating too early can cause the menu bar to be unresponsive. + * The call to activateIgnoringOtherApps was moved here to avoid this. + * However, with the release of macOS 10.15 (Catalina) this was no longer + * sufficient. (See ticket bf93d098d7.) Apparently apps were being + * activated automatically, and this was sometimes being done too early. + * As a workaround we deactivate and then reactivate the app, even though + * Apple says that "Normally, you shouldn’t invoke this method". */ + [NSApp deactivate]; [NSApp activateIgnoringOtherApps: YES]; /* @@ -182,6 +188,7 @@ static char scriptPath[PATH_MAX + 1] = ""; * If no icon has been set from an Info.plist file, use the Wish icon from * the Tk framework. */ + NSString *iconFile = [[NSBundle mainBundle] objectForInfoDictionaryKey: @"CFBundleIconFile"]; if (!iconFile) { @@ -396,7 +403,6 @@ TkpInit( } } - /* * Initialize the NSServices object here. Apple's docs say to do this * in applicationDidFinishLaunching, but the Tcl interpreter is not @@ -405,7 +411,6 @@ TkpInit( */ TkMacOSXServices_Init(interp); - } if (tkLibPath[0] != '\0') { -- cgit v0.12