[fix] preserve Windows privacy startup and server window

This commit is contained in:
dijunkun
2026-09-13 01:23:30 +08:00
parent a6e325f190
commit 28e9626e0d
2 changed files with 11 additions and 4 deletions
@@ -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 ||
@@ -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) {