mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-02-09 01:01:07 +00:00
sys_sdl_win.c: Call SetProcessDPIAware if available (Vista and above) to opt out of the OS scaling our window on a high-dpi display.
SDL (both 1.x and 2.x) is buggy and can't deal with scaled windows. But we'd probably want to call this anyway beause it give us full-resolution windows. git-svn-id: svn://svn.code.sf.net/p/quakespasm/code/trunk/quakespasm@1045 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
362deedf20
commit
2e23f6a3b5
1 changed files with 22 additions and 0 deletions
|
@ -172,10 +172,32 @@ static void Sys_GetBasedir (char *argv0, char *dst, size_t dstsize)
|
|||
}
|
||||
}
|
||||
|
||||
typedef BOOL(*SetProcessDPIAwareFunc)();
|
||||
|
||||
void Sys_SetDPIAware (void)
|
||||
{
|
||||
HMODULE hUser32;
|
||||
SetProcessDPIAwareFunc setDPIAware;
|
||||
|
||||
/* Neither SDL 1.2 nor SDL 2.0.3 can handle the OS scaling our window.
|
||||
(e.g. https://bugzilla.libsdl.org/show_bug.cgi?id=2713)
|
||||
Call SetProcessDPIAware() to opt out of scaling.
|
||||
*/
|
||||
|
||||
hUser32 = LoadLibraryA ("user32.dll");
|
||||
setDPIAware = (SetProcessDPIAwareFunc) GetProcAddress (hUser32, "SetProcessDPIAware");
|
||||
if (setDPIAware)
|
||||
setDPIAware ();
|
||||
|
||||
FreeLibrary (hUser32);
|
||||
}
|
||||
|
||||
void Sys_Init (void)
|
||||
{
|
||||
OSVERSIONINFO vinfo;
|
||||
|
||||
Sys_SetDPIAware ();
|
||||
|
||||
memset (cwd, 0, sizeof(cwd));
|
||||
Sys_GetBasedir(NULL, cwd, sizeof(cwd));
|
||||
host_parms->basedir = cwd;
|
||||
|
|
Loading…
Reference in a new issue