From 28e9626e0db12c71f657c86ae84856234c0bebe1 Mon Sep 17 00:00:00 2001 From: dijunkun Date: Sun, 13 Sep 2026 01:23:30 +0800 Subject: [PATCH] [fix] preserve Windows privacy startup and server window --- apps/desktop/src/gui/application/gui_application.cpp | 7 ++++--- apps/desktop/src/privacy/privacy_controller.cpp | 8 +++++++- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/apps/desktop/src/gui/application/gui_application.cpp b/apps/desktop/src/gui/application/gui_application.cpp index bce17067..2d7d5c65 100644 --- a/apps/desktop/src/gui/application/gui_application.cpp +++ b/apps/desktop/src/gui/application/gui_application.cpp @@ -2819,10 +2819,11 @@ void GuiApplication::SyncServerWindow() { }); } - // macOS covers the local panel with capture-excluded privacy windows. Keep - // the panel alive so remote controllers can still see and operate it. + // Windows and macOS cover the local panel with capture-excluded privacy + // windows. Keep the panel alive throughout privacy transitions so remote + // controllers can still see and operate it without resetting its UI state. bool show_controller_window = has_connected_controller; -#if !defined(__APPLE__) +#if !defined(_WIN32) && !defined(__APPLE__) // Preserve the existing panel behavior on other platforms. const auto privacy_status = privacy_.Snapshot(); const bool privacy_covering = privacy_status.overlay_active || diff --git a/apps/desktop/src/privacy/privacy_controller.cpp b/apps/desktop/src/privacy/privacy_controller.cpp index 09474c4c..1353b21e 100644 --- a/apps/desktop/src/privacy/privacy_controller.cpp +++ b/apps/desktop/src/privacy/privacy_controller.cpp @@ -105,8 +105,14 @@ void PrivacyController::Fail(const std::string& reason) { } void PrivacyController::CaptureChanged(bool running) { std::lock_guard lock(mutex_); + // Windows announces a stopped capture while preparing the first session. + // Keep automatic privacy pending until capture starts, within its deadline. + // Once capture was running or backend enable began, a stop remains a fault. + const bool waiting_for_initial_capture = + automatic_enable_ && enable_pending_ && !capture_running_; capture_running_ = running; - if (!running) FailLocked("Capture changed; privacy screen is being turned off"); + if (!running && !waiting_for_initial_capture) + FailLocked("Capture changed; privacy screen is being turned off"); WakeLocked(); } void PrivacyController::Run(Factory factory) {