Skip to content

Commit ad73d39

Browse files
kalimagYoshiRulz
authored andcommitted
Prevent title bar and menu moving off-screen
1 parent a3bf347 commit ad73d39

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/BizHawk.Client.EmuHawk/MainForm.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1433,14 +1433,17 @@ public void FrameBufferResized(bool forceWindowResize = false)
14331433
// Is window off the screen at this size?
14341434
if (!area.Contains(Bounds))
14351435
{
1436+
// At large framebuffer sizes/low screen resolutions, the window may be too large to fit the screen even at 1x scale
1437+
// Prioritize that the top-left of the window is on-screen so the title bar and menu stay accessible
1438+
14361439
if (Bounds.Right > area.Right) // Window is off the right edge
14371440
{
1438-
Location = new Point(area.Right - Size.Width, Location.Y);
1441+
Left = Math.Max(area.Right - Size.Width, area.Left);
14391442
}
14401443

14411444
if (Bounds.Bottom > area.Bottom) // Window is off the bottom edge
14421445
{
1443-
Location = new Point(Location.X, area.Bottom - Size.Height);
1446+
Top = Math.Max(area.Bottom - Size.Height, area.Top);
14441447
}
14451448
}
14461449
}

0 commit comments

Comments
 (0)