Update MainWindow.cs

This commit is contained in:
Christopher Merrill 2023-04-15 12:20:05 -05:00 committed by GitHub
parent fd879f34f4
commit 5cb50f531c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -152,8 +152,10 @@ namespace Ryujinx.Ui
int monitorWidth = monitor.Geometry.Width * monitor.ScaleFactor;
int monitorHeight = monitor.Geometry.Height * monitor.ScaleFactor;
DefaultWidth = monitorWidth < 1280 ? monitorWidth : 1280;
DefaultHeight = monitorHeight < 760 ? monitorHeight : 760;
DefaultWidth = monitorWidth < 1280 ? monitorWidth : ConfigurationState.Instance.Ui.WindowSizeWidth;
DefaultHeight = monitorHeight < 760 ? monitorHeight : ConfigurationState.Instance.Ui.WindowSizeHeight;
Move(ConfigurationState.Instance.Ui.WindowPositionX,ConfigurationState.Instance.Ui.WindowPositionY);
if (ConfigurationState.Instance.Ui.WindowMaximized == true) { Maximize(); };
Icon = new Gdk.Pixbuf(Assembly.GetAssembly(typeof(ConfigurationState)), "Ryujinx.Ui.Common.Resources.Logo_Ryujinx.png");
Title = $"Ryujinx {Program.Version}";
@ -1297,10 +1299,30 @@ namespace Ryujinx.Ui
OpenHelper.OpenFolder(logPath);
}
private void SaveWindowSizePosition()
{
int windowWidth;
int windowHeight;
int windowXPos;
int windowYPos;
GetSize(out windowWidth, out windowHeight);
GetPosition(out windowXPos, out windowYPos);
ConfigurationState.Instance.Ui.WindowMaximized.Value = IsMaximized;
ConfigurationState.Instance.Ui.WindowSizeWidth.Value = windowWidth;
ConfigurationState.Instance.Ui.WindowSizeHeight.Value = windowHeight;
ConfigurationState.Instance.Ui.WindowPositionX.Value = windowXPos;
ConfigurationState.Instance.Ui.WindowPositionY.Value = windowYPos;
SaveConfig();
}
private void Exit_Pressed(object sender, EventArgs args)
{
if (!_gameLoaded || !ConfigurationState.Instance.ShowConfirmExit || GtkDialog.CreateExitDialog())
{
SaveWindowSizePosition();
End();
}
}
@ -1309,6 +1331,8 @@ namespace Ryujinx.Ui
{
if (!_gameLoaded || !ConfigurationState.Instance.ShowConfirmExit || GtkDialog.CreateExitDialog())
{
SaveWindowSizePosition();
End();
}
else