summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Faye-Lund <erik.faye-lund@collabora.com>2020-04-08 19:28:57 +0200
committerErik Faye-Lund <erik.faye-lund@collabora.com>2020-04-16 11:10:47 +0200
commit7fa3a4335154753973ee7f0d1efd5e40a93e454d (patch)
treeb2410525fbf7d84894b715040b9825993846c4a3
parent16c9a13065686fa68c0b384076faea5544b3f6a6 (diff)
wglgears: mark application as dpi-aware
This makes rendering nice and crisp on high-dpi systems. Since we're not doing any layouting or anything, we can just claim to be aware without doing much. We keep the current window-size when the DPI changes, because the size is specified in pixels, so it seems more useful to keep that as-is. Reviewed-by: Brian Paul <brianp@vmware.com>
-rw-r--r--src/wgl/wglgears.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/wgl/wglgears.c b/src/wgl/wglgears.c
index 2ae9e073..0b7ea519 100644
--- a/src/wgl/wglgears.c
+++ b/src/wgl/wglgears.c
@@ -341,6 +341,11 @@ WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
else if (wParam == VK_ESCAPE)
PostQuitMessage(0);
return 0;
+#if WINVER >= 0x0605
+ case WM_NCCREATE:
+ EnableNonClientDpiScaling(hWnd);
+ break;
+#endif
}
return DefWindowProc(hWnd, uMsg, wParam, lParam);
@@ -376,6 +381,10 @@ make_window(const char *name, int x, int y, int width, int height)
0, 0, 0
};
+#if WINVER >= 0x0605
+ SetThreadDpiAwarenessContext(DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE);
+#endif
+
winrect.left = (long)0;
winrect.right = (long)width;
winrect.top = (long) 0;