From ad73d39176969efea812e57687141d8bff4ee367 Mon Sep 17 00:00:00 2001 From: kalimag Date: Fri, 13 Sep 2024 11:55:41 +0200 Subject: [PATCH] Prevent title bar and menu moving off-screen --- src/BizHawk.Client.EmuHawk/MainForm.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/BizHawk.Client.EmuHawk/MainForm.cs b/src/BizHawk.Client.EmuHawk/MainForm.cs index ceba2bd2d4..90caf6fc45 100644 --- a/src/BizHawk.Client.EmuHawk/MainForm.cs +++ b/src/BizHawk.Client.EmuHawk/MainForm.cs @@ -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); } } }