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:
Eric Wasylishen 2022-06-07 02:01:27 -06:00 committed by Sam Lantinga
parent df36f926fc
commit ab81a559f4
16 changed files with 624 additions and 34 deletions

View file

@ -676,6 +676,7 @@ WIN_GL_CreateContext(_THIS, SDL_Window * window)
_this->GL_UnloadLibrary = WIN_GLES_UnloadLibrary;
_this->GL_CreateContext = WIN_GLES_CreateContext;
_this->GL_MakeCurrent = WIN_GLES_MakeCurrent;
_this->GL_GetDrawableSize = WIN_GLES_GetDrawableSize;
_this->GL_SetSwapInterval = WIN_GLES_SetSwapInterval;
_this->GL_GetSwapInterval = WIN_GLES_GetSwapInterval;
_this->GL_SwapWindow = WIN_GLES_SwapWindow;
@ -822,6 +823,12 @@ WIN_GL_MakeCurrent(_THIS, SDL_Window * window, SDL_GLContext context)
return 0;
}
void
WIN_GL_GetDrawableSize(_THIS, SDL_Window *window, int *w, int *h)
{
WIN_GetDrawableSize(window, w, h);
}
int
WIN_GL_SetSwapInterval(_THIS, int interval)
{