mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2026-02-19 23:31:07 +00:00
Compare commits
4 Commits
3c1b7bdbb6
...
2dfc5663c8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2dfc5663c8 | ||
|
|
d1205dc95d | ||
|
|
b63c21da88 | ||
|
|
66b961f5e3 |
@@ -141,7 +141,7 @@ namespace Ryujinx.Ava.Input
|
||||
AvaKey.OemComma,
|
||||
AvaKey.OemPeriod,
|
||||
AvaKey.OemQuestion,
|
||||
AvaKey.OemBackslash,
|
||||
AvaKey.OemPipe,
|
||||
|
||||
// NOTE: invalid
|
||||
AvaKey.None
|
||||
|
||||
@@ -72,6 +72,10 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
// Correctly size window when 'TitleBar' is enabled (Nov. 14, 2024)
|
||||
public readonly double TitleBarHeight;
|
||||
|
||||
// Avalonia will make the window higher than we set.
|
||||
// Store the delta between those 2 values to save the correct window height when exiting.
|
||||
private double _heightCorrection = 0;
|
||||
|
||||
public readonly double StatusBarHeight;
|
||||
public readonly double MenuBarHeight;
|
||||
|
||||
@@ -468,6 +472,21 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveHeightCorrection()
|
||||
{
|
||||
if (WindowState != WindowState.Normal)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Store the delta between the height we set (ViewModel.WindowHeight) and the actual height returned by Avalonia (Height).
|
||||
_heightCorrection = Height - ViewModel.WindowHeight;
|
||||
if (Math.Abs(_heightCorrection) > 50)
|
||||
{
|
||||
_heightCorrection = 0;
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveWindowSizePosition()
|
||||
{
|
||||
ConfigurationState.Instance.UI.WindowStartup.WindowMaximized.Value = WindowState == WindowState.Maximized;
|
||||
@@ -477,8 +496,8 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
{
|
||||
// Since scaling is being applied to the loaded settings from disk (see SetWindowSizePosition() above), scaling should be removed from width/height before saving out to disk
|
||||
// as well - otherwise anyone not using a 1.0 scale factor their window will increase in size with every subsequent launch of the program when scaling is applied (Nov. 14, 2024)
|
||||
ConfigurationState.Instance.UI.WindowStartup.WindowSizeHeight.Value = (int)(Height / Program.WindowScaleFactor);
|
||||
ConfigurationState.Instance.UI.WindowStartup.WindowSizeWidth.Value = (int)(Width / Program.WindowScaleFactor);
|
||||
ConfigurationState.Instance.UI.WindowStartup.WindowSizeHeight.Value = (int)Math.Round((Height - _heightCorrection) / Program.WindowScaleFactor);
|
||||
ConfigurationState.Instance.UI.WindowStartup.WindowSizeWidth.Value = (int)Math.Round(Width / Program.WindowScaleFactor);
|
||||
|
||||
ConfigurationState.Instance.UI.WindowStartup.WindowPositionX.Value = Position.X;
|
||||
ConfigurationState.Instance.UI.WindowStartup.WindowPositionY.Value = Position.Y;
|
||||
@@ -539,6 +558,8 @@ namespace Ryujinx.Ava.UI.Windows
|
||||
LoadApplications();
|
||||
}
|
||||
|
||||
Dispatcher.UIThread.Post(SaveHeightCorrection, DispatcherPriority.Loaded);
|
||||
|
||||
_ = CheckLaunchState();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user