Repository navigation
feat(window): add borderless fullscreen as a third display mode - #1135
Open
ezequielzacca wants to merge 2 commits into
Open
ezequielzacca wants to merge 2 commits into
ezequielzacca wants to merge 2 commits into
Conversation
The Options window's windowed checkbox becomes a Display mode row with Windowed, Borderless fullscreen and Fullscreen, in the legacy and modern themes. - Borderless fullscreen covers the display the game is on at the desktop's resolution; the monitor's mode never changes. The Resolution row shows the desktop size, dimmed, and does not open; the saved resolution is kept for the other modes. - config.ini: [Window] Mode=Windowed|Borderless|Fullscreen replaces the Windowed flag. A config.ini without Mode keeps its choice (Windowed=1 is Windowed, Windowed=0 Fullscreen); the next save writes Mode and removes Windowed. - Fullscreen now also starts in the monitor's mode closest to the saved resolution. Before, Windowed=0 started borderless at the desktop size and only the Options toggle switched the monitor. - Borderless shares the desktop like a window: the cursor is not confined and the game keeps its frame rate without focus. - Mode switches apply at once on the window's current display; windowed resizes re-center on that display instead of the primary one.
A data-hint is drawn as one unwrapped line, so the Display mode row's hint ran wider than the legacy options window. A line break in a hint now starts a new line of the tooltip, and the Display mode hint breaks into three lines in every language that has it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Options window's "Windowed mode" checkbox becomes a Display mode row with three choices:
resolution. The monitor never changes mode, so Alt+Tab is instant and the mouse can leave for another monitor.
Every switch applies at once, on the display the window is on, and the game uses the size the window really got.
What changed
other rows use), with a hint explaining borderless vs fullscreen. In borderless the Resolution row shows the
desktop size, dimmed, and does not open: the resolution doesn't apply there. The resolution chosen for the other
modes is kept and comes back when you switch back.
[Window] Mode=Windowed|Borderless|Fullscreen(any case) replacesWindowed=0/1.Existing config.ini files keep working: without
Mode,Windowed=1is read as Windowed andWindowed=0asFullscreen; the next save writes
Modeand removesWindowed(only on save, so loading alone never loses thechoice).
config.ini.templatenow hasMode=Windowed.Windowed=0used to start borderless at the desktop size (the window was created withthe fullscreen flag but no display mode), and only the Options toggle switched the monitor. Fullscreen now starts in
the monitor mode closest to the saved resolution, like the toggle does.
frame rate when another window has the focus. Exclusive Fullscreen keeps the old behaviour.
SDL_WINDOWPOS_CENTERED_DISPLAY), not on theprimary display, so switching modes on a second monitor stays there.
(en, de, es, pt, pl, ru, uk; other languages fall back to English). The unused "Windowed mode" key is removed.
data-hintwas always one unwrapped line, which made the newrow's hint wider than the legacy options window. A line break in a hint now starts a new tooltip line, and the
Display mode hint is written as three lines in every language that has it (a translator comment says so). The
modern theme shows the same text in its wrapping tip box, where the line breaks are plain spaces.
docs/options-window.md(new "Display mode" section and the[Window]keys),docs/dev-editor.md,docs/build/linux/console.md.Window, UI and drawable sizes (#1079, #865 M4): nothing new is introduced there. Every mode change still settles
the window (
SDL_SyncWindow) and resizes the game to the logical window size SDL reports, the same sizeSDL_EVENT_WINDOW_RESIZEDcarries; UI scale and the RmlUi contexts reflow from it as for a resolution change. Themode is a per-config setting, so #1079's "each platform supplies the default window mode" (borderless at display size
on mobile) can be a platform default for
Modelater.Why borderless: presentation mode (PresentMon)
Measured with PresentMon 2.6 on Windows 10 22H2, RTX 4090, default backend (Vulkan, presented through DXGI), two
2560x1440 monitors (360 Hz and 144 Hz), HDR on, game window in front:
So borderless gets the same presentation path as exclusive fullscreen (no DWM composition, no extra frame of
latency) while keeping instant Alt+Tab and no monitor mode switch. Two notes:
our first try) DWM composes (
Composed: Flip), as for any borderless game.Composed: Flip;the same mode on the primary monitor and native 2560x1440 on the second were Independent Flip. That path (closest
display mode + fullscreen) is unchanged by this PR.
Also seen: exclusive Fullscreen minimizes itself when it loses the focus (SDL's default for exclusive mode);
borderless stays visible and keeps drawing.
What was run
tests/ui/test_ui_scaling.cpp):Modeparsing (any case, blanks, invalid values) and format round trip.Windowed=1/0withoutMode,Modewinning over a leftoverWindowed, the default.config.ini: an old file keeps its choice, loading alone leavesWindowedinplace, saving writes
Modeand removesWindowed, each mode survives save + reload and leaves Width/Height alone.config.ini.templatestarts withMode=Windowedand noWindowed.leftover
windowed_modebinding.ctest -C Release -E benchmark --schedule-random -j1:3241/3241 passed on the first commit, 3242/3242 with both commits.
test_item_database_files: 264/264 cases passed.windows-x64(player build),windows-x64-in-game-testsandwindows-x64-mueditor(the window-mode tests pass there too) on MSVC.git clang-format --diff origin/main -- '*.cpp' '*.h'(clang-format 21.1.8): clean.windows-x64-in-game-testsbuild, scripted through the control socket, window state readwith Win32
GetWindowRect/GetClientRect/window style/MonitorFromWindow, display modes withEnumDisplaySettings), on both 2560x1440 monitors:Fullscreen -> Borderless -> Fullscreen (native) on monitor 2: each time the window was frameless and exactly
covered that monitor in borderless/fullscreen, framed and centered on the same monitor in windowed; the game's
frame size matched the window's client size; the monitor's mode changed only in Fullscreen and was restored on
leaving it and on quitting.
Mode=Borderless,Mode=Fullscreenand an oldWindowed=0config (started exclusive at2560x1440 and was saved back as
Mode=FullscreenwithoutWindowed).restores the saved 1280x720.
mode; Wayland keeps not positioning windows).
Screenshots
From one build (
b08f85aaa), 2560x1440 unless stated.Fullscreen, Display tab
legacy
modern
Display mode list open
legacy
modern
Borderless: Resolution locked, row hint shown
legacy
modern
Windowed (1280x720)
legacy
modern
Notes on the shots (both are how the existing rows already behave):