Skip to content
This repository was archived by the owner on Oct 4, 2021. It is now read-only.

Commit 95c46e0

Browse files
authored
[Ide[ Configure Gtk# for slim startup (#9364)
* [Ide[ Configure Gtk# for slim startup * Fix up startup tracker slices. Xamarin.Mac is init as part of gtk init, skewing info
1 parent 8015857 commit 95c46e0

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

main/src/core/MonoDevelop.Ide/MonoDevelop.Components/IdeTheme.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,12 @@ internal static void InitializeGtk (string progname, ref string[] args)
7676
{
7777
if (Gtk.Settings.Default != null)
7878
throw new InvalidOperationException ("Gtk already initialized!");
79-
80-
//HACK: we must initilize some Gtk rc before Gtk.Application is initialized on Mac/Windows
81-
// otherwise it will not be loaded correctly and theme switching won't work.
82-
if (!Platform.IsLinux)
83-
UpdateGtkTheme ();
8479

80+
IdeStartupTracker.StartupTracker.MarkSection ("PreGtkInitialization");
8581
#if MAC
8682
// Early init Cocoa through xwt
8783
var loaded = NativeToolkitHelper.LoadCocoa ();
84+
IdeStartupTracker.StartupTracker.MarkSection ("XamarinMacInitialization");
8885

8986
var disableA11y = Environment.GetEnvironmentVariable ("DISABLE_ATKCOCOA");
9087
if (Platform.IsMac && (NSUserDefaults.StandardUserDefaults.BoolForKey ("com.monodevelop.AccessibilityEnabled") && string.IsNullOrEmpty (disableA11y))) {
@@ -103,6 +100,11 @@ internal static void InitializeGtk (string progname, ref string[] args)
103100
AccessibilityEnabled = false;
104101
}
105102
#endif
103+
//HACK: we must initilize some Gtk rc before Gtk.Application is initialized on Mac/Windows
104+
// otherwise it will not be loaded correctly and theme switching won't work.
105+
if (!Platform.IsLinux)
106+
UpdateGtkTheme ();
107+
106108
Gtk.Application.Init (BrandingService.ApplicationName, ref args);
107109

108110
// Reset our environment after initialization on Mac

main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/IdeStartup.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ static void UnsetEnvironmentVariables()
8282
Environment.SetEnvironmentVariable ("MONO_GC_PARAMS", null);
8383
Environment.SetEnvironmentVariable ("MONO_SLEEP_ABORT_LIMIT", null);
8484
Environment.SetEnvironmentVariable ("MONO_THREADS_SUSPEND", null);
85+
86+
Environment.SetEnvironmentVariable ("GTKSHARP_SLIM_STARTUP", "yes");
8587
}
8688

8789
int Run (MonoDevelopOptions options)
@@ -126,6 +128,8 @@ int Run (MonoDevelopOptions options)
126128
var args = options.RemainingArgs.ToArray ();
127129

128130
IdeTheme.InitializeGtk (BrandingService.ApplicationName, ref args);
131+
IdeStartupTracker.StartupTracker.MarkSection ("GtkInitialization");
132+
129133

130134
startupInfo = new StartupInfo (options, args);
131135
if (startupInfo.HasFiles) {
@@ -143,14 +147,14 @@ int Run (MonoDevelopOptions options)
143147
LoggingService.LogError ("Unauthorized access: " + ua.Message);
144148
return 1;
145149
}
150+
IdeStartupTracker.StartupTracker.MarkSection ("IdeCustomizerInitialization");
146151

147152
try {
148153
GLibLogging.Enabled = true;
149154
} catch (Exception ex) {
150155
LoggingService.LogError ("Error initialising GLib logging.", ex);
151156
}
152157

153-
IdeStartupTracker.StartupTracker.MarkSection ("GtkInitialization");
154158
LoggingService.LogInfo ("Using GTK+ {0}", IdeVersionInfo.GetGtkVersion ());
155159

156160
// XWT initialization

0 commit comments

Comments
 (0)