Save open files on window focus loss

This commit is contained in:
Matt Parker
2025-10-09 01:15:22 +10:00
parent 5b878c3fba
commit 8a1bf9df10

View File

@@ -27,6 +27,7 @@ public partial class IdeWindow : Control
MSBuildLocator.RegisterDefaults();
GodotServiceDefaults.AddServiceDefaults();
Singletons.AppState = AppStateLoader.LoadAppStateFromConfigFile();
GetWindow().FocusExited += OnFocusExited;
//GetWindow().SetMinSize(new Vector2I(1152, 648));
Callable.From(() => PickSolution(true)).CallDeferred();
}
@@ -42,6 +43,11 @@ public partial class IdeWindow : Control
// PrintOrphanNodes();
}
private void OnFocusExited()
{
_ = Task.GodotRun(async () => await Singletons.FileManager.SaveAllOpenFilesAsync());
}
public void PickSolution(bool fullscreen = false)
{
if (_slnPicker is not null) throw new InvalidOperationException("Solution picker is already active");