From 48d8caa6e5e6f2ea12f2eb3c25b21e08a38f66b9 Mon Sep 17 00:00:00 2001 From: Thorbjørn Lindeijer Date: Sat, 6 Apr 2024 16:12:44 +0200 Subject: Set Windows-related DPI hints to per-monitor aware v2 Set SDL_HINT_WINDOWS_DPI_AWARENESS to "permonitorv2", which tells Windows the application will handle all scaling. We don't currently adjust the window size when it changes monitors, but mainly use this hint to disable scaling by the system, since that blurs fonts and pixel art. Once we can properly handle fractional scaling (which is common on Windows), we can set SDL_HINT_WINDOWS_DPI_SCALING to "1" instead. --- src/client.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/client.cpp b/src/client.cpp index abd426ce..6fd73d4f 100644 --- a/src/client.cpp +++ b/src/client.cpp @@ -240,6 +240,10 @@ Client::Client(const Options &options): initScreenshotDir(); +#if SDL_VERSION_ATLEAST(2, 24, 0) + SDL_SetHint(SDL_HINT_WINDOWS_DPI_AWARENESS, "permonitorv2"); +#endif + // Initialize SDL logger->log("Initializing SDL..."); if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER) < 0) -- cgit v1.2.3-70-g09d2