Try to fix Windows DPI issue

This commit is contained in:
def 2017-07-09 09:24:08 +02:00
parent a8b2bb599f
commit 2a1bf93165

View file

@ -4,6 +4,7 @@
// For FlashWindowEx, FLASHWINFO, FLASHW_TRAY // For FlashWindowEx, FLASHWINFO, FLASHW_TRAY
#define _WIN32_WINNT 0x0501 #define _WIN32_WINNT 0x0501
#define WINVER 0x0501 #define WINVER 0x0501
#include <ShellScalingAPI.h>
#endif #endif
#include <base/detect.h> #include <base/detect.h>
@ -622,9 +623,19 @@ int CGraphicsBackend_SDL_OpenGL::Init(const char *pName, int *Screen, int *pWidt
} }
if(Flags&IGraphicsBackend::INITFLAG_HIGHDPI) if(Flags&IGraphicsBackend::INITFLAG_HIGHDPI)
{
SdlFlags |= SDL_WINDOW_ALLOW_HIGHDPI; SdlFlags |= SDL_WINDOW_ALLOW_HIGHDPI;
#ifdef CONF_FAMILY_WINDOWS
SetProcessDpiAwareness(PROCESS_SYSTEM_DPI_AWARE);
#endif
}
else else
{
SDL_SetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED, "1"); SDL_SetHint(SDL_HINT_VIDEO_HIGHDPI_DISABLED, "1");
#ifdef CONF_FAMILY_WINDOWS
SetProcessDpiAwareness(PROCESS_DPI_UNAWARE);
#endif
}
// set gl attributes // set gl attributes
SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1); SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);