diff --git a/Cargo.lock b/Cargo.lock index 15e83bf..f1fc1a9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2245,7 +2245,7 @@ dependencies = [ [[package]] name = "pdf-presenter" -version = "0.1.74" +version = "0.1.75" dependencies = [ "bytemuck", "chrono", diff --git a/Cargo.toml b/Cargo.toml index df78db9..9ca08a8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ default-members = ["crates/pdf-presenter"] resolver = "3" [workspace.package] -version = "0.1.74" +version = "0.1.75" edition = "2024" license = "MIT" repository = "https://proxy.dandaedre.com/gitea/idle-org/pdf-presenter" diff --git a/crates/pdf-presenter/src/native.rs b/crates/pdf-presenter/src/native.rs index 0cb5b9a..cff4360 100644 --- a/crates/pdf-presenter/src/native.rs +++ b/crates/pdf-presenter/src/native.rs @@ -848,6 +848,7 @@ impl App { s.status.clone(), s.layout_open, s.browser_open, + s.route_trial.as_ref().map(|trial| trial.id), ); let chooser_was_open = s.dialog_busy; s.poll(); @@ -1016,6 +1017,7 @@ impl App { s.status.clone(), s.layout_open, s.browser_open, + s.route_trial.as_ref().map(|trial| trial.id), ); } if let Some(host) = &mut self.host { diff --git a/crates/pdf-presenter/src/presenter_ui.rs b/crates/pdf-presenter/src/presenter_ui.rs index 7673932..ba5e157 100644 --- a/crates/pdf-presenter/src/presenter_ui.rs +++ b/crates/pdf-presenter/src/presenter_ui.rs @@ -1393,6 +1393,11 @@ pub fn presenter(ui: &mut Ui, s: &mut Studio, native: &mut UiState) { } else { "Keep these display settings?" }); + ui.label(if s.settings.language.french() { + "Une seule confirmation suffit pour tous les écrans." + } else { + "Confirm once on any screen to apply to all displays." + }); ui.label(if s.settings.language.french() { format!("Retour automatique dans {seconds} s. Échap pour annuler.") } else { diff --git a/crates/pdf-presenter/tests/presenter_ui.rs b/crates/pdf-presenter/tests/presenter_ui.rs index b761920..1994b4d 100644 --- a/crates/pdf-presenter/tests/presenter_ui.rs +++ b/crates/pdf-presenter/tests/presenter_ui.rs @@ -1497,3 +1497,93 @@ fn third_monitor_routes_restore_after_repeated_disconnects_without_changing_visi } } } + +#[test] +fn one_presenter_confirmation_dismisses_both_presenters_on_three_monitors() { + fn find(shape: &egui::Shape, label: &str) -> Option { + match shape { + egui::Shape::Text(t) if t.galley.text() == label => Some(t.pos + t.galley.size() * 0.5), + egui::Shape::Vec(shapes) => shapes.iter().find_map(|s| find(s, label)), + _ => None, + } + } + for confirming_presenter in 0..2 { + let mut s = studio(); + s.monitors.push(Monitor { + id: "three".into(), + name: "Third".into(), + origin: (3840, 0), + size: (1920, 1080), + }); + s.settings.routes = s.routes.clone(); + s.begin_display_edit(); + s.draft_routes.presenter.push("three".into()); + s.execute(Action::ApplyRoutes); + let expected = s.routes.clone(); + let mut views = [ + (Context::default(), UiState::default()), + (Context::default(), UiState::default()), + ]; + let size = Vec2::new(1280., 720.); + let mut buttons = vec![]; + for (ctx, native) in &mut views { + let mut output = ctx.run_ui(input(size), |ui| { + presenter_ui::presenter(ui, &mut s, native) + }); + for _ in 0..2 { + output = ctx.run_ui(input(size), |ui| { + presenter_ui::presenter(ui, &mut s, native) + }); + } + buttons.push( + output + .shapes + .iter() + .find_map(|shape| find(&shape.shape, "Keep changes")) + .unwrap(), + ); + } + let pos = buttons[confirming_presenter]; + let (ctx, native) = &mut views[confirming_presenter]; + for pressed in [true, false] { + let mut raw = input(size); + raw.events = vec![ + egui::Event::PointerMoved(pos), + egui::Event::PointerButton { + pos, + button: egui::PointerButton::Primary, + pressed, + modifiers: Default::default(), + }, + ]; + let _ = ctx.run_ui(raw, |ui| presenter_ui::presenter(ui, &mut s, native)); + } + assert_eq!( + s.actions + .iter() + .filter(|action| matches!(action, Action::KeepRoutes)) + .count(), + 1 + ); + for action in std::mem::take(&mut s.actions) { + s.execute(action); + } + assert!(s.route_trial.is_none()); + assert_eq!(s.settings.routes, expected); + assert!(!s.blanked); + // Neither presenter needs another click; both consume the same confirmed state. + for (ctx, native) in &mut views { + let output = ctx.run_ui(input(size), |ui| { + presenter_ui::presenter(ui, &mut s, native) + }); + assert!( + output + .shapes + .iter() + .all(|shape| find(&shape.shape, "Keep changes").is_none()) + ); + } + s.execute(Action::RevertRoutes); // An obsolete second dialog cannot undo confirmation. + assert_eq!(s.routes, expected); + } +} diff --git a/docs/changelog.md b/docs/changelog.md index 56629b3..75d3206 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,19 @@ ## Unreleased +### 0.1.75 + +- Explicitly refresh all presenter windows when the shared display-confirmation + trial changes, independently of status text. Explain that one confirmation on + any screen applies to all displays. The 0.1.73 repaint fix already removes the + idle redraw loop that could leave another presenter's dialog stale. +- Add a three-monitor/two-presenter regression that clicks Keep changes in either + presenter and verifies both dialogs disappear, the entire setup is saved, and + output remains visible without a second confirmation. Linux workspace/native + tests, 13 Python tests, formatting and warnings-denied Clippy/rustdoc pass; + whole-application coverage is 84.56% (75% floor). Linux release binary rebuilt; + physical three-monitor and Windows/macOS verification remain open. + ### 0.1.74 - Reapply all native window placements after monitor topology changes, even when diff --git a/docs/development/native-implementation.md b/docs/development/native-implementation.md index 9a26504..e056090 100644 --- a/docs/development/native-implementation.md +++ b/docs/development/native-implementation.md @@ -420,3 +420,23 @@ physical hotplug acceptance or Windows/macOS compositor behavior. Linux formatting, warnings-denied Clippy/rustdoc, workspace/native tests and 13 Python helper tests pass. Whole-application coverage is 84.56% (75% floor), and the Linux release binary is rebuilt. Windows/macOS builds were not run. + + +## 0.1.75 shared display confirmation + +Display trials belong to the shared Studio, not individual presenter windows. +One Keep changes action confirms the whole route setup. Native redraw detection +now explicitly includes the shared trial ID so starting, confirming, reverting or +expiring a trial refreshes every presenter even if the status text is unchanged. +The dialog explains in English/French that one confirmation applies to all displays. + +The new regression renders two independent egui presenter contexts on a simulated +three-monitor setup, clicks Keep changes in either context, and verifies that the +saved routes cover both presenters and that neither dialog remains after redraw. +This already passes with the preceding shared-state implementation; combined with +the 0.1.73 idle repaint correction, it guards against requiring extra clicks on +other presenter windows. Physical multi-monitor verification remains open. + +Linux workspace/native tests, 13 Python helper tests, formatting and warnings-denied +Clippy/rustdoc pass. Whole-application coverage is 84.56% (75% floor). The Linux +release binary is rebuilt; Windows/macOS builds and publication were not performed.