Preserve the picture aspect in bordered windows #3378

Open
github-bot wants to merge 1 commit from github-bot/gh-3378 into main AGit
Owner

@⁠Kitrae on GitHub · 2026-11-29 22:28 UTC · original
Kitrae:fix/windowed-client-aspect → main · +106 −1 · 1 files · 1 commits · open

Fixes #3366.

What it changes

The title asks for its picture dimensions when it creates the window. Win32 uses those dimensions for the outer window, so the caption and borders make the game area proportionally wider. DXGI then scales the 16:9 swap chain to that area.

Measure the actual frame after creating the window and reserve its space before fitting the client area. The monitor work area and VICTORY_WINDOW_MAX bound the outer window. The swap chain keeps its existing dimensions.

How it was tested

  • On Windows 11, a hidden WS_OVERLAPPEDWINDOW requested at 1920×1080 had a 1904×1041 client area before accounting for the frame.
  • The regression test creates a real bordered Win32 window and verifies an exact 640×360 client area. Geometry tests cover a full 1920×1080 client area, a shorter work area, and a configured window limit.
  • All 17 lifecycle tests passed with cargo test --locked -p victory-hle --lib modules::lifecycle::tests -- --test-threads=1. The tests used synthetic windows and geometry.
  • git diff --check and the staged asset-policy check passed.

Checked for overlap

  • Searched open pull requests for #3366 and windowed aspect-ratio fixes. Related: #132 added aspect fitting for borderless fullscreen.

AI-assisted contribution using OpenAI Codex.

**@⁠Kitrae** on GitHub · 2026-11-29 22:28 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3378) `Kitrae:fix/windowed-client-aspect` → `main` · +106 −1 · 1 files · 1 commits · open Fixes #3366. ## What it changes The title asks for its picture dimensions when it creates the window. Win32 uses those dimensions for the outer window, so the caption and borders make the game area proportionally wider. DXGI then scales the 16:9 swap chain to that area. Measure the actual frame after creating the window and reserve its space before fitting the client area. The monitor work area and `VICTORY_WINDOW_MAX` bound the outer window. The swap chain keeps its existing dimensions. ## How it was tested - On Windows 11, a hidden `WS_OVERLAPPEDWINDOW` requested at 1920×1080 had a 1904×1041 client area before accounting for the frame. - The regression test creates a real bordered Win32 window and verifies an exact 640×360 client area. Geometry tests cover a full 1920×1080 client area, a shorter work area, and a configured window limit. - All 17 lifecycle tests passed with `cargo test --locked -p victory-hle --lib modules::lifecycle::tests -- --test-threads=1`. The tests used synthetic windows and geometry. - `git diff --check` and the staged asset-policy check passed. ## Checked for overlap - [x] Searched open pull requests for #3366 and windowed aspect-ratio fixes. Related: #132 added aspect fitting for borderless fullscreen. AI-assisted contribution using OpenAI Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-29 22:29:40 +00:00
Author
Owner

@⁠andrewpozdnakov7-jpg on GitHub · 2026-11-30 07:07 UTC · original

I reproduced the aspect mismatch through Victory's actual Win32 window creation path on Windows. The fixture creates an invisible bordered window with VICTORY_FULLSCREEN=0, requests 1920x1080, then measures both rectangles. The current release v2026.11.29.05 and main are both 41adb551. The original #3378 patch at 7cdc884 applied cleanly as 3cce0cf.

Window limit Current release client / outer With #3378 client / outer
Monitor work area 1832x1001 / 1848x1040 1779x1001 / 1795x1040
VICTORY_WINDOW_MAX=900x500 872x461 / 888x500 819x461 / 835x500

Both current-release runs fail the 16:9 assertion. Both patched runs preserve 16:9 within one pixel and respect the outer bounds. On Windows with Rust 1.98.1/MSVC, the lifecycle suite passed 15 tests on main and 17 with #3378, including both tests added by the PR. The fixture needs no title data.

@⁠jim139129, could you repeat your bordered-window setup on v2026.11.29.05 and on a build with #3378 applied, using the same DLSS and frame-generation settings? A live client rectangle and whether the image still looks stretched are enough. This verifies the initial window size. Original report

AI-assisted with OpenAI Codex.

**@⁠andrewpozdnakov7-jpg** on GitHub · 2026-11-30 07:07 UTC · [original](https://github.com/trustno1-coder/VIctory-NVIDIA/pull/3378#issuecomment-7271380218) I reproduced the aspect mismatch through Victory's actual Win32 window creation path on Windows. The fixture creates an invisible bordered window with `VICTORY_FULLSCREEN=0`, requests 1920x1080, then measures both rectangles. The current release `v2026.11.29.05` and main are both `41adb551`. The original #3378 patch at `7cdc884` applied cleanly as `3cce0cf`. | Window limit | Current release client / outer | With #3378 client / outer | | --- | --- | --- | | Monitor work area | 1832x1001 / 1848x1040 | 1779x1001 / 1795x1040 | | `VICTORY_WINDOW_MAX=900x500` | 872x461 / 888x500 | 819x461 / 835x500 | Both current-release runs fail the 16:9 assertion. Both patched runs preserve 16:9 within one pixel and respect the outer bounds. On Windows with Rust 1.98.1/MSVC, the lifecycle suite passed 15 tests on main and 17 with #3378, including both tests added by the PR. The fixture needs no title data. @⁠jim139129, could you repeat your bordered-window setup on `v2026.11.29.05` and on a build with #3378 applied, using the same DLSS and frame-generation settings? A live client rectangle and whether the image still looks stretched are enough. This verifies the initial window size. [Original report](https://git.gtahub.st/github/trustno1-coder--VIctory-NVIDIA/issues/3366) AI-assisted with OpenAI Codex.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/3378/head:github-bot/gh-3378'
git switch 'github-bot/gh-3378'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-3378'
git switch 'github-bot/gh-3378'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-3378'
git switch 'github-bot/gh-3378'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-3378'
git switch 'main'
git merge --squash 'github-bot/gh-3378'
git switch 'main'
git merge --ff-only 'github-bot/gh-3378'
git switch 'main'
git merge 'github-bot/gh-3378'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/trustno1-coder--VIctory-NVIDIA!3378
No description provided.