mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-15 17:28:28 +00:00
Windows DPI scaling/highdpi support
Adds hint "SDL_WINDOWS_DPI_SCALING" which can be set to "1" to change the SDL coordinate system units to be DPI-scaled points, rather than pixels everywhere. This means windows will be appropriately sized, even when created on high-DPI displays with scaling. e.g. requesting a 640x480 window from SDL, on a display with 125% scaling in Windows display settings, will create a window with an 800x600 client area (in pixels). Setting this to "1" implicitly requests process DPI awareness (setting SDL_WINDOWS_DPI_AWARENESS is unnecessary), and forces SDL_WINDOW_ALLOW_HIGHDPI on all windows.
This commit is contained in:
parent
df36f926fc
commit
ab81a559f4
16 changed files with 624 additions and 34 deletions
|
@ -1838,6 +1838,27 @@ extern "C" {
|
|||
*/
|
||||
#define SDL_HINT_WINDOWS_DPI_AWARENESS "SDL_WINDOWS_DPI_AWARENESS"
|
||||
|
||||
/**
|
||||
* \brief Uses DPI-scaled points as the SDL coordinate system on Windows.
|
||||
*
|
||||
* This changes the SDL coordinate system units to be DPI-scaled points, rather than pixels everywhere.
|
||||
* This means windows will be appropriately sized, even when created on high-DPI displays with scaling.
|
||||
*
|
||||
* e.g. requesting a 640x480 window from SDL, on a display with 125% scaling in Windows display settings,
|
||||
* will create a window with an 800x600 client area (in pixels).
|
||||
*
|
||||
* Setting this to "1" implicitly requests process DPI awareness (setting SDL_WINDOWS_DPI_AWARENESS is unnecessary),
|
||||
* and forces SDL_WINDOW_ALLOW_HIGHDPI on all windows.
|
||||
*
|
||||
* This variable can be set to the following values:
|
||||
* "0" - SDL coordinates equal Windows coordinates. No automatic window resizing when dragging
|
||||
* between monitors with different scale factors (unless this is performed by
|
||||
* Windows itself, which is the case when the process is DPI unaware).
|
||||
* "1" - SDL coordinates are in DPI-scaled points. Automatically resize windows as needed on
|
||||
* displays with non-100% scale factors.
|
||||
*/
|
||||
#define SDL_HINT_WINDOWS_DPI_SCALING "SDL_WINDOWS_DPI_SCALING"
|
||||
|
||||
/**
|
||||
* \brief A variable controlling whether the window frame and title bar are interactive when the cursor is hidden
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue