Skip to content

feat(window): add borderless fullscreen as a third display mode - #1135

Open
ezequielzacca wants to merge 2 commits into
sven-n:mainfrom
ezequielzacca:feat/borderless-fullscreen
Open

ezequielzacca wants to merge 2 commits into
sven-n:mainfrom
ezequielzacca:feat/borderless-fullscreen

Conversation

@ezequielzacca

@ezequielzacca ezequielzacca commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Options window's "Windowed mode" checkbox becomes a Display mode row with three choices:

  • Windowed: a framed window at the chosen resolution (as before).
  • Borderless fullscreen (new): a frameless window that covers the display the game is on, at the desktop's
    resolution. The monitor never changes mode, so Alt+Tab is instant and the mouse can leave for another monitor.
  • Fullscreen: the monitor switches to the chosen resolution (exclusive, as the old unchecked box did).

Every switch applies at once, on the display the window is on, and the game uses the size the window really got.

What changed

  • Options (legacy and modern themes): the checkbox row is now a dropdown row (the same custom dropdown the
    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.
  • config.ini: [Window] Mode=Windowed|Borderless|Fullscreen (any case) replaces Windowed=0/1.
    Existing config.ini files keep working: without Mode, Windowed=1 is read as Windowed and Windowed=0 as
    Fullscreen; the next save writes Mode and removes Windowed (only on save, so loading alone never loses the
    choice). config.ini.template now has Mode=Windowed.
  • Fullscreen at startup: Windowed=0 used to start borderless at the desktop size (the window was created with
    the 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.
  • Borderless behaves like a window for the legacy flags: the cursor is not confined to it and the game keeps its
    frame rate when another window has the focus. Exclusive Fullscreen keeps the old behaviour.
  • Windowed resizes re-center on the window's current display (SDL_WINDOWPOS_CENTERED_DISPLAY), not on the
    primary display, so switching modes on a second monitor stays there.
  • Translations: new keys Display mode, Windowed, Borderless fullscreen, Fullscreen, Display mode tooltip
    (en, de, es, pt, pl, ru, uk; other languages fall back to English). The unused "Windowed mode" key is removed.
  • Editor: the Graphics tab's window-mode readout shows the three modes.
  • Hints with line breaks (second commit): a data-hint was always one unwrapped line, which made the new
    row'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: 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 size
SDL_EVENT_WINDOW_RESIZED carries; UI scale and the RmlUi contexts reflow from it as for a resolution change. The
mode 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 Mode later.

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:

Mode Monitor PresentMode
Borderless fullscreen 1 (360 Hz) Hardware: Independent Flip (2871/2871 presents)
Borderless fullscreen 2 (144 Hz) Hardware: Independent Flip (1150/1150)
Borderless, started in borderless 1 Hardware: Independent Flip
Fullscreen 2560x1440 (native) 1 and 2 Hardware: Independent Flip
Fullscreen 1280x720 1 Hardware: Independent Flip
Windowed 1280x720 1 Composed: Flip

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:

  • Independent Flip needs the game in front: with another window over it (an Explorer window on the same monitor in
    our first try) DWM composes (Composed: Flip), as for any borderless game.
  • Exclusive Fullscreen at a non-native resolution (1280x720) on the second monitor measured 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

  • Unit tests (new, tests/ui/test_ui_scaling.cpp):
    • Mode parsing (any case, blanks, invalid values) and format round trip.
    • Legacy fallback: Windowed=1/0 without Mode, Mode winning over a leftover Windowed, the default.
    • Load/save round trip through config.ini: an old file keeps its choice, loading alone leaves Windowed in
      place, saving writes Mode and removes Windowed, each mode survives save + reload and leaves Width/Height alone.
    • config.ini.template starts with Mode=Windowed and no Windowed.
    • The Display mode row's choices and order, and that only borderless locks the Resolution row.
    • Both option-window themes bind the new row (dropdown 9, labels, tooltip) and lock the Resolution row, with no
      leftover windowed_mode binding.
    • A document hint splits into lines at each line break.
  • Full suite, serially in random order: 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.
  • Builds: windows-x64 (player build), windows-x64-in-game-tests and windows-x64-mueditor (the window-mode tests pass there too) on MSVC.
  • Format: git clang-format --diff origin/main -- '*.cpp' '*.h' (clang-format 21.1.8): clean.
  • In game (Windows, windows-x64-in-game-tests build, scripted through the control socket, window state read
    with Win32 GetWindowRect/GetClientRect/window style/MonitorFromWindow, display modes with
    EnumDisplaySettings), on both 2560x1440 monitors:
    • Windowed -> Borderless -> Fullscreen -> Windowed on monitor 1, and Windowed -> Borderless -> Windowed ->
      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.
    • Startup with Mode=Borderless, Mode=Fullscreen and an old Windowed=0 config (started exclusive at
      2560x1440 and was saved back as Mode=Fullscreen without Windowed).
    • The Resolution row in borderless shows 2560 x 1440, dimmed, and ignores clicks; switching back to Windowed
      restores the saved 1280x720.
    • Borderless keeps drawing when another window has the focus.
  • Not run: Linux/macOS (no SDL calls changed besides the display passed to the centering and the startup display
    mode; Wayland keeps not positioning windows).

Screenshots

From one build (b08f85aaa), 2560x1440 unless stated.

Fullscreen, Display tab

legacy

legacy: Fullscreen, Display tab

modern

modern: Fullscreen, Display tab

Display mode list open

legacy

legacy: Display mode list open

modern

modern: Display mode list open

Borderless: Resolution locked, row hint shown

legacy

legacy: Borderless: Resolution locked, row hint shown

modern

modern: Borderless: Resolution locked, row hint shown

Windowed (1280x720)

legacy

legacy: Windowed (1280x720)

modern

modern: Windowed (1280x720)

Notes on the shots (both are how the existing rows already behave):

  • Hints cover a neighbouring row while shown. The legacy theme draws a row's hint just above the hovered row (the UI Scale hint covers the FPS Limit box the same way); the modern theme draws it in a box under the row (the Anti-aliasing hint covers the Anisotropic filtering label the same way). The modern Display mode tip hides while its list is open, since that list opens over the same place.
  • A short open list ends partway over the next row. The legacy list is opaque and drawn on top, but its fill and border match the value boxes, so the box below it (FPS Limit's "Uncapped") can read as one more entry. Upstream's UI Theme list (three entries) does the same over the S6 player models row. This PR does not change the dropdown styling.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant