diff options
author | Iain Holmes <iaholmes@microsoft.com> | 2020-01-10 12:55:32 +0300 |
---|---|---|
committer | iain holmes <iain@xamarin.com> | 2020-01-10 12:55:32 +0300 |
commit | a335e89a60edcb4183f9c74bb36e49a8e52be204 (patch) | |
tree | 115b5397d60993c01544d91ae719be028e2a8c58 | |
parent | 392e5dc052f736377508dfca985f2296fc5ebbe8 (diff) |
[Mac] Improve startup reason detection
The AppDelegate always knows the startup reason, so check if it there as a
fallback if we missed the startup notification
Fixes VSTS #984249
-rw-r--r-- | main/src/addins/MacPlatform/MacPlatform.cs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/main/src/addins/MacPlatform/MacPlatform.cs b/main/src/addins/MacPlatform/MacPlatform.cs index 0f79d87179..3b4a372899 100644 --- a/main/src/addins/MacPlatform/MacPlatform.cs +++ b/main/src/addins/MacPlatform/MacPlatform.cs @@ -352,10 +352,15 @@ namespace MonoDevelop.MacIntegration // At this point, Cocoa should have been initialized; it is initialized along with Gtk+ at the beginning of IdeStartup.Run // If LaunchReason is still Unknown at this point, it means we have missed the NSApplicationDidLaunch notification for some reason and - // we fall back to it being a Normal startup to unblock anything waiting for that notification. + // we fall back to the AppDelegate's version to unblock anything waiting for that notification. if (IdeApp.LaunchReason == IdeApp.LaunchType.Unknown) { - LoggingService.LogWarning ("Missed NSApplicationDidLaunch notification, assuming normal startup"); - IdeApp.LaunchReason = IdeApp.LaunchType.Normal; + if (appDelegate.LaunchReason != AppDelegate.LaunchType.Unknown) { + IdeApp.LaunchReason = appDelegate.LaunchReason == AppDelegate.LaunchType.Normal ? IdeApp.LaunchType.Normal : IdeApp.LaunchType.LaunchedFromFileManager; + } else { + // Fall back to Normal if even the app delegate doesn't know + LoggingService.LogWarning ("Unknown startup reason, assuming Normal"); + IdeApp.LaunchReason = IdeApp.LaunchType.Normal; + } } ideAppleEvents = new MacIdeAppleEvents (); |