diff --git a/AGENTS.md b/AGENTS.md index 2b4789d..2c081bc 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -63,8 +63,10 @@ Audience outputs must never show operator notes, source paths or general operato dialogs/controls. The user-authorized exception is minimal startup display-swap and timed Keep/Revert recovery controls; disable the startup menu after explicit navigation/show and never send presenter content to implement this exception. Show presentation output automatically on startup/document open by default, with a -saved opt-out. Preserve manual blanking during navigation; topology changes and host -failure recovery still blank explicitly and must show an unmistakable operator warning. +saved opt-out. Preserve the operator’s output visibility during navigation, fullscreen/routing +changes, topology changes and host recovery. Only explicit blank controls should +blank output; diagnostic messages must not change visibility. Report unavailable +outputs clearly while retaining operator-content privacy protections. Display disconnects must not move operator content onto an audience output. Never claim physical multiscreen acceptance from headless unit tests. diff --git a/Cargo.lock b/Cargo.lock index be5f493..333bbd4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2221,7 +2221,7 @@ dependencies = [ [[package]] name = "pdf-presenter" -version = "0.1.50" +version = "0.1.51" dependencies = [ "bytemuck", "chrono", diff --git a/Cargo.toml b/Cargo.toml index c738acd..700de65 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ default-members = ["crates/pdf-presenter"] resolver = "3" [workspace.package] -version = "0.1.50" +version = "0.1.51" edition = "2024" license = "MIT" repository = "https://proxy.dandaedre.com/gitea/idle-org/pdf-presenter" diff --git a/crates/pdf-presenter/src/localization.rs b/crates/pdf-presenter/src/localization.rs index 5b71843..dab0984 100644 --- a/crates/pdf-presenter/src/localization.rs +++ b/crates/pdf-presenter/src/localization.rs @@ -117,8 +117,8 @@ pub fn tr<'a>(ctx: &egui::Context, text: &'a str) -> &'a str { "Presenter fullscreen" => "Présentateur en plein écran", "Presentation fullscreen" => "Présentation en plein écran", "Apply and remember" => "Appliquer et mémoriser", - "Applying a setup blanks output. Show when destinations are verified." => { - "Appliquer masque la sortie. Vérifiez les destinations avant de la réactiver." + "Output visibility is preserved while previewing display changes." => { + "La visibilité de la sortie est conservée pendant l’aperçu des changements." } "Open a PDF or picture folder to browse slides." => { "Ouvrez un PDF ou un dossier d’images pour parcourir les diapositives." diff --git a/crates/pdf-presenter/src/native.rs b/crates/pdf-presenter/src/native.rs index 772649d..31b88a9 100644 --- a/crates/pdf-presenter/src/native.rs +++ b/crates/pdf-presenter/src/native.rs @@ -477,7 +477,6 @@ impl App { } } if changed && let Some(host) = &mut self.host { - host.state.blanked = true; host.presented.clear(); for w in &self.windows { if !self.handles.iter().any(|(m, _)| m.id == w.monitor) { @@ -582,6 +581,7 @@ impl App { h.state.blanked = true; h.close_requested = matches!(key, Key::Named(NamedKey::Escape)); let _ = h.acks.try_send(Ack { + request_blank: true, status: "Presentation blanked from output keyboard.".into(), ..Default::default() }); @@ -726,6 +726,9 @@ impl App { if !ack.status.is_empty() { s.status = ack.status; s.output_buffered = 0; + s.new_output = true; + } + if ack.request_blank { s.blanked = true; s.new_output = true; } @@ -993,6 +996,7 @@ impl ApplicationHandler for App { h.close_requested = true; h.state.blanked = true; let _ = h.acks.try_send(Ack { + request_blank: true, status: "Presentation blanked from output window.".into(), ..Default::default() }); diff --git a/crates/pdf-presenter/src/output.rs b/crates/pdf-presenter/src/output.rs index 98bf1a9..e305e97 100644 --- a/crates/pdf-presenter/src/output.rs +++ b/crates/pdf-presenter/src/output.rs @@ -44,6 +44,9 @@ pub struct HostState { } #[derive(Clone, Default, Debug, Serialize, Deserialize)] pub struct Ack { + /// Explicit operator blanking, separate from diagnostic status messages. + #[serde(default)] + pub request_blank: bool, #[serde(default)] pub display_action: Option, #[serde(default)] @@ -151,8 +154,13 @@ impl OutputLink { std::thread::sleep(Duration::from_millis(4)); } terminate_output(&managed_child); - let _=results.try_send(Ack{status:"Presentation host stopped. Output will restart blanked; review screens before resuming.".into(),..Default::default()}); - // Restart receives a fresh state from the presenter; never silently resume output. + let _ = results.try_send(Ack { + status: + "Presentation host stopped. Restarting with the current output visibility." + .into(), + ..Default::default() + }); + // Restart receives fresh routes, frame and visibility from the presenter. drop(last); std::thread::sleep(Duration::from_millis(250)); } diff --git a/crates/pdf-presenter/src/presenter_ui.rs b/crates/pdf-presenter/src/presenter_ui.rs index 4555a0b..f03231f 100644 --- a/crates/pdf-presenter/src/presenter_ui.rs +++ b/crates/pdf-presenter/src/presenter_ui.rs @@ -1272,7 +1272,7 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) { ); ui.small(tr( &locale, - "Applying a setup blanks output. Show when destinations are verified.", + "Output visibility is preserved while previewing display changes.", )); if !s.draft_presenter_fullscreen || !s.draft_presentation_fullscreen { ui.colored_label( diff --git a/crates/pdf-presenter/src/studio.rs b/crates/pdf-presenter/src/studio.rs index ec8ee67..6fd142f 100644 --- a/crates/pdf-presenter/src/studio.rs +++ b/crates/pdf-presenter/src/studio.rs @@ -259,10 +259,12 @@ impl Studio { self.privacy_hold = recovering && self.routes.presenter.is_empty(); self.draft_routes = self.routes.clone(); self.dirty_routes = true; - self.blanked = recovering || !self.settings.auto_show; + if !recovering { + self.blanked = !self.settings.auto_show; + } self.new_output = true; self.status = if recovering { - "Screen setup changed. Output blanked; review destinations before showing." + "Screen setup changed. Output visibility preserved; review destinations." } else { "Screen setup ready." } @@ -331,9 +333,6 @@ impl Studio { } } Action::Blank => { - if self.route_trial.is_some() { - return; - } self.blanked = !self.blanked; if !self.blanked { self.presentation_started = true; @@ -401,7 +400,6 @@ impl Studio { self.routes = self.draft_routes.clone(); self.dirty_routes = true; self.displays_open = false; - self.blanked = true; self.new_output = true; } } @@ -417,8 +415,7 @@ impl Studio { self.settings.presentation_fullscreen = trial.presentation_fullscreen; self.pending_save = true; self.new_output = true; - self.status = - "Display setup confirmed. Output remains blank until shown.".into(); + self.status = "Display setup confirmed. Output visibility preserved.".into(); } } Action::RevertRoutes => { @@ -427,10 +424,8 @@ impl Studio { self.begin_display_edit(); self.displays_open = false; self.dirty_routes = true; - self.blanked = true; self.new_output = true; - self.status = - "Display change reverted. Output remains blank until shown.".into(); + self.status = "Display change reverted. Output visibility preserved.".into(); } } Action::OpenBrowser => { diff --git a/crates/pdf-presenter/tests/presenter_ui.rs b/crates/pdf-presenter/tests/presenter_ui.rs index db511a7..599a47e 100644 --- a/crates/pdf-presenter/tests/presenter_ui.rs +++ b/crates/pdf-presenter/tests/presenter_ui.rs @@ -140,14 +140,14 @@ fn shared_actions_preserve_blanking_and_save_scope() { s.execute(Action::ToggleFullscreen); assert!(!s.presenter_fullscreen()); s.execute(Action::KeepRoutes); - assert!(s.blanked); + assert!(!s.blanked); assert!(!s.settings.presenter_fullscreen); s.draft_routes.presenter.clear(); s.execute(Action::ApplyRoutes); assert!(s.status.contains("presenter")); s.draft_routes = s.routes.clone(); s.execute(Action::ApplyRoutes); - assert!(s.blanked); + assert!(!s.blanked); s.execute(Action::Refresh); assert!(s.dirty_routes); s.execute(Action::Exit); @@ -161,7 +161,7 @@ fn lost_operator_screen_never_becomes_notes_on_previous_public_output() { s.set_monitors(vec![s.monitors[1].clone()], 0); assert!(s.routes.presenter.is_empty()); assert!(s.privacy_hold); - assert!(s.blanked); + assert!(!s.blanked); let monitors = studio().monitors; s.set_monitors(monitors, 0); assert!(!s.privacy_hold); @@ -203,14 +203,14 @@ fn palettes_and_languages_apply_to_presenter_browser_and_popups() { } } #[test] -fn startup_output_is_enabled_but_disconnect_still_blanks() { +fn startup_output_is_enabled_and_disconnect_preserves_visibility() { let mut s = Studio::new(true, None); assert!(!s.blanked); let monitors = studio().monitors; s.set_monitors(monitors.clone(), 0); assert!(!s.blanked); s.set_monitors(vec![monitors[0].clone()], 0); - assert!(s.blanked); + assert!(!s.blanked); let mut opt_out = Studio::new(true, None); opt_out.settings.auto_show = false; opt_out.set_monitors(monitors, 0); @@ -286,7 +286,7 @@ fn display_changes_require_confirmation_and_timeout_restores_previous_setup() { assert_eq!(s.settings.routes, original); assert!(s.settings.presenter_fullscreen); assert!(!s.presenter_fullscreen()); - assert!(s.blanked); + assert!(!s.blanked); s.execute(Action::Blank); s.execute(Action::Go(5)); assert!(s.blanked); @@ -364,7 +364,7 @@ fn hotplug_cancels_a_display_trial_without_saving_the_proposal() { s.set_monitors(vec![s.monitors[0].clone()], 0); assert!(s.route_trial.is_none()); assert_eq!(s.settings.routes, saved); - assert!(s.blanked); + assert!(!s.blanked); assert!(!s.routes.presentation.contains(&"two".to_owned())); } @@ -945,3 +945,35 @@ fn progress_bar_height_changes_rendered_geometry() { ); } } + +#[test] +fn fullscreen_and_routing_changes_preserve_explicit_output_visibility() { + for blanked in [false, true] { + for confirm in [false, true] { + let mut s = studio(); + s.blanked = blanked; + for _ in 0..2 { + s.execute(Action::ToggleFullscreen); + assert_eq!(s.blanked, blanked); + s.execute(if confirm { + Action::KeepRoutes + } else { + Action::RevertRoutes + }); + assert_eq!(s.blanked, blanked); + } + s.begin_display_edit(); + std::mem::swap( + &mut s.draft_routes.presenter, + &mut s.draft_routes.presentation, + ); + s.execute(Action::ApplyRoutes); + assert_eq!(s.blanked, blanked); + s.route_trial.as_mut().unwrap().deadline = std::time::Instant::now(); + s.poll(); + assert_eq!(s.blanked, blanked); + s.set_monitors(vec![s.monitors[0].clone()], 0); + assert_eq!(s.blanked, blanked); + } + } +} diff --git a/crates/pdf-presenter/tests/workers.rs b/crates/pdf-presenter/tests/workers.rs index 9d06158..eae12af 100644 --- a/crates/pdf-presenter/tests/workers.rs +++ b/crates/pdf-presenter/tests/workers.rs @@ -94,3 +94,18 @@ fn supervisor_kills_a_stuck_worker_and_recovers() { assert!(c.result.is_ok()); assert_eq!((c.generation, c.tag), (8, 2)); } + +#[test] +fn output_diagnostics_are_distinct_from_explicit_blanking() { + use pdf_presenter::output::Ack; + let old: Ack = + serde_json::from_str(r#"{"sequence":0,"page":null,"status":"host restarted","awake":""}"#) + .unwrap(); + assert!(!old.request_blank); + let explicit = Ack { + request_blank: true, + ..Default::default() + }; + let restored: Ack = serde_json::from_str(&serde_json::to_string(&explicit).unwrap()).unwrap(); + assert!(restored.request_blank); +} diff --git a/docs/changelog.md b/docs/changelog.md index 50378c3..9b5ee19 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,12 @@ ## Unreleased +### 0.1.51 + +- Preserve shown/manually blanked output through fullscreen and routing trials, + confirmation, rollback, hotplug and host recovery. Separate explicit output + blank requests from diagnostic status, retaining presenter privacy protections. + ### 0.1.50 - Compact All slides controls into two short rows on wide windows. Move explanatory diff --git a/docs/development/native-implementation.md b/docs/development/native-implementation.md index d323012..7358734 100644 --- a/docs/development/native-implementation.md +++ b/docs/development/native-implementation.md @@ -15,7 +15,7 @@ apply. The [user guide](../user-guide.md) describes actual controls and limitati - N-monitor role groups, mirroring, group swap, fullscreen defaults, standard-location global preferences, missing-monitor fallback and runtime operator-screen privacy hold. - Independent presentation process with acknowledged frame submission, blanking, - neighbour preloading, heartbeat supervision and bounded blanked restarts. Last frame + neighbour preloading, heartbeat supervision and bounded restarts preserving output visibility. Last frame survives presenter failure. Slow work is isolated from both native event loops. - Same-executable workers for rendering, notes, dialogs, config and frame reads; bounded pipes and deadlines, source generations, foreground supersession, corruption @@ -135,7 +135,7 @@ Menu is an anchored dropdown with Appearance and Preferences submenus. Displays numbered screen cards and direct role selection. The independent windowed slide browser requests topmost placement/focus; reopening restores/focuses it. Output is enabled by default on successful document open, with a globally saved opt-out. -Emergency/topology blanking still applies, and NO OUTPUT DISPLAYED is explicit even +Explicit emergency blanking still applies, and NO OUTPUT DISPLAYED is explicit even with a hidden footer. Appearance contains all 20 Canvas Pilot built-in palettes and System/English/French. Additional languages and external packs remain unimplemented; worker/OS diagnostics are preserved verbatim. This repository remains standalone. @@ -242,8 +242,8 @@ multiscreen/runtime acceptance remains separate from these regression checks. Display edits now stage both routes and fullscreen choices in a 15-second trial. The presenter owns a monotonic deadline and restores the prior setup on timeout, Revert, Escape or hotplug. Only Keep updates saved preferences; unrelated saves -cannot persist candidate display values. Output remains blank through the trial -and afterward until explicitly shown. Navigation/show actions are held during trials. +cannot persist candidate display values. Since 0.1.51, output visibility is preserved through trials and afterward. +Navigation is held during trials; explicit blank/show actions remain available. Startup right-click swap is available from either role until explicit navigation or Show presentation. Opening a source alone does not end startup recovery. Pending diff --git a/docs/interfaces/process-protocol.md b/docs/interfaces/process-protocol.md index e19868b..157ebea 100644 --- a/docs/interfaces/process-protocol.md +++ b/docs/interfaces/process-protocol.md @@ -23,7 +23,7 @@ Presentation HostState contains sequence, page, verified frame paths, neighbour preloads, monitor IDs, fullscreen and blank flags. It contains no notes or operator UI text. ACKs report only frames submitted successfully to all active output windows; this is not optical proof that a projector displayed a frame. Heartbeats detect a -stopped host after 8 s; at most three starts, recovery blanked. A presenter crash +stopped host after 8 s; at most three starts, recovery preserves the presenter’s output visibility. A presenter crash leaves the independent host displaying its last frame. Normal exit sends quit and allows bounded shutdown outside the UI loop. Reconnection to an orphan is pending. @@ -102,3 +102,13 @@ HostState carries `slide_colors` with `page_background` and `fit_padding` RGB by triples (default white/black). Color updates use the existing state sequence and repaint existing textures without changing buffer generation or reading slide files. Blank output remains black. Same-executable protocol only. + +## Output visibility in 0.1.51 + +`Ack.request_blank` is a boolean, default false for older messages. Only explicit +output keyboard blank/close actions set it; diagnostic `status` messages never +change output visibility. The presenter sends fresh state after host failure, +including its current blank flag. Fullscreen/routing trials, confirmation, +rollback and monitor topology changes preserve that flag. Missing outputs and +operator privacy holds still suppress unavailable windows; no presenter content +is sent to the output host. diff --git a/docs/interfaces/settings.md b/docs/interfaces/settings.md index 16714f6..877f364 100644 --- a/docs/interfaces/settings.md +++ b/docs/interfaces/settings.md @@ -22,7 +22,8 @@ flushed temporary file. Unknown fields are ignored and not preserved on round tr project layouts, or manual/emergency black blanking. - `auto_show`: boolean, default true (0.1.14). Enables output on startup and successful document open; false starts/opens blanked. Manual navigation preserves blanking. - Display topology changes, safe fullscreen exit and host recovery still blank output. + Since 0.1.51, display topology/fullscreen changes and host recovery preserve + the current output visibility; only explicit blank controls change it. - `theme`: built-in palette enum in snake_case, default `midra` (0.1.14). Values: `midra`, `high_contrast`, `foxified_dark`, `corporate_light`, `bluecore`, `dupont_monsanto`, `eden_green`, `foxified_light`, `hci`, `iron_docks`, `peaceframe`, diff --git a/docs/user-guide.md b/docs/user-guide.md index c370109..0f7a794 100644 --- a/docs/user-guide.md +++ b/docs/user-guide.md @@ -41,11 +41,11 @@ fullscreen for the session. `--list-monitors` lists CLI display numbers. Both roles default to fullscreen. Displays lists connected screens: assign each Unused, Presenter or Presentation, including several screens per role. Swap groups exchanges the draft roles. **Apply changes** previews the assignments -and fullscreen choices with output blanked. **Keep changes** confirms and saves; +and fullscreen choices while preserving the current output visibility. **Keep changes** confirms and saves; **Revert now**, Escape, or doing nothing for 15 seconds restores the previous setup. Confirmation controls appear on presenter and output windows so either screen can recover the change. Unconfirmed choices are never saved, and a disconnect cancels -the trial. Navigation/show controls are held until the trial is resolved. +the trial. Navigation is held until the trial is resolved; explicit blank/show controls remain available. Disabling either fullscreen option shows a positioning warning. Window placement can be unreliable in windowed mode, especially on Linux; switch back to fullscreen @@ -58,10 +58,10 @@ showing its first slide does not disable startup recovery. Once you start naviga or explicitly showing slides, the output startup menu disappears; use Displays on the presenter for later changes. Startup swap exchanges whole role groups, including mirrors. Trial output controls contain no notes, paths or presenter content. -Output remains blank after either confirmation or rollback until explicitly shown. +Confirmation and rollback preserve output visibility, including an explicit manual blank. Unavailable screens fall back to surviving assignments and available distinct screens; the preferred saved setup remains available for reconnection. Review the setup after -connecting/disconnecting displays: output is blanked until you explicitly show it. +connecting/disconnecting displays: output visibility is preserved on available outputs. If the operator screen disappears and only previous presentation screens remain, the presenter is withheld to protect notes. Reconnect an operator screen, or restart in windowed rehearsal after verifying privacy. Duplicate monitor names are distinguished @@ -174,7 +174,7 @@ After a host restart or resolution change, wait for READY again for RAM-only pla Rendering, notes, file dialogs and settings I/O run in supervised child processes of the same executable. A stuck renderer is terminated after its deadline; the UI and last output remain available. Reopen the source to retry failed pages. A presentation -host failure restarts blanked with a status message, up to three starts. If the +host failure restarts with the current output visibility and a status message, up to three starts. If the presenter crashes, the output process holds its last frame. B can blank it; Escape or its normal window Close control exits the disconnected output. Closing the presenter normally shuts down the output process too, with a separate termination fallback if