From 78ae4dee1edf91679b155e770bdaad68fbee8bfa Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sat, 27 Jul 2019 17:48:16 +0200 Subject: Windows: Disable DPI scaling This is probably not ultimately the right thing, especially without a DPI/scaling access API, but it makes the horrible default fuzziness go away. --- pugl/pugl_win.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'pugl') diff --git a/pugl/pugl_win.c b/pugl/pugl_win.c index ac1993e..c4c7187 100644 --- a/pugl/pugl_win.c +++ b/pugl/pugl_win.c @@ -53,6 +53,8 @@ #define PUGL_RESIZE_TIMER_ID 9461 #define PUGL_URGENT_TIMER_ID 9462 +typedef BOOL (WINAPI *PFN_SetProcessDPIAware)(void); + static const TCHAR* DEFAULT_CLASSNAME = "Pugl"; LRESULT CALLBACK @@ -63,6 +65,16 @@ puglInitInternals(void) { PuglInternals* impl = (PuglInternals*)calloc(1, sizeof(PuglInternals)); + HMODULE user32 = LoadLibrary("user32.dll"); + if (user32) { + PFN_SetProcessDPIAware SetProcessDPIAware = + (PFN_SetProcessDPIAware)GetProcAddress( + user32, "SetProcessDPIAware"); + if (SetProcessDPIAware) { + SetProcessDPIAware(); + } + } + LARGE_INTEGER frequency; QueryPerformanceFrequency(&frequency); impl->timerFrequency = (double)frequency.QuadPart; -- cgit v1.2.1