aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2019-07-27 17:48:16 +0200
committerDavid Robillard <d@drobilla.net>2019-07-29 01:58:44 +0200
commit78ae4dee1edf91679b155e770bdaad68fbee8bfa (patch)
treee1013b9632b35d17c27bcc5642bc5f57449b1ca2
parent39553be4dd02773a7d71eaab63efbf5c76f5e9d2 (diff)
downloadpugl-78ae4dee1edf91679b155e770bdaad68fbee8bfa.tar.gz
pugl-78ae4dee1edf91679b155e770bdaad68fbee8bfa.tar.bz2
pugl-78ae4dee1edf91679b155e770bdaad68fbee8bfa.zip
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.
-rw-r--r--pugl/pugl_win.c12
1 files changed, 12 insertions, 0 deletions
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;