From 5cb50f531cb0a7352ee355e4cf29c70051bb1d16 Mon Sep 17 00:00:00 2001 From: Christopher Merrill <47538097+Revan20911@users.noreply.github.com> Date: Sat, 15 Apr 2023 12:20:05 -0500 Subject: [PATCH] Update MainWindow.cs --- Ryujinx/Ui/MainWindow.cs | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/Ryujinx/Ui/MainWindow.cs b/Ryujinx/Ui/MainWindow.cs index 82be82070..883a78319 100644 --- a/Ryujinx/Ui/MainWindow.cs +++ b/Ryujinx/Ui/MainWindow.cs @@ -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