diff options
author | Iain Holmes <iaholmes@microsoft.com> | 2020-01-10 12:55:32 +0300 |
---|---|---|
committer | monojenkins <jo.shields+jenkins@xamarin.com> | 2020-01-16 17:11:41 +0300 |
commit | 09f0158047e11bd96053d0d05936772efab891b6 (patch) | |
tree | 8ca61d52bd931f22d2d2cb93bdf509dc67186774 /main | |
parent | c942e40c22cd72f63ce08d30a1c719652f110c56 (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
Diffstat (limited to 'main')
-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 0824931d24..f44e815769 100644 --- a/main/src/addins/MacPlatform/MacPlatform.cs +++ b/main/src/addins/MacPlatform/MacPlatform.cs @@ -350,10 +350,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; + } } return loaded; |