fix(settings): a borderless screen draws into a buffer of the monitor's size, not the resolution row's

With fullscreenwindowed the simulator takes the window's size from the monitor and leaves width and height unread (application.cpp), but its full renderer still draws into gfx.framebuffer.width and height (opengl33renderer.cpp). Those were written from the resolution row, greyed out in that mode: 1280x720 stretched over a larger monitor. Borderless, they are now -1, the simulator's own word for a buffer of the window's size, or with a smaller render scale that part of the chosen monitor's size, the primary one's when none is chosen. A size left in a borderless file goes on the next save.
This commit is contained in:
maj00r
2026-11-22 14:53:18 +01:00
parent d429d041ff
commit 5ec7a4b539
6 changed files with 154 additions and 5 deletions

View File

@@ -59,6 +59,22 @@ public class MonitorsTests
Assert.Equal("HDMI-1:1920,0", c.GetRaw("fullscreenmonitor"));
}
[Fact]
public void The_size_is_of_the_monitor_named_or_of_the_primary_one()
{
var monitors = new[]
{
new DisplayMonitor("eDP-1:0,360", "eDP-1", 1920, 1080, true),
new DisplayMonitor("HDMI-1:1920,0", "HDMI-1", 2560, 1440, false)
};
Assert.Equal((2560, 1440), Monitors.SizeOf(monitors, "HDMI-1:1920,0"));
Assert.Equal((1920, 1080), Monitors.SizeOf(monitors, ""));
// Not connected: the simulator goes to the primary one.
Assert.Equal((1920, 1080), Monitors.SizeOf(monitors, "DP-3:4480,0"));
Assert.Null(Monitors.SizeOf(Array.Empty<DisplayMonitor>(), "HDMI-1:1920,0"));
}
// ── A name outside ASCII: the simulator compares the file's bytes with GLFW's UTF-8 name ──
private static readonly string UserIni = Path.Combine("/home/kolejarz", ".config", "MaSzyna", "eu07.ini");