Refresh all presenters after a shared display confirmation
This commit is contained in:
parent
6e7694e67c
commit
792e835250
|
|
@ -2245,7 +2245,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "pdf-presenter"
|
||||
version = "0.1.74"
|
||||
version = "0.1.75"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"chrono",
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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<Pos2> {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
Loading…
Reference in New Issue