Skip to content

Apply display scale before sizing the startup window - #797

Open
csfreitas wants to merge 2 commits into
bvschaik:masterfrom
csfreitas:fix/728-startup-display-scale
Open

Apply display scale before sizing the startup window#797
csfreitas wants to merge 2 commits into
bvschaik:masterfrom
csfreitas:fix/728-startup-display-scale

Conversation

@csfreitas

@csfreitas csfreitas commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Related issue: #728

What was going wrong?

Starting Julius with --display-scale 1.5 and a saved window size of 640x480 could still open a 640x480 window at 100% scale, instead of the expected 960x720 window at 150%.

The window dimensions were calculated before the requested scale took effect. When recreating the window, the previous scale could also affect its new size.

What this changes

The requested scale is now applied before calculating the startup window size, using the selected display's available space.

  • Keep the window within the available display area, including when the saved window size or requested scale is too large.
  • Use the validated display selection when looking up the desktop mode.
  • Initialize rendering with the actual window dimensions reported by SDL.

Testing

Added a regression test using SDL's dummy video driver. It covers 50%, 100% and 150% scaling, repeated window creation, oversized saved windows, excessive scale, and invalid display selection.

  • Before the fix: five of the eight checks fail against the unchanged upstream code.
  • With the fix: all eight checks pass, along with the full 37-test CTest suite, locally on Windows with Visual Studio 2022 and SDL 2.32.8.
  • Windows test builds also copy the SDL runtime beside the test executable so it can run without a custom DLL search path.

Relation to #728

This fixes a reproducible startup scaling problem related to #728. I have not reproduced the original reporter's exact 4K setup, so I am not claiming that this resolves the entire issue.

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