mirror of
https://git.ryujinx.app/ryubing/ryujinx.git
synced 2025-07-24 14:49:48 -06:00
Fix window sizing when "Show Title Bar" is enabled (#247)
Fixes a bug that causes the main window to not size properly when the TitleBar is enabled (i.e.: when the TitleBar and MenuStrip are separate entities). Corrects the size for main window startup and when a user clicks a "View > Window Size > *Resolution Here*" MenuStripItem Prior to this fix if a user selects 720p/1080p and "Show Title Bar" is enabled, the window would be sized smaller than intended and display black bars on the sides of the render area
This commit is contained in:
@ -184,18 +184,24 @@ namespace Ryujinx.Ava.UI.Views.Main
|
||||
if (sender is not MenuItem { Tag: string resolution })
|
||||
return;
|
||||
|
||||
(int width, int height) = resolution.Split(' ', 2)
|
||||
(int resolutionWidth, int resolutionHeight) = resolution.Split(' ', 2)
|
||||
.Into(parts =>
|
||||
(int.Parse(parts[0]), int.Parse(parts[1]))
|
||||
);
|
||||
|
||||
// Correctly size window when 'TitleBar' is enabled (Nov. 14, 2024)
|
||||
double barsHeight = ((Window.StatusBarHeight + Window.MenuBarHeight) +
|
||||
(ConfigurationState.Instance.ShowTitleBar ? (int)Window.TitleBar.Height : 0));
|
||||
|
||||
double windowWidthScaled = (resolutionWidth * Program.WindowScaleFactor);
|
||||
double windowHeightScaled = ((resolutionHeight + barsHeight) * Program.WindowScaleFactor);
|
||||
|
||||
await Dispatcher.UIThread.InvokeAsync(() =>
|
||||
{
|
||||
|
||||
ViewModel.WindowState = WindowState.Normal;
|
||||
|
||||
height += (int)Window.StatusBarHeight + (int)Window.MenuBarHeight;
|
||||
|
||||
Window.Arrange(new Rect(Window.Position.X, Window.Position.Y, width, height));
|
||||
Window.Arrange(new Rect(Window.Position.X, Window.Position.Y, windowWidthScaled, windowHeightScaled));
|
||||
});
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user