Prevent title bar and menu moving off-screen

This commit is contained in:
kalimag 2024-09-13 11:55:41 +02:00 committed by James Groom
parent a3bf347e22
commit ad73d39176
1 changed files with 5 additions and 2 deletions

View File

@ -1433,14 +1433,17 @@ namespace BizHawk.Client.EmuHawk
// Is window off the screen at this size?
if (!area.Contains(Bounds))
{
// At large framebuffer sizes/low screen resolutions, the window may be too large to fit the screen even at 1x scale
// Prioritize that the top-left of the window is on-screen so the title bar and menu stay accessible
if (Bounds.Right > area.Right) // Window is off the right edge
{
Location = new Point(area.Right - Size.Width, Location.Y);
Left = Math.Max(area.Right - Size.Width, area.Left);
}
if (Bounds.Bottom > area.Bottom) // Window is off the bottom edge
{
Location = new Point(Location.X, area.Bottom - Size.Height);
Top = Math.Max(area.Bottom - Size.Height, area.Top);
}
}
}