Skip to content

Commit eef15bb

Browse files
committed
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. Remove the Settings-based persistence of the warning acknowledgment. Fixes #3621 Assisted-by: Claude (Anthropic)
1 parent ef6e5db commit eef15bb

1 file changed

Lines changed: 10 additions & 15 deletions

File tree

src/platform/win/winplatform.cpp

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
#include "app/applicationexceptionhandler.h"
44
#include "common/log.h"
5-
#include "common/settings.h"
65

76
#include "platform/dummy/dummyclipboard.h"
87
#include "winplatform.h"
@@ -298,26 +297,22 @@ bool WinPlatform::setPreventScreenCapture(WId winId, bool prevent)
298297
// Remote desktop clients are screen capture systems — applying
299298
// WDA_EXCLUDEFROMCAPTURE makes windows invisible to the remote viewer.
300299
if (prevent && GetSystemMetrics(SM_REMOTESESSION)) {
300+
if (!SetWindowDisplayAffinity(window, WDA_NONE))
301+
log("Failed to clear display affinity in remote session", LogWarning);
302+
301303
static bool logged = false;
302304
if (!logged) {
303305
logged = true;
304306
log("Skipping screen capture prevention in remote desktop session", LogWarning);
305-
306-
const QLatin1String optionKey("Options/screen_capture_warning_acknowledged");
307-
Settings settings;
308-
if (!settings.value(optionKey, false).toBool()) {
309-
QMessageBox::warning(
310-
nullptr,
311-
QObject::tr("Screen Capture Prevention Unavailable"),
312-
QObject::tr(
313-
"The option to hide from screenshots is enabled but cannot"
314-
" take effect in a remote desktop session. Window content"
315-
" may be visible to screen capture."));
316-
settings.setValue(optionKey, true);
317-
}
307+
QMessageBox::warning(
308+
nullptr,
309+
QObject::tr("Screen Capture Prevention Unavailable"),
310+
QObject::tr(
311+
"The option to hide from screenshots is enabled but cannot"
312+
" take effect in a remote desktop session. Window content"
313+
" may be visible to screen capture."));
318314
}
319315

320-
SetWindowDisplayAffinity(window, WDA_NONE);
321316
return false;
322317
}
323318

0 commit comments

Comments
 (0)