From 284ba3de65b06111149065053e2af8bf80ba73f8 Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Fri, 30 Oct 2026 12:15:36 -0400
Subject: [PATCH] win32: Only declare the context as DPI-unaware if the set
function succeeds
Otherwise, the flag can be true, even if setting the process to DPI unaware mode failed.
Fixes #16616
---
src/video/windows/SDL_windowsvideo.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/video/windows/SDL_windowsvideo.c b/src/video/windows/SDL_windowsvideo.c
index 30e4e5339553a..4f4b2c29bbf51 100644
--- a/src/video/windows/SDL_windowsvideo.c
+++ b/src/video/windows/SDL_windowsvideo.c
@@ -473,8 +473,10 @@ static BOOL WIN_DeclareDPIAwareUnaware(SDL_VideoDevice *_this)
SDL_VideoData *data = _this->internal;
if (data->SetProcessDpiAwarenessContext) {
- data->dpi_unaware_context_declared = true;
- return data->SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE);
+ if (data->SetProcessDpiAwarenessContext(DPI_AWARENESS_CONTEXT_UNAWARE)) {
+ data->dpi_unaware_context_declared = true;
+ return TRUE;
+ }
} else if (data->SetProcessDpiAwareness) {
// Windows 8.1
return SUCCEEDED(data->SetProcessDpiAwareness(PROCESS_DPI_UNAWARE));