From 6fbc454b6f04ab8cdee3400f882fb96150a2aebc Mon Sep 17 00:00:00 2001 From: Lukas Holecek Date: Tue, 2 Jun 2026 12:08:11 +0000 Subject: [PATCH] Windows: Fix blank window in RDP sessions Clear the window display affinity before showing the warning dialog so the window is visible during the dialog's nested event loop. Fixes #3621 Assisted-by: Claude (Anthropic) --- src/platform/win/winplatform.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/platform/win/winplatform.cpp b/src/platform/win/winplatform.cpp index 1cee8a72ea..40a9f16c9b 100644 --- a/src/platform/win/winplatform.cpp +++ b/src/platform/win/winplatform.cpp @@ -298,6 +298,9 @@ bool WinPlatform::setPreventScreenCapture(WId winId, bool prevent) // Remote desktop clients are screen capture systems — applying // WDA_EXCLUDEFROMCAPTURE makes windows invisible to the remote viewer. if (prevent && GetSystemMetrics(SM_REMOTESESSION)) { + if (!SetWindowDisplayAffinity(window, WDA_NONE)) + log("Failed to clear display affinity in remote session", LogWarning); + static bool logged = false; if (!logged) { logged = true; @@ -317,7 +320,6 @@ bool WinPlatform::setPreventScreenCapture(WId winId, bool prevent) } } - SetWindowDisplayAffinity(window, WDA_NONE); return false; }