mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2024-11-10 07:21:58 +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+ssh://svn.code.sf.net/p/quakespasm/code/trunk@1045 af15c1b1-3010-417e-b628-4374ebc0bcbd
This commit is contained in:
parent
a9d1910762
commit
da5de52f1f
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)
|
void Sys_Init (void)
|
||||||
{
|
{
|
||||||
OSVERSIONINFO vinfo;
|
OSVERSIONINFO vinfo;
|
||||||
|
|
||||||
|
Sys_SetDPIAware ();
|
||||||
|
|
||||||
memset (cwd, 0, sizeof(cwd));
|
memset (cwd, 0, sizeof(cwd));
|
||||||
Sys_GetBasedir(NULL, cwd, sizeof(cwd));
|
Sys_GetBasedir(NULL, cwd, sizeof(cwd));
|
||||||
host_parms->basedir = cwd;
|
host_parms->basedir = cwd;
|
||||||
|
|
Loading…
Reference in a new issue