Compare commits
83 Commits
| Author | SHA1 | Date |
|---|---|---|
|
|
bf8c57c344 | |
|
|
00c8ed0697 | |
|
|
3ca73d86cd | |
|
|
d41b8ab614 | |
|
|
aad895bc61 | |
|
|
2f98df4674 | |
|
|
89df5c2fe8 | |
|
|
9fef5f12ef | |
|
|
56672964b3 | |
|
|
621d9d3d51 | |
|
|
92e3466d47 | |
|
|
9ca908e88d | |
|
|
5e1bebdbd5 | |
|
|
044bdf1807 | |
|
|
0e8f5d952b | |
|
|
0cbd6f2607 | |
|
|
fbdd1d2654 | |
|
|
db39451ab3 | |
|
|
57c85b3af2 | |
|
|
0af6476eaf | |
|
|
ae3daeedf9 | |
|
|
2c2782ed68 | |
|
|
86f03305ca | |
|
|
c546631845 | |
|
|
3aa4f16bd1 | |
|
|
8d7fee6984 | |
|
|
0b470ea626 | |
|
|
3711db148c | |
|
|
5681b1cb72 | |
|
|
0d10f7d0ba | |
|
|
b3470dfded | |
|
|
2d7c95674c | |
|
|
3ea94a34b0 | |
|
|
4648a0cae2 | |
|
|
e8075582fa | |
|
|
68e1d2639d | |
|
|
2dadf99ee0 | |
|
|
5bc9c83675 | |
|
|
792e835250 | |
|
|
6e7694e67c | |
|
|
7ed0c1e92f | |
|
|
5294e083ad | |
|
|
3724775d30 | |
|
|
9894d6abbe | |
|
|
ae0ff93a8a | |
|
|
b4e4429290 | |
|
|
7981b008b7 | |
|
|
39db39a8b2 | |
|
|
3df1300b07 | |
|
|
0aec6c10c5 | |
|
|
71fef0a2e4 | |
|
|
57a8ff2848 | |
|
|
c7d527ac43 | |
|
|
29e8671c40 | |
|
|
8f361c70c5 | |
|
|
f5b3a6cce8 | |
|
|
0948f3b890 | |
|
|
a12f75a7d9 | |
|
|
3066e82e51 | |
|
|
8b193dfec6 | |
|
|
c319eacbc4 | |
|
|
364ee1e59a | |
|
|
edfae03ff4 | |
|
|
00d69dafed | |
|
|
75bb3cb44b | |
|
|
94f9c787a8 | |
|
|
bc1f025a96 | |
|
|
6c617f6953 | |
|
|
4601a7bafb | |
|
|
6e350b53e9 | |
|
|
a0be4211b8 | |
|
|
8e2a6d663f | |
|
|
aa340e66ec | |
|
|
08d0a9276c | |
|
|
a6435cda80 | |
|
|
eab8985e08 | |
|
|
d8d8250efe | |
|
|
a44f1744e3 | |
|
|
ec5d8a2458 | |
|
|
ce78d13d11 | |
|
|
f09d8ac361 | |
|
|
f534944b10 | |
|
|
4f5665f8e2 |
16
AGENTS.md
|
|
@ -1,4 +1,4 @@
|
|||
# PDF Presenter
|
||||
# Deckstride
|
||||
|
||||
Standalone Rust application foundation for multiscreen PDF presentation. Read
|
||||
`AGENT_DOCUMENTATION.md` and `docs/development/plan.md` before implementing behavior.
|
||||
|
|
@ -8,12 +8,12 @@ Physical display, performance, sleep and clean-machine acceptance remain open.
|
|||
|
||||
## Structure and intended architecture
|
||||
|
||||
- `crates/pdf-presenter/src/lib.rs`: tested, UI-independent presentation state.
|
||||
- `crates/deckstride/src/lib.rs`: tested, UI-independent presentation state.
|
||||
- `src/main.rs` in that crate: CLI/native entry point. `native.rs` owns windows, `presenter_ui.rs` controls, `studio.rs` shared state,
|
||||
`document.rs` rendering, `worker.rs` supervised jobs, `output.rs` independent host/leases,
|
||||
`settings.rs` persistence. `desktop.rs`/`poc.rs`/`paint.rs` retain the display diagnostic.
|
||||
- `crates/pdf-presenter/tests/`: meaningful behavior tests, including boundary cases.
|
||||
- `crates/pdf-presenter/assets/`: generated app artwork and provenance.
|
||||
- `crates/deckstride/tests/`: meaningful behavior tests, including boundary cases.
|
||||
- `crates/deckstride/assets/`: generated app artwork and provenance.
|
||||
- `scripts/`, `tests/`, `Jenkinsfile`: standalone validation and badge publication.
|
||||
- `docs/development/`: architecture decisions, implementation plan and CI setup.
|
||||
- `docs/interfaces/`: persistent-format contracts when formats are introduced.
|
||||
|
|
@ -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.
|
||||
|
||||
|
|
@ -83,7 +85,7 @@ for Windows/macOS artifacts do not authorize rebuilding them on every later task
|
|||
Report platform validation that was not run accurately; do not imply it passed.
|
||||
|
||||
CI uses `rust_no_docker`; it archives exactly three badge SVGs and only main/non-PR
|
||||
builds publish to `/mnt/assets/coverage/idle-org/pdf-presenter/main/`. No automatic
|
||||
builds publish to `/mnt/assets/coverage/idle-org/deckstride/main/`. No automatic
|
||||
releases, binaries or manual publication. Jenkins job creation is external setup.
|
||||
Never modify another tool's badges or the shared manuals root.
|
||||
|
||||
|
|
|
|||
|
|
@ -26,3 +26,5 @@
|
|||
- [Private process protocol](docs/interfaces/process-protocol.md).
|
||||
|
||||
- [Manual release preparation](docs/development/releases.md).
|
||||
|
||||
- [Presentation notes sidecars and editor](docs/interfaces/presentation-notes.md).
|
||||
|
|
|
|||
|
|
@ -95,6 +95,15 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arbitrary"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3bc62ac97cc33321f50863d514c3bc38a453947a8f9e781137e47c7401020aed"
|
||||
dependencies = [
|
||||
"derive_arbitrary",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "arrayref"
|
||||
version = "0.3.9"
|
||||
|
|
@ -471,7 +480,7 @@ dependencies = [
|
|||
"js-sys",
|
||||
"num-traits",
|
||||
"wasm-bindgen",
|
||||
"windows-link",
|
||||
"windows-link 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -577,6 +586,25 @@ dependencies = [
|
|||
"cfg-if",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-deque"
|
||||
version = "0.8.8"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a"
|
||||
dependencies = [
|
||||
"crossbeam-epoch",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-epoch"
|
||||
version = "0.9.21"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d"
|
||||
dependencies = [
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "crossbeam-utils"
|
||||
version = "0.8.23"
|
||||
|
|
@ -649,6 +677,49 @@ dependencies = [
|
|||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "deckstride"
|
||||
version = "0.1.101"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"chrono",
|
||||
"directories",
|
||||
"egui",
|
||||
"egui-winit",
|
||||
"egui_software_backend",
|
||||
"font8x8",
|
||||
"hayro",
|
||||
"image",
|
||||
"keepawake",
|
||||
"libc",
|
||||
"rfd",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"softbuffer",
|
||||
"sys-locale",
|
||||
"sysinfo",
|
||||
"tempfile",
|
||||
"toml 0.8.23",
|
||||
"wayland-client",
|
||||
"wayland-protocols",
|
||||
"winit",
|
||||
"winresource",
|
||||
"x11-dl",
|
||||
"zip",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_arbitrary"
|
||||
version = "1.5.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1b034bd7d5f032402a2479444dcc6f74e36a03f31854d41680fb240ef682a1ac"
|
||||
dependencies = [
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 3.0.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "derive_builder"
|
||||
version = "0.20.2"
|
||||
|
|
@ -816,14 +887,19 @@ dependencies = [
|
|||
[[package]]
|
||||
name = "egui_software_backend"
|
||||
version = "0.0.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b8ca3a47168e93a5cca79b7cb830817acaf07ebc1f8756aa368a6b2d6250f6ae"
|
||||
dependencies = [
|
||||
"constify",
|
||||
"egui",
|
||||
"rayon",
|
||||
"strength_reduce",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "either"
|
||||
version = "1.19.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
|
||||
|
||||
[[package]]
|
||||
name = "emath"
|
||||
version = "0.34.3"
|
||||
|
|
@ -1147,7 +1223,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "1bd49230192a3797a9a4d6abe9b3eed6f7fa4c8a8a4947977c6f80025f92cbd8"
|
||||
dependencies = [
|
||||
"rustix 1.1.6",
|
||||
"windows-link",
|
||||
"windows-link 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1369,7 +1445,7 @@ dependencies = [
|
|||
"js-sys",
|
||||
"log",
|
||||
"wasm-bindgen",
|
||||
"windows-core",
|
||||
"windows-core 0.62.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1550,7 +1626,7 @@ dependencies = [
|
|||
"simd_cesu8",
|
||||
"thiserror 2.0.21",
|
||||
"walkdir",
|
||||
"windows-link",
|
||||
"windows-link 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1626,7 +1702,7 @@ dependencies = [
|
|||
"objc2-core-foundation",
|
||||
"objc2-io-kit",
|
||||
"thiserror 2.0.21",
|
||||
"windows",
|
||||
"windows 0.62.2",
|
||||
"zbus",
|
||||
]
|
||||
|
||||
|
|
@ -1655,7 +1731,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||
checksum = "d7c4b02199fee7c5d21a5ae7d8cfa79a6ef5bb2fc834d6e9058e89c825efdc55"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"windows-link",
|
||||
"windows-link 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -1799,6 +1875,15 @@ version = "0.2.0"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451"
|
||||
|
||||
[[package]]
|
||||
name = "ntapi"
|
||||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c3b335231dfd352ffb0f8017f3b6027a4917f7df785ea2143d8af2adc66980ae"
|
||||
dependencies = [
|
||||
"winapi",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num-traits"
|
||||
version = "0.2.19"
|
||||
|
|
@ -2207,37 +2292,7 @@ dependencies = [
|
|||
"libc",
|
||||
"redox_syscall 0.5.18",
|
||||
"smallvec",
|
||||
"windows-link",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "pdf-presenter"
|
||||
version = "0.1.33"
|
||||
dependencies = [
|
||||
"bytemuck",
|
||||
"chrono",
|
||||
"directories",
|
||||
"egui",
|
||||
"egui-winit",
|
||||
"egui_software_backend",
|
||||
"font8x8",
|
||||
"hayro",
|
||||
"image",
|
||||
"keepawake",
|
||||
"libc",
|
||||
"rfd",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"sha2",
|
||||
"softbuffer",
|
||||
"sys-locale",
|
||||
"tempfile",
|
||||
"toml 0.8.23",
|
||||
"wayland-client",
|
||||
"wayland-protocols",
|
||||
"winit",
|
||||
"winresource",
|
||||
"x11-dl",
|
||||
"windows-link 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -2521,6 +2576,26 @@ version = "0.6.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539"
|
||||
|
||||
[[package]]
|
||||
name = "rayon"
|
||||
version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d"
|
||||
dependencies = [
|
||||
"either",
|
||||
"rayon-core",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rayon-core"
|
||||
version = "1.13.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91"
|
||||
dependencies = [
|
||||
"crossbeam-deque",
|
||||
"crossbeam-utils",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "read-fonts"
|
||||
version = "0.37.0"
|
||||
|
|
@ -3004,6 +3079,20 @@ dependencies = [
|
|||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "sysinfo"
|
||||
version = "0.37.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "16607d5caffd1c07ce073528f9ed972d88db15dd44023fa57142963be3feb11f"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"memchr",
|
||||
"ntapi",
|
||||
"objc2-core-foundation",
|
||||
"objc2-io-kit",
|
||||
"windows 0.61.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tempfile"
|
||||
version = "3.27.0"
|
||||
|
|
@ -3605,6 +3694,22 @@ version = "0.1.12"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a28ac98ddc8b9274cb41bb4d9d4d5c425b6020c50c46f25559911905610b4a88"
|
||||
|
||||
[[package]]
|
||||
name = "winapi"
|
||||
version = "0.3.9"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
|
||||
dependencies = [
|
||||
"winapi-i686-pc-windows-gnu",
|
||||
"winapi-x86_64-pc-windows-gnu",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-i686-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
|
||||
|
||||
[[package]]
|
||||
name = "winapi-util"
|
||||
version = "0.1.11"
|
||||
|
|
@ -3614,16 +3719,44 @@ dependencies = [
|
|||
"windows-sys 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "winapi-x86_64-pc-windows-gnu"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.61.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9babd3a767a4c1aef6900409f85f5d53ce2544ccdfaa86dad48c91782c6d6893"
|
||||
dependencies = [
|
||||
"windows-collections 0.2.0",
|
||||
"windows-core 0.61.2",
|
||||
"windows-future 0.2.1",
|
||||
"windows-link 0.1.3",
|
||||
"windows-numerics 0.2.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows"
|
||||
version = "0.62.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580"
|
||||
dependencies = [
|
||||
"windows-collections",
|
||||
"windows-core",
|
||||
"windows-future",
|
||||
"windows-numerics",
|
||||
"windows-collections 0.3.2",
|
||||
"windows-core 0.62.2",
|
||||
"windows-future 0.3.2",
|
||||
"windows-numerics 0.3.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-collections"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3beeceb5e5cfd9eb1d76b381630e82c4241ccd0d27f1a39ed41b2760b255c5e8"
|
||||
dependencies = [
|
||||
"windows-core 0.61.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3632,7 +3765,20 @@ version = "0.3.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610"
|
||||
dependencies = [
|
||||
"windows-core",
|
||||
"windows-core 0.62.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-core"
|
||||
version = "0.61.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"
|
||||
dependencies = [
|
||||
"windows-implement",
|
||||
"windows-interface",
|
||||
"windows-link 0.1.3",
|
||||
"windows-result 0.3.4",
|
||||
"windows-strings 0.4.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3643,9 +3789,20 @@ checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"
|
|||
dependencies = [
|
||||
"windows-implement",
|
||||
"windows-interface",
|
||||
"windows-link",
|
||||
"windows-result",
|
||||
"windows-strings",
|
||||
"windows-link 0.2.1",
|
||||
"windows-result 0.4.1",
|
||||
"windows-strings 0.5.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-future"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fc6a41e98427b19fe4b73c550f060b59fa592d7d686537eebf9385621bfbad8e"
|
||||
dependencies = [
|
||||
"windows-core 0.61.2",
|
||||
"windows-link 0.1.3",
|
||||
"windows-threading 0.1.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3654,9 +3811,9 @@ version = "0.3.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb"
|
||||
dependencies = [
|
||||
"windows-core",
|
||||
"windows-link",
|
||||
"windows-threading",
|
||||
"windows-core 0.62.2",
|
||||
"windows-link 0.2.1",
|
||||
"windows-threading 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3681,20 +3838,45 @@ dependencies = [
|
|||
"syn 2.0.119",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.1.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a"
|
||||
|
||||
[[package]]
|
||||
name = "windows-link"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"
|
||||
|
||||
[[package]]
|
||||
name = "windows-numerics"
|
||||
version = "0.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9150af68066c4c5c07ddc0ce30421554771e528bde427614c61038bc2c92c2b1"
|
||||
dependencies = [
|
||||
"windows-core 0.61.2",
|
||||
"windows-link 0.1.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-numerics"
|
||||
version = "0.3.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26"
|
||||
dependencies = [
|
||||
"windows-core",
|
||||
"windows-link",
|
||||
"windows-core 0.62.2",
|
||||
"windows-link 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-result"
|
||||
version = "0.3.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6"
|
||||
dependencies = [
|
||||
"windows-link 0.1.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3703,7 +3885,16 @@ version = "0.4.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
"windows-link 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-strings"
|
||||
version = "0.4.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57"
|
||||
dependencies = [
|
||||
"windows-link 0.1.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3712,7 +3903,7 @@ version = "0.5.1"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
"windows-link 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3739,7 +3930,7 @@ version = "0.61.2"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
"windows-link 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -3758,13 +3949,22 @@ dependencies = [
|
|||
"windows_x86_64_msvc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-threading"
|
||||
version = "0.1.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "b66463ad2e0ea3bbf808b7f1d371311c80e115c0b71d60efc142cafbcfb057a6"
|
||||
dependencies = [
|
||||
"windows-link 0.1.3",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "windows-threading"
|
||||
version = "0.2.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37"
|
||||
dependencies = [
|
||||
"windows-link",
|
||||
"windows-link 0.2.1",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
|
@ -4140,6 +4340,21 @@ dependencies = [
|
|||
"syn 3.0.10",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zip"
|
||||
version = "2.6.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1dcb24d0152526ae49b9b96c1dcf71850ca1e0b882e4e28ed898a93c41334744"
|
||||
dependencies = [
|
||||
"arbitrary",
|
||||
"crc32fast",
|
||||
"crossbeam-utils",
|
||||
"flate2",
|
||||
"indexmap",
|
||||
"memchr",
|
||||
"zopfli",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zlib-rs"
|
||||
version = "0.6.8"
|
||||
|
|
@ -4152,6 +4367,18 @@ version = "1.0.23"
|
|||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b"
|
||||
|
||||
[[package]]
|
||||
name = "zopfli"
|
||||
version = "0.8.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "aaf7fc5d30c28483d93805c4a5e12b05bbb52407fa67c5f8bd552374cd01fb11"
|
||||
dependencies = [
|
||||
"bumpalo",
|
||||
"crc32fast",
|
||||
"log",
|
||||
"simd-adler32",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "zune-core"
|
||||
version = "0.5.3"
|
||||
|
|
|
|||
11
Cargo.toml
|
|
@ -1,13 +1,13 @@
|
|||
[workspace]
|
||||
members = ["crates/pdf-presenter"]
|
||||
default-members = ["crates/pdf-presenter"]
|
||||
members = ["crates/deckstride"]
|
||||
default-members = ["crates/deckstride"]
|
||||
resolver = "3"
|
||||
|
||||
[workspace.package]
|
||||
version = "0.1.33"
|
||||
version = "0.1.101"
|
||||
edition = "2024"
|
||||
license = "MIT"
|
||||
repository = "https://proxy.dandaedre.com/gitea/idle-org/pdf-presenter"
|
||||
repository = "https://proxy.dandaedre.com/gitea/idle-org/deckstride"
|
||||
|
||||
[profile.dev]
|
||||
debug = 0
|
||||
|
|
@ -17,3 +17,6 @@ strip = true
|
|||
|
||||
[profile.dev.package."*"]
|
||||
opt-level = 2
|
||||
|
||||
[patch.crates-io]
|
||||
egui_software_backend = { path = "vendor/egui_software_backend" }
|
||||
|
|
|
|||
|
|
@ -4,5 +4,8 @@ passthrough = ["RUSTUP_TOOLCHAIN"]
|
|||
[target.x86_64-unknown-linux-gnu]
|
||||
image = "ghcr.io/cross-rs/x86_64-unknown-linux-gnu:main"
|
||||
|
||||
[target.aarch64-unknown-linux-musl]
|
||||
image = "ghcr.io/cross-rs/aarch64-unknown-linux-musl:main"
|
||||
|
||||
[target.x86_64-pc-windows-gnu]
|
||||
image = "ghcr.io/cross-rs/x86_64-pc-windows-gnu:main"
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ pipeline {
|
|||
PYTHONUNBUFFERED = '1'
|
||||
PYTHONDONTWRITEBYTECODE = '1'
|
||||
NO_COLOR = '1'
|
||||
PDF_PRESENTER_HEADLESS_CI = '1'
|
||||
DECKSTRIDE_HEADLESS_CI = '1'
|
||||
CARGO_TERM_COLOR = 'never'
|
||||
BADGE_ROOT = '/mnt/assets/coverage'
|
||||
}
|
||||
|
|
@ -60,7 +60,7 @@ pipeline {
|
|||
sh '''
|
||||
set -eu
|
||||
uv run --no-project --python ">=3.11" python -m unittest discover -s tests -v
|
||||
unset PDF_PRESENTER_GUI_TESTS
|
||||
unset DECKSTRIDE_GUI_TESTS
|
||||
cargo test --locked --workspace --all-features
|
||||
cargo build --locked --workspace --all-features
|
||||
uv run --no-project --python ">=3.11" python scripts/ci.py tests-passed
|
||||
|
|
@ -72,7 +72,7 @@ pipeline {
|
|||
steps {
|
||||
sh '''
|
||||
set -eu
|
||||
unset PDF_PRESENTER_GUI_TESTS
|
||||
unset DECKSTRIDE_GUI_TESTS
|
||||
uv run --no-project --python ">=3.11" python scripts/ci.py coverage
|
||||
'''
|
||||
}
|
||||
|
|
|
|||
184
README.md
|
|
@ -1,64 +1,166 @@
|
|||
<p align="center">
|
||||
<img src="crates/pdf-presenter/assets/app-icon.png" width="96" height="96" alt="PDF Presenter icon">
|
||||
<img src="crates/deckstride/assets/app-icon.png" width="96" height="96" alt="Deckstride icon">
|
||||
</p>
|
||||
<h1 align="center">PDF Presenter</h1>
|
||||
<p align="center"><strong>Your slides on the big screen. Your notes and controls with you.</strong></p>
|
||||
<h1 align="center">Deckstride</h1>
|
||||
<p align="center"><strong>A fast, portable presenter for PDFs and picture folders.</strong></p>
|
||||
<p align="center">Fullscreen slides for the room. Notes, previews and controls for you.</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="docs/changelog.md"><img src="https://assets.dandaedre.com/coverage/idle-org/pdf-presenter/main/version.svg" alt="Version"></a>
|
||||
<a href="docs/development/ci.md"><img src="https://assets.dandaedre.com/coverage/idle-org/pdf-presenter/main/test.svg" alt="Tests"></a>
|
||||
<a href="docs/development/ci.md"><img src="https://assets.dandaedre.com/coverage/idle-org/pdf-presenter/main/coverage.svg" alt="Coverage"></a>
|
||||
<a href="docs/changelog.md"><img src="https://assets.dandaedre.com/coverage/idle-org/deckstride/main/version.svg" alt="Version"></a>
|
||||
<a href="docs/development/ci.md"><img src="https://assets.dandaedre.com/coverage/idle-org/deckstride/main/test.svg" alt="Tests"></a>
|
||||
<a href="docs/development/ci.md"><img src="https://assets.dandaedre.com/coverage/idle-org/deckstride/main/coverage.svg" alt="Coverage"></a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://proxy.dandaedre.com/gitea/idle-org/pdf-presenter/releases"><strong>Download a release</strong></a> ·
|
||||
<a href="docs/user-guide.md#install-and-update">Install and update</a> ·
|
||||
<a href="https://proxy.dandaedre.com/gitea/idle-org/deckstride/releases"><strong>Download Deckstride</strong></a> ·
|
||||
<a href="docs/user-guide.md">User guide</a> ·
|
||||
<a href="https://proxy.dandaedre.com/gitea/idle-org/pdf-presenter/issues">Report an issue</a>
|
||||
<a href="https://proxy.dandaedre.com/gitea/idle-org/deckstride/issues">Report an issue</a>
|
||||
</p>
|
||||
|
||||
PDF Presenter is a desktop presenter for **PDFs and picture folders**. Show slides
|
||||
fullscreen on your presentation screens while keeping previews, notes, timers and
|
||||
navigation on your presenter screen. Rehearse on one monitor, or mirror either view
|
||||
across several displays.
|
||||
Deckstride gives each connected screen a job: **Presenter**, **Slides**, or
|
||||
**Unused**. Keep the current slide, next slide, notes and timers in front of you
|
||||
while one or more other screens show only the presentation. You can also mirror the
|
||||
Presenter view, rehearse on one monitor, or change the arrangement during a session.
|
||||
|
||||
## Download, extract, present
|
||||
<p align="center">
|
||||
<img src="docs/images/presenter-overview.png" alt="Presenter view showing the current slide, next slide, fitted notes, timer and navigation" width="100%">
|
||||
</p>
|
||||
|
||||
Start with the [release downloads](https://proxy.dandaedre.com/gitea/idle-org/pdf-presenter/releases).
|
||||
Choose a **portable** package for your computer; no Rust toolchain or separate PDF
|
||||
renderer is needed.
|
||||
The application is built around a simple requirement: advancing a slide should feel
|
||||
immediate. Prepared slides are buffered in RAM, reusable processed images make a
|
||||
second opening faster, and large decks use a rolling buffer instead of exhausting
|
||||
memory. Rendering, notes and file work run outside the presentation controls so a
|
||||
slow document operation does not have to freeze navigation.
|
||||
|
||||
| Your computer | Download | Run after extracting |
|
||||
## What it does well
|
||||
|
||||
| Feature | What it means while presenting |
|
||||
| --- | --- |
|
||||
| **Real multi-screen control** | Assign Presenter or Slides to every connected monitor. Repeat either role across several screens. Display changes use a confirmation timer and revert if the new arrangement is wrong. |
|
||||
| **Layouts for each Presenter screen** | Resize or hide the current slide, next slide, previous slide, notes, timers and progress bar. Save a layout for one project or as a default, with separate preferences for different screens. |
|
||||
| **Fast, visible preparation** | The Presenter reports what it is preparing, RAM use and an ETA when available. Prepared nearby slides are served from RAM; a bounded rolling buffer reloads distant slides only when needed. |
|
||||
| **Useful live tools** | Point, draw arrows and highlight without modifying the PDF or rerendering slide images. Tool size follows the visible slide, including high-resolution output. |
|
||||
| **Shared zoom** | Opt in to zoom, pan or fit a page to width from Presenter or Slides. Both views stay on the same part of the page. |
|
||||
| **Safe slide browsing** | Browse resizable thumbnails without changing the live slide. Double-click to preview, or enable **Change on click** when direct switching is useful. |
|
||||
| **Notes that belong to the presentation** | Read notes from a sidecar or the PDF, import TXT/Markdown, and double-click the notes pane to edit the current slide. Notes automatically fit the available space. |
|
||||
| **Presentation-aware desktop behavior** | Deckstride asks supported operating systems to keep the display awake and reports whether protection is active. Closing Presenter also closes its Slides windows. |
|
||||
| **Portable by design** | The release binaries include the PDF renderer and application dependencies. Keep the extracted folder anywhere convenient; no Rust or separate PDF software is required. |
|
||||
| **Themes and languages** | Choose from 20 built-in palettes and seven interface languages, or import bounded offline language/theme packs. |
|
||||
|
||||
On Windows, multi-screen output, per-screen layouts, zoom, tools, and unplugging then
|
||||
reconnecting displays have been tested in extended use. Linux and macOS use the same
|
||||
presentation model, but desktop and window-manager behavior still deserves testing
|
||||
on the machines that will run the show.
|
||||
|
||||
## Download and run
|
||||
|
||||
Open the [release page](https://proxy.dandaedre.com/gitea/idle-org/deckstride/releases)
|
||||
and download the archive for your computer.
|
||||
|
||||
| Platform | Recommended download | Start after extracting |
|
||||
| --- | --- | --- |
|
||||
| Windows x86_64 | `pdf-presenter-portable-x86_64-pc-windows-gnu-v….zip` | `pdf-presenter.exe` |
|
||||
| Linux x86_64 | `pdf-presenter-portable-x86_64-unknown-linux-gnu-v….tgz` | `./pdf-presenter` |
|
||||
| Windows x86_64 | `deckstride-portable-x86_64-pc-windows-gnu-v….zip` | `deckstride.exe` |
|
||||
| Linux x86_64 | `deckstride-portable-x86_64-unknown-linux-gnu-v….tgz` | `./deckstride` |
|
||||
| Linux ARM64 | `deckstride-portable-aarch64-unknown-linux-musl-v….tgz` | `./deckstride` |
|
||||
| Apple Silicon macOS 13+ | `deckstride-portable-aarch64-apple-darwin-v….tgz` | Follow the release-page macOS instructions |
|
||||
| Intel macOS 13+ | `deckstride-portable-x86_64-apple-darwin-v….tgz` | Follow the release-page macOS instructions |
|
||||
|
||||
Releases are currently **previews**. Windows binaries are unsigned; macOS downloads
|
||||
are not yet available. Test your display setup before using it for a live event.
|
||||
[Installation, updates and optional Linux app-menu integration →](docs/user-guide.md#install-and-update)
|
||||
Windows and macOS builds are currently unsigned. Releases are ready for normal use;
|
||||
test the actual computer, adapters and display arrangement before a live event.
|
||||
macOS artifacts are cross-built on Linux and have not yet had native Mac runtime
|
||||
testing. [Installation and update details →](docs/user-guide.md#install-and-update)
|
||||
|
||||
## Set up your presentation
|
||||
If you already have [cargo-binstall](https://github.com/cargo-bins/cargo-binstall)
|
||||
installed, install the prebuilt release directly:
|
||||
|
||||
1. **Open your slides.** Choose Menu → Open PDF or Open picture folder, or drop your
|
||||
file/folder onto the presenter. Pictures follow natural filename order.
|
||||
2. **Choose your screens.** In Displays, assign Presenter or Presentation to each
|
||||
monitor. Try the arrangement, then keep it or let it revert automatically.
|
||||
3. **Make room for what matters.** In Layout, resize or hide previews and notes,
|
||||
place the timers, and optionally enable slide progress. Save for this project
|
||||
or all projects.
|
||||
4. **Present.** Use arrows or Space to advance. Type a slide number and press Enter
|
||||
to jump. All slides opens a thumbnail browser; B blanks or restores the output.
|
||||
```sh
|
||||
cargo binstall deckstride --git https://proxy.dandaedre.com/gitea/idle-org/deckstride --version 0.1.96 --strategies crate-meta-data
|
||||
```
|
||||
|
||||
Opening a document shows the presentation by default. After changing displays,
|
||||
use **Show presentation** to restore output. Hide the bars for more space; move the
|
||||
pointer near an edge or right-click to recover them.
|
||||
Replace `0.1.96` with another published Deckstride version when needed. Then run
|
||||
`deckstride`.
|
||||
|
||||
Prepared slides are cached for reuse. The presenter shows loading progress, RAM use
|
||||
and an ETA when available; decks larger than the RAM budget use a rolling buffer.
|
||||
Notes can come from the PDF or picture-folder sidecars. Themes and English/French
|
||||
controls are available in Menu.
|
||||
## Set up a show
|
||||
|
||||
[**Read the user guide →**](docs/user-guide.md)
|
||||
1. **Open a PDF or picture folder.** Use Menu, drag and drop, or open an associated
|
||||
PDF on Windows. Pictures follow natural filename order.
|
||||
2. **Choose where each view goes.** Open **Displays**, select Presenter, Slides or
|
||||
Unused for each monitor, then apply the change. Keep the proposal or let it revert.
|
||||
3. **Arrange your Presenter view.** Open **Layout** to size and position slides,
|
||||
notes, clocks and progress. Save it for this presentation or for all projects.
|
||||
4. **Present.** Use Left/Right, Page Up/Page Down or Space. Type a slide number and
|
||||
press Enter to jump directly to it. Press B to blank or restore Slides.
|
||||
|
||||
Deckstride shows Slides by default after a document opens. Entering or leaving
|
||||
fullscreen and changing screen assignments preserve that choice. Header and footer
|
||||
controls can auto-hide; move the pointer near their edge or right-click to recover
|
||||
them.
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<td width="50%"><img src="docs/images/display-routing.png" alt="Displays panel assigning Presenter and Slides across two monitors"></td>
|
||||
<td width="50%"><img src="docs/images/all-slides.png" alt="All slides browser with three resizable slide thumbnails"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><strong>Route and mirror screens</strong></td>
|
||||
<td align="center"><strong>Browse without disturbing the live slide</strong></td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
## Zoom and point while presenting
|
||||
|
||||
Enable page zoom from Menu when a document needs it. Scroll to zoom, drag to pan,
|
||||
and double-click to fit the page width or reset. The crop is shared with Slides and
|
||||
uses the already buffered image.
|
||||
|
||||
Open **Tools** for a pointer, arrows and a highlighter. Marks remain vector overlays
|
||||
on the current slide and can be undone or cleared instantly. Their apparent size is
|
||||
scaled between the smaller Presenter preview, 1080p output and 4K output.
|
||||
|
||||
<p align="center">
|
||||
<img src="docs/images/presenter-tools.png" alt="Presenter view with the pointer toolbox open and a pointer visible on the current slide" width="100%">
|
||||
</p>
|
||||
|
||||
## Slides, notes and shortcuts
|
||||
|
||||
PDFs work directly. A picture folder becomes a deck using natural filename order;
|
||||
for example, `slide_2.png` comes before `slide_10.png`. Notes may come from embedded
|
||||
PDF annotations, a `.notes.toml` sidecar, per-slide text files, or imported TXT and
|
||||
Markdown. Source slides and imported note files are not overwritten.
|
||||
|
||||
Useful controls:
|
||||
|
||||
- **Right / Space** — next slide
|
||||
- **Left / Shift+Space** — previous slide
|
||||
- **Number, then Enter** — jump to a slide
|
||||
- **Hold S for one second** — swap Presenter and Slides screens, then Keep or Revert
|
||||
- **B** — blank or restore Slides
|
||||
- **P / A / H** — pointer, arrow or highlighter
|
||||
- **Escape / Ctrl+Q** — request quit confirmation (Escape first reverts an active display trial)
|
||||
|
||||
[Notes, layouts and controls →](docs/user-guide.md) ·
|
||||
[Notes file formats →](docs/interfaces/presentation-notes.md) ·
|
||||
[Preparation, cache and RAM behavior →](docs/user-guide.md#preparation-processed-slides-and-ram)
|
||||
|
||||
## Add languages and themes
|
||||
|
||||
Open **Preferences → General → Appearance** and choose **Import language pack…**
|
||||
or **Import theme pack…**. Imported choices appear in the existing Language and
|
||||
Theme selectors without restarting Deckstride. Packs stay offline and contain data
|
||||
only.
|
||||
|
||||
Editable examples and ready-to-import ZIPs:
|
||||
|
||||
- [Language pack example](docs/packs/deckstride-language-pack.zip)
|
||||
- [Theme pack example](docs/packs/deckstride-theme-pack.zip)
|
||||
- [Pack format and limits](docs/packs/README.md)
|
||||
|
||||
## Open source
|
||||
|
||||
Deckstride is independent open-source software under the [MIT license](LICENSE).
|
||||
Development includes LLM-generated or LLM-assisted work with human review. The
|
||||
project is used in professional settings, while physical acceptance work remains
|
||||
documented rather than hidden.
|
||||
|
||||
---
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "pdf-presenter"
|
||||
name = "deckstride"
|
||||
version.workspace = true
|
||||
edition.workspace = true
|
||||
license.workspace = true
|
||||
|
|
@ -14,7 +14,7 @@ font8x8 = "=0.3.1"
|
|||
|
||||
egui = { version = "=0.34.1", features = ["default_fonts"] }
|
||||
egui-winit = { version = "=0.34.1", default-features = false, features = ["x11", "wayland"] }
|
||||
egui_software_backend = { version = "=0.0.3", default-features = false, features = ["std"] }
|
||||
egui_software_backend = { version = "=0.0.3", default-features = false, features = ["std", "rayon"] }
|
||||
bytemuck = "1.25"
|
||||
serde = { version = "1", features = ["derive"] }
|
||||
serde_json = "1"
|
||||
|
|
@ -25,8 +25,12 @@ sha2 = "0.10"
|
|||
image = { version = "=0.25.10", default-features = false, features = ["png", "jpeg", "webp", "gif", "bmp", "tiff"] }
|
||||
hayro = "=0.9.0"
|
||||
chrono = "0.4"
|
||||
keepawake = "=0.6.1"
|
||||
rfd = "=0.15.4"
|
||||
sysinfo = { version = "=0.37.2", default-features = false, features = ["system"] }
|
||||
zip = { version = "2", default-features = false, features = ["deflate"] }
|
||||
|
||||
[target.'cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))'.dependencies]
|
||||
keepawake = "=0.6.1"
|
||||
|
||||
[target.'cfg(unix)'.dependencies]
|
||||
libc = "0.2"
|
||||
|
Before Width: | Height: | Size: 364 KiB After Width: | Height: | Size: 364 KiB |
|
Before Width: | Height: | Size: 1.4 MiB After Width: | Height: | Size: 1.4 MiB |
|
|
@ -0,0 +1,97 @@
|
|||
Noto Sans: Copyright 2022 The Noto Project Authors (https://github.com/notofonts/latin-greek-cyrillic)
|
||||
Noto Sans CJK: Copyright 2014-2021 Adobe (http://www.adobe.com/).
|
||||
Noto Sans Devanagari: Copyright 2022 The Noto Project Authors (https://github.com/notofonts/devanagari)
|
||||
Noto Sans Thai: Copyright 2022 The Noto Project Authors (https://github.com/notofonts/thai)
|
||||
|
||||
This Font Software is licensed under the SIL Open Font License,
|
||||
Version 1.1.
|
||||
|
||||
This license is copied below, and is also available with a FAQ at:
|
||||
http://scripts.sil.org/OFL
|
||||
|
||||
-----------------------------------------------------------
|
||||
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
||||
-----------------------------------------------------------
|
||||
|
||||
PREAMBLE
|
||||
The goals of the Open Font License (OFL) are to stimulate worldwide
|
||||
development of collaborative font projects, to support the font
|
||||
creation efforts of academic and linguistic communities, and to
|
||||
provide a free and open framework in which fonts may be shared and
|
||||
improved in partnership with others.
|
||||
|
||||
The OFL allows the licensed fonts to be used, studied, modified and
|
||||
redistributed freely as long as they are not sold by themselves. The
|
||||
fonts, including any derivative works, can be bundled, embedded,
|
||||
redistributed and/or sold with any software provided that any reserved
|
||||
names are not used by derivative works. The fonts and derivatives,
|
||||
however, cannot be released under any other type of license. The
|
||||
requirement for fonts to remain under this license does not apply to
|
||||
any document created using the fonts or their derivatives.
|
||||
|
||||
DEFINITIONS
|
||||
"Font Software" refers to the set of files released by the Copyright
|
||||
Holder(s) under this license and clearly marked as such. This may
|
||||
include source files, build scripts and documentation.
|
||||
|
||||
"Reserved Font Name" refers to any names specified as such after the
|
||||
copyright statement(s).
|
||||
|
||||
"Original Version" refers to the collection of Font Software
|
||||
components as distributed by the Copyright Holder(s).
|
||||
|
||||
"Modified Version" refers to any derivative made by adding to,
|
||||
deleting, or substituting -- in part or in whole -- any of the
|
||||
components of the Original Version, by changing formats or by porting
|
||||
the Font Software to a new environment.
|
||||
|
||||
"Author" refers to any designer, engineer, programmer, technical
|
||||
writer or other person who contributed to the Font Software.
|
||||
|
||||
PERMISSION & CONDITIONS
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of the Font Software, to use, study, copy, merge, embed,
|
||||
modify, redistribute, and sell modified and unmodified copies of the
|
||||
Font Software, subject to the following conditions:
|
||||
|
||||
1) Neither the Font Software nor any of its individual components, in
|
||||
Original or Modified Versions, may be sold by itself.
|
||||
|
||||
2) Original or Modified Versions of the Font Software may be bundled,
|
||||
redistributed and/or sold with any software, provided that each copy
|
||||
contains the above copyright notice and this license. These can be
|
||||
included either as stand-alone text files, human-readable headers or
|
||||
in the appropriate machine-readable metadata fields within text or
|
||||
binary files as long as those fields can be easily viewed by the user.
|
||||
|
||||
3) No Modified Version of the Font Software may use the Reserved Font
|
||||
Name(s) unless explicit written permission is granted by the
|
||||
corresponding Copyright Holder. This restriction only applies to the
|
||||
primary font name as presented to the users.
|
||||
|
||||
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
||||
Software shall not be used to promote, endorse or advertise any
|
||||
Modified Version, except to acknowledge the contribution(s) of the
|
||||
Copyright Holder(s) and the Author(s) or with their explicit written
|
||||
permission.
|
||||
|
||||
5) The Font Software, modified or unmodified, in part or in whole,
|
||||
must be distributed entirely under this license, and must not be
|
||||
distributed under any other license. The requirement for fonts to
|
||||
remain under this license does not apply to any document created using
|
||||
the Font Software.
|
||||
|
||||
TERMINATION
|
||||
This license becomes null and void if any of the above conditions are
|
||||
not met.
|
||||
|
||||
DISCLAIMER
|
||||
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
||||
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
||||
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
||||
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
||||
OTHER DEALINGS IN THE FONT SOFTWARE.
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
# Embedded CJK font
|
||||
|
||||
`NotoSansCJK-Regular.ttc` is the unmodified Noto Sans CJK 2.004 collection used by
|
||||
Canvas Pilot, under the included [SIL Open Font License 1.1](OFL.txt). Upstream:
|
||||
<https://github.com/notofonts/noto-cjk/releases/tag/Sans2.004>.
|
||||
|
||||
SHA-256: `b76b0433203017ca80401b2ee0dd69350349871c4b19d504c34dbdd80541690a`.
|
||||
|
||||
Deckstride uses collection index 0 for Japanese and index 2 for Simplified
|
||||
Chinese. The collection is embedded in the executable; no runtime font lookup or
|
||||
download occurs. Font definitions are installed only when a CJK interface language
|
||||
is active and only when the language selection changes. Other interface languages
|
||||
retain egui's existing embedded fonts.
|
||||
|
Before Width: | Height: | Size: 54 KiB After Width: | Height: | Size: 54 KiB |
|
|
@ -16,8 +16,8 @@ pub(crate) fn window_attributes() -> WindowAttributes {
|
|||
let attributes = {
|
||||
use winit::platform::{wayland::WindowAttributesExtWayland, x11::WindowAttributesExtX11};
|
||||
let attributes =
|
||||
WindowAttributesExtWayland::with_name(attributes, "pdf-presenter", "pdf-presenter");
|
||||
WindowAttributesExtX11::with_name(attributes, "pdf-presenter", "pdf-presenter")
|
||||
WindowAttributesExtWayland::with_name(attributes, "deckstride", "deckstride");
|
||||
WindowAttributesExtX11::with_name(attributes, "deckstride", "deckstride")
|
||||
};
|
||||
attributes
|
||||
}
|
||||
|
|
@ -0,0 +1,122 @@
|
|||
//! Bounded, worker-only preparation of the optional blank-screen picture.
|
||||
use crate::{
|
||||
document::{Frame, FrameInfo},
|
||||
worker::{Bridge, Request},
|
||||
};
|
||||
use sha2::{Digest, Sha256};
|
||||
use std::{
|
||||
path::{Path, PathBuf},
|
||||
sync::Arc,
|
||||
time::Duration,
|
||||
};
|
||||
|
||||
const EDGE: u32 = 2048;
|
||||
const MAX_RGBA: usize = EDGE as usize * EDGE as usize * 4;
|
||||
|
||||
/// Copy/normalize a selected image, or load the existing managed copy.
|
||||
/// Call only in a supervised worker (or tests), never on an input/UI path.
|
||||
pub fn prepare(source: Option<&Path>, path: &Path) -> Result<Frame, String> {
|
||||
if let Some(source) = source {
|
||||
let bytes = crate::document::read_limited(source, 64 * 1024 * 1024)?;
|
||||
let mut reader = image::ImageReader::new(std::io::Cursor::new(bytes))
|
||||
.with_guessed_format()
|
||||
.map_err(|e| e.to_string())?;
|
||||
let mut limits = image::Limits::default();
|
||||
limits.max_alloc = Some(256 * 1024 * 1024);
|
||||
limits.max_image_width = Some(32768);
|
||||
limits.max_image_height = Some(32768);
|
||||
reader.limits(limits);
|
||||
let image = reader.decode().map_err(|e| e.to_string())?;
|
||||
let image = if image.width() > EDGE || image.height() > EDGE {
|
||||
image.resize(EDGE, EDGE, image::imageops::FilterType::Triangle)
|
||||
} else {
|
||||
image
|
||||
}
|
||||
.to_rgba8();
|
||||
let mut data = Vec::with_capacity(image.len() + 40);
|
||||
data.extend(image.width().to_le_bytes());
|
||||
data.extend(image.height().to_le_bytes());
|
||||
data.extend(image.as_raw());
|
||||
data.extend(Sha256::digest(&data));
|
||||
crate::settings::atomic_write(path, &data)?;
|
||||
}
|
||||
let data = crate::document::read_limited(path, (MAX_RGBA + 40) as u64)?;
|
||||
if data.len() < 40 {
|
||||
return Err("Truncated blank picture".into());
|
||||
}
|
||||
let width = u32::from_le_bytes(data[..4].try_into().unwrap());
|
||||
let height = u32::from_le_bytes(data[4..8].try_into().unwrap());
|
||||
crate::document::validate_frame(width, height, data.len() - 40)?;
|
||||
if width > EDGE || height > EDGE {
|
||||
return Err("Blank picture exceeds 2048 pixels per edge".into());
|
||||
}
|
||||
let end = data.len() - 32;
|
||||
let hash = Sha256::digest(&data[..end]);
|
||||
if hash.as_slice() != &data[end..] {
|
||||
return Err("Blank picture checksum mismatch".into());
|
||||
}
|
||||
Ok(Frame {
|
||||
info: FrameInfo {
|
||||
page: 0,
|
||||
width,
|
||||
height,
|
||||
path: path.into(),
|
||||
sha256: format!("{hash:x}"),
|
||||
},
|
||||
rgba: data[8..end].to_vec(),
|
||||
})
|
||||
}
|
||||
|
||||
/// Output-side loading is independent of slide reads and never reports a picture as a slide.
|
||||
#[derive(Default)]
|
||||
pub struct Output {
|
||||
requested: Option<FrameInfo>,
|
||||
loader: Option<Bridge>,
|
||||
pub picture: Option<Arc<Frame>>,
|
||||
}
|
||||
impl Output {
|
||||
pub fn set(&mut self, info: Option<&FrameInfo>) -> bool {
|
||||
if self.requested.as_ref().map(identity) == info.map(identity) {
|
||||
return false;
|
||||
}
|
||||
self.requested = info.cloned();
|
||||
self.picture = None;
|
||||
self.loader = info.map(|info| {
|
||||
let loader = Bridge::new(Duration::from_secs(10));
|
||||
loader.submit(
|
||||
0,
|
||||
0,
|
||||
Request::BlankPicture {
|
||||
source: None,
|
||||
path: info.path.clone(),
|
||||
},
|
||||
);
|
||||
loader
|
||||
});
|
||||
true
|
||||
}
|
||||
pub fn poll(&mut self) -> Option<Result<(), String>> {
|
||||
let completion = self.loader.as_ref()?.rx.try_recv().ok()?;
|
||||
self.loader = None;
|
||||
Some((|| {
|
||||
let packet = completion.result?;
|
||||
if let Some(error) = packet.reply.error {
|
||||
return Err(error);
|
||||
}
|
||||
let info = packet.reply.frame.ok_or("Missing blank picture")?;
|
||||
if self.requested.as_ref().map(identity) != Some(identity(&info)) {
|
||||
return Err(
|
||||
"Blank picture changed while loading; choose it again to retry.".into(),
|
||||
);
|
||||
}
|
||||
self.picture = Some(Arc::new(Frame {
|
||||
info,
|
||||
rgba: packet.data,
|
||||
}));
|
||||
Ok(())
|
||||
})())
|
||||
}
|
||||
}
|
||||
fn identity(info: &FrameInfo) -> (&PathBuf, &str, u32, u32) {
|
||||
(&info.path, &info.sha256, info.width, info.height)
|
||||
}
|
||||
|
|
@ -0,0 +1,209 @@
|
|||
//! Bounded worker-only maintenance of disposable rendered slide files.
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::{
|
||||
fs::{self, File, OpenOptions},
|
||||
path::{Path, PathBuf},
|
||||
time::{Duration, SystemTime},
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct Policy {
|
||||
pub max_mib: u32,
|
||||
pub max_days: u32,
|
||||
}
|
||||
impl Default for Policy {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
max_mib: 10240,
|
||||
max_days: 30,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl Policy {
|
||||
pub fn validate(&self) -> Result<(), String> {
|
||||
if !(64..=1048576).contains(&self.max_mib) || !(1..=3650).contains(&self.max_days) {
|
||||
return Err("Disk cache must be 64–1048576 MiB and 1–3650 days".into());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
#[derive(Default, Serialize, Deserialize)]
|
||||
pub struct Report {
|
||||
pub removed_bytes: u64,
|
||||
pub remaining_bytes: u64,
|
||||
pub removed_files: usize,
|
||||
pub skipped_files: usize,
|
||||
}
|
||||
|
||||
fn lock_file(project: &Path) -> Result<File, String> {
|
||||
let path = project.join(".lease-v1");
|
||||
if fs::symlink_metadata(&path).is_ok_and(|m| !m.is_file()) {
|
||||
return Err("Invalid cache lease file".into());
|
||||
}
|
||||
OpenOptions::new()
|
||||
.read(true)
|
||||
.write(true)
|
||||
.create(true)
|
||||
.truncate(false)
|
||||
.open(path)
|
||||
.map_err(|e| e.to_string())
|
||||
}
|
||||
/// Scoped OS lock, explicitly unlocked before close so a concurrent fork cannot
|
||||
/// accidentally prolong ownership until the child execs.
|
||||
pub struct Lease(File);
|
||||
impl Drop for Lease {
|
||||
fn drop(&mut self) {
|
||||
let _ = self.0.unlock();
|
||||
}
|
||||
}
|
||||
/// A live document holds a shared OS lock; process exit releases it automatically.
|
||||
pub fn lease(cache: &Path, key: &str) -> Result<Lease, String> {
|
||||
let project = cache.join(key);
|
||||
fs::create_dir_all(&project).map_err(|e| e.to_string())?;
|
||||
let file = lock_file(&project)?;
|
||||
// Only a killable worker waits here, never an input/event loop.
|
||||
file.lock_shared().map_err(|e| e.to_string())?;
|
||||
Ok(Lease(file))
|
||||
}
|
||||
fn hash_name(path: &Path) -> bool {
|
||||
path.file_name()
|
||||
.and_then(|s| s.to_str())
|
||||
.is_some_and(|s| s.len() == 64 && s.bytes().all(|b| b.is_ascii_hexdigit()))
|
||||
}
|
||||
fn artifact(path: &Path) -> bool {
|
||||
let Some(name) = path.file_name().and_then(|s| s.to_str()) else {
|
||||
return false;
|
||||
};
|
||||
let Some((page, rest)) = name.split_once('-') else {
|
||||
return false;
|
||||
};
|
||||
let Some((edge, suffix)) = rest.split_once('-') else {
|
||||
return false;
|
||||
};
|
||||
page.parse::<usize>().is_ok()
|
||||
&& edge.parse::<u32>().is_ok()
|
||||
&& matches!(
|
||||
suffix,
|
||||
"hayro09.rgba" | "hayro09-straight.rgba" | "extraction.json"
|
||||
)
|
||||
}
|
||||
struct Entry {
|
||||
path: PathBuf,
|
||||
project: PathBuf,
|
||||
bytes: u64,
|
||||
modified: SystemTime,
|
||||
}
|
||||
/// Expire by artifact modification time, then evict oldest first to the byte target.
|
||||
/// Manual expunge removes all eligible artifacts. Active projects are always retained.
|
||||
pub fn clean(
|
||||
root: &Path,
|
||||
policy: &Policy,
|
||||
protected: &[String],
|
||||
manual: bool,
|
||||
now: SystemTime,
|
||||
) -> Result<Report, String> {
|
||||
policy.validate()?;
|
||||
match fs::symlink_metadata(root) {
|
||||
Err(e) if e.kind() == std::io::ErrorKind::NotFound => return Ok(Report::default()),
|
||||
Ok(m) if m.is_dir() => (),
|
||||
_ => return Err("Cache root is not a regular directory".into()),
|
||||
}
|
||||
let mut entries = Vec::new();
|
||||
let mut report = Report::default();
|
||||
let mut visited = 0usize;
|
||||
// Fixed depth and entry ceiling bound memory, including unexpected entries.
|
||||
let mut scan = vec![(root.to_owned(), 0)];
|
||||
while let Some((dir, depth)) = scan.pop() {
|
||||
for item in fs::read_dir(&dir).map_err(|e| e.to_string())? {
|
||||
visited += 1;
|
||||
if visited > 200_000 {
|
||||
return Err("Cache scan exceeds 200000 entries; cleanup stopped".into());
|
||||
}
|
||||
let item = item.map_err(|e| e.to_string())?;
|
||||
let kind = item.file_type().map_err(|e| e.to_string())?;
|
||||
let path = item.path();
|
||||
if depth < 2 && kind.is_dir() && hash_name(&path) {
|
||||
scan.push((path, depth + 1));
|
||||
} else if depth == 2 && kind.is_file() {
|
||||
let meta = item.metadata().map_err(|e| e.to_string())?;
|
||||
report.remaining_bytes = report.remaining_bytes.saturating_add(meta.len());
|
||||
if artifact(&path) {
|
||||
entries.push(Entry {
|
||||
path,
|
||||
project: dir.parent().unwrap().to_owned(),
|
||||
bytes: meta.len(),
|
||||
modified: meta.modified().map_err(|e| e.to_string())?,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
entries.sort_by(|a, b| {
|
||||
a.modified
|
||||
.cmp(&b.modified)
|
||||
.then_with(|| a.path.cmp(&b.path))
|
||||
});
|
||||
let max_bytes = u64::from(policy.max_mib) * 1024 * 1024;
|
||||
let lifetime = Duration::from_secs(u64::from(policy.max_days) * 86400);
|
||||
for entry in entries {
|
||||
if !manual
|
||||
&& report.remaining_bytes <= max_bytes
|
||||
&& now.duration_since(entry.modified).unwrap_or_default() < lifetime
|
||||
{
|
||||
continue;
|
||||
}
|
||||
let key = entry.project.file_name().unwrap().to_string_lossy();
|
||||
if protected.iter().any(|p| p == &key) {
|
||||
report.skipped_files += 1;
|
||||
continue;
|
||||
}
|
||||
let lock = lock_file(&entry.project)?;
|
||||
match lock.try_lock() {
|
||||
Ok(()) => (),
|
||||
Err(std::fs::TryLockError::WouldBlock) => {
|
||||
report.skipped_files += 1;
|
||||
continue;
|
||||
}
|
||||
Err(e) => return Err(e.to_string()),
|
||||
}
|
||||
let _lease = Lease(lock);
|
||||
// Recheck after obtaining the lock: a worker may have replaced this artifact.
|
||||
let meta = match fs::symlink_metadata(&entry.path) {
|
||||
Ok(m) => m,
|
||||
Err(e) if e.kind() == std::io::ErrorKind::NotFound => continue,
|
||||
Err(e) => return Err(e.to_string()),
|
||||
};
|
||||
if !meta.is_file()
|
||||
|| meta.len() != entry.bytes
|
||||
|| meta.modified().ok() != Some(entry.modified)
|
||||
{
|
||||
report.skipped_files += 1;
|
||||
continue;
|
||||
}
|
||||
fs::remove_file(&entry.path).map_err(|e| e.to_string())?;
|
||||
report.removed_bytes += entry.bytes;
|
||||
report.remaining_bytes = report.remaining_bytes.saturating_sub(entry.bytes);
|
||||
report.removed_files += 1;
|
||||
// Never remove project/lease files: unlinking a lock could split ownership.
|
||||
let _ = fs::remove_dir(entry.path.parent().unwrap());
|
||||
}
|
||||
Ok(report)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
#[test]
|
||||
fn scoped_release_is_not_prolonged_by_a_duplicated_descriptor() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let key = format!("{:064x}", 1);
|
||||
let lease = lease(temp.path(), &key).unwrap();
|
||||
let inherited = lease.0.try_clone().unwrap();
|
||||
drop(lease);
|
||||
let exclusive = lock_file(&temp.path().join(key)).unwrap();
|
||||
exclusive.try_lock().unwrap();
|
||||
drop(Lease(exclusive));
|
||||
drop(inherited);
|
||||
}
|
||||
}
|
||||
|
|
@ -210,13 +210,13 @@ impl App {
|
|||
if self.presenter.is_none() {
|
||||
self.presenter = Some(NativeWindow::create(
|
||||
event_loop,
|
||||
"PDF Presenter - presenter controls",
|
||||
"Deckstride - presenter controls",
|
||||
)?);
|
||||
}
|
||||
if self.audience.is_none() {
|
||||
self.audience = Some(NativeWindow::create(
|
||||
event_loop,
|
||||
"PDF Presenter - mock audience output",
|
||||
"Deckstride - mock audience output",
|
||||
)?);
|
||||
}
|
||||
self.place();
|
||||
|
|
@ -43,6 +43,7 @@ pub struct Document {
|
|||
pub info: DeckInfo,
|
||||
source: Source,
|
||||
cache: PathBuf,
|
||||
_cache_lease: crate::cache::Lease,
|
||||
}
|
||||
enum Source {
|
||||
Pdf(Pdf),
|
||||
|
|
@ -120,6 +121,7 @@ impl Document {
|
|||
fn open_inner(path: &Path, cache: PathBuf, load_notes: bool) -> Result<Self, String> {
|
||||
let path = std::fs::canonicalize(path).map_err(|e| e.to_string())?;
|
||||
let key = settings::project_key(&path);
|
||||
let cache_lease = crate::cache::lease(&cache, &key)?;
|
||||
let mut warnings = vec![];
|
||||
let mut notes = vec![];
|
||||
let names;
|
||||
|
|
@ -244,6 +246,9 @@ impl Document {
|
|||
}
|
||||
source = Source::Pdf(pdf);
|
||||
}
|
||||
if load_notes && let Err(error) = crate::notes::overlay(&path, &names, &mut notes) {
|
||||
warnings.push(format!("Presentation notes: {error}"));
|
||||
}
|
||||
let title = path
|
||||
.file_name()
|
||||
.unwrap_or_default()
|
||||
|
|
@ -262,6 +267,7 @@ impl Document {
|
|||
info,
|
||||
source,
|
||||
cache,
|
||||
_cache_lease: cache_lease,
|
||||
})
|
||||
}
|
||||
pub fn render(&self, page: usize, edge: u32) -> Result<Frame, String> {
|
||||
|
|
@ -66,6 +66,8 @@ pub mod poc;
|
|||
pub mod document;
|
||||
/// Native persistent configuration.
|
||||
pub mod settings;
|
||||
/// Optional per-user Windows shell integration for the portable executable.
|
||||
pub mod windows_integration;
|
||||
/// Isolated background processes.
|
||||
pub mod worker;
|
||||
|
||||
|
|
@ -80,7 +82,29 @@ pub mod studio;
|
|||
|
||||
/// Presenter interface language.
|
||||
pub mod localization;
|
||||
/// Bounded runtime language and theme packs.
|
||||
pub mod packs;
|
||||
/// Standalone presenter palettes.
|
||||
pub mod theme;
|
||||
|
||||
mod artwork;
|
||||
|
||||
/// Monotonic elapsed/countdown timer.
|
||||
pub mod timer;
|
||||
|
||||
/// Bounded vector pointer and presentation annotations.
|
||||
pub mod tools;
|
||||
|
||||
/// Editable presentation notes sidecars.
|
||||
pub mod notes;
|
||||
|
||||
pub mod zoom;
|
||||
|
||||
/// Disk cache retention and worker-only cleanup.
|
||||
pub mod cache;
|
||||
|
||||
/// Bounded held-input slide navigation.
|
||||
pub mod navigation;
|
||||
|
||||
/// Optional custom blank-screen picture.
|
||||
pub mod blank;
|
||||
|
|
@ -1,4 +1,9 @@
|
|||
use pdf_presenter::{native, poc::Options};
|
||||
#![cfg_attr(
|
||||
all(target_os = "windows", not(debug_assertions)),
|
||||
windows_subsystem = "windows"
|
||||
)]
|
||||
|
||||
use deckstride::{native, poc::Options};
|
||||
|
||||
fn main() {
|
||||
if std::env::args().nth(1).as_deref() == Some("--licenses") {
|
||||
|
|
@ -6,7 +11,7 @@ fn main() {
|
|||
return;
|
||||
}
|
||||
if std::env::args().nth(1).as_deref() == Some("--worker") {
|
||||
if let Err(e) = pdf_presenter::worker::run() {
|
||||
if let Err(e) = deckstride::worker::run() {
|
||||
eprintln!("{e}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
|
@ -20,7 +25,7 @@ fn main() {
|
|||
return;
|
||||
}
|
||||
if std::env::args().nth(1).as_deref() == Some("--keep-awake") {
|
||||
let _ = pdf_presenter::output::keep_awake();
|
||||
let _ = deckstride::output::keep_awake();
|
||||
return;
|
||||
}
|
||||
let mut args = std::env::args().skip(1).collect::<Vec<_>>();
|
||||
|
|
@ -48,14 +53,16 @@ fn main() {
|
|||
};
|
||||
if options.help {
|
||||
println!(
|
||||
"PDF Presenter {} — native PDF and picture-folder presenter\n\
|
||||
Usage: pdf-presenter [--open PDF_OR_FOLDER] [--windowed]\n\
|
||||
pdf-presenter --list-monitors\n\
|
||||
pdf-presenter --presenter N --audience N\n\
|
||||
pdf-presenter --smoke-test\n\
|
||||
"Deckstride {} — native PDF and picture-folder presenter\n\
|
||||
Usage: deckstride [--open PDF_OR_FOLDER] [--windowed]\n\
|
||||
deckstride --list-monitors\n\
|
||||
deckstride --presenter N --audience N\n\
|
||||
deckstride --smoke-test\n\
|
||||
Both roles start fullscreen. Select/mirror screens from Displays.\n\
|
||||
Keys: arrows/space navigate, number + Enter jumps, B blanks, Escape cancels\n\
|
||||
or safely leaves fullscreen. Right-click restores hidden header/footer.\n\
|
||||
Keys: arrows/space navigate, number + Enter jumps, B blanks.\n\
|
||||
Escape/Ctrl+Q request quit confirmation; Escape first reverts a display trial.\n\
|
||||
Hold S for one second to swap Presenter/Slides groups.\n\
|
||||
Fullscreen uses explicit controls; right-click restores hidden header/footer.\n\
|
||||
All slides opens a windowed browser; click only selects unless enabled.\n\
|
||||
PDF/image decoding runs in supervised workers; no external PDF backend needed.",
|
||||
env!("CARGO_PKG_VERSION")
|
||||
|
|
@ -63,12 +70,12 @@ PDF/image decoding runs in supervised workers; no external PDF backend needed.",
|
|||
return;
|
||||
}
|
||||
let result = if proof {
|
||||
pdf_presenter::desktop::run(options)
|
||||
deckstride::desktop::run(options)
|
||||
} else {
|
||||
native::run(options, path)
|
||||
};
|
||||
if let Err(error) = result {
|
||||
eprintln!("PDF Presenter could not start/continue: {error}");
|
||||
eprintln!("Deckstride could not start/continue: {error}");
|
||||
std::process::exit(1);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
//! Constant-memory hold acceleration, independent of OS keyboard repeat rates.
|
||||
use std::time::{Duration, Instant};
|
||||
#[derive(Clone, Copy, Debug)]
|
||||
pub struct Hold {
|
||||
pub direction: i32,
|
||||
started: Instant,
|
||||
next: Instant,
|
||||
}
|
||||
impl Hold {
|
||||
/// The caller performs the initial single step immediately.
|
||||
pub fn new(direction: i32, now: Instant) -> Self {
|
||||
Self {
|
||||
direction: direction.signum(),
|
||||
started: now,
|
||||
next: now + Duration::from_millis(400),
|
||||
}
|
||||
}
|
||||
/// Native hosts can redraw a held button only when its next step is due.
|
||||
pub fn due(&self, now: Instant) -> bool {
|
||||
now >= self.next
|
||||
}
|
||||
/// At most one step per call; stalled event loops never replay missed steps.
|
||||
pub fn tick(&mut self, now: Instant, count: usize) -> Option<i32> {
|
||||
if !self.due(now) {
|
||||
return None;
|
||||
}
|
||||
let elapsed = now.saturating_duration_since(self.started);
|
||||
let (batch, interval) = if elapsed >= Duration::from_secs(5) {
|
||||
(10, 160)
|
||||
} else if elapsed >= Duration::from_secs(2) {
|
||||
(5, 160)
|
||||
} else {
|
||||
(1, 100)
|
||||
};
|
||||
self.next = now + Duration::from_millis(interval);
|
||||
let batch = batch.min((count / 10).clamp(1, 10));
|
||||
Some(self.direction * batch as i32)
|
||||
}
|
||||
}
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
#[test]
|
||||
fn delay_acceleration_small_decks_and_stalls_are_bounded() {
|
||||
let t = Instant::now();
|
||||
let mut h = Hold::new(1, t);
|
||||
assert!(!h.due(t + Duration::from_millis(399)));
|
||||
assert!(h.due(t + Duration::from_millis(400)));
|
||||
assert_eq!(h.tick(t + Duration::from_millis(399), 500), None);
|
||||
assert_eq!(h.tick(t + Duration::from_millis(400), 500), Some(1));
|
||||
assert_eq!(h.tick(t + Duration::from_secs(2), 500), Some(5));
|
||||
assert_eq!(h.tick(t + Duration::from_secs(5), 500), Some(10));
|
||||
assert_eq!(h.tick(t + Duration::from_secs(60), 500), Some(10));
|
||||
assert_eq!(h.tick(t + Duration::from_secs(60), 500), None);
|
||||
let mut reverse = Hold::new(-1, t);
|
||||
assert_eq!(reverse.tick(t + Duration::from_secs(6), 15), Some(-1));
|
||||
assert_eq!(reverse.tick(t + Duration::from_secs(7), 30), Some(-3));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,357 @@
|
|||
//! Versioned presenter-only notes sidecars. All I/O runs in isolated workers.
|
||||
use crate::document::{DeckInfo, Document, read_limited};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sha2::{Digest, Sha256};
|
||||
use std::{
|
||||
collections::BTreeMap,
|
||||
io::Write,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
pub const MAX_NOTE: usize = 256 * 1024;
|
||||
const MAX_TEXT: usize = 8 * 1024 * 1024;
|
||||
const MAX_FILE: u64 = 16 * 1024 * 1024;
|
||||
#[derive(Serialize, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct NotesFile {
|
||||
version: u32,
|
||||
notes: BTreeMap<String, String>,
|
||||
}
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct Snapshot {
|
||||
pub path: PathBuf,
|
||||
pub revision: String,
|
||||
pub notes: Vec<String>,
|
||||
}
|
||||
/// PDF: sibling `talk.notes.toml`; image folder: sibling `folder.notes.toml`.
|
||||
/// Called only in workers, because distinguishing folders requires filesystem access.
|
||||
pub fn sidecar_path(source: &Path) -> PathBuf {
|
||||
if source.is_dir() {
|
||||
let mut name = source.file_name().unwrap_or_default().to_os_string();
|
||||
name.push(".notes.toml");
|
||||
source.with_file_name(name)
|
||||
} else {
|
||||
source.with_extension("notes.toml")
|
||||
}
|
||||
}
|
||||
fn keys(source: &Path, names: &[String]) -> Vec<String> {
|
||||
if source.is_dir() {
|
||||
names.to_vec()
|
||||
} else {
|
||||
(1..=names.len()).map(|n| n.to_string()).collect()
|
||||
}
|
||||
}
|
||||
fn revision(bytes: &[u8]) -> String {
|
||||
format!("{:x}", Sha256::digest(bytes))
|
||||
}
|
||||
fn validate(file: &NotesFile) -> Result<(), String> {
|
||||
if file.version != 1 {
|
||||
return Err(format!("Unsupported notes version {}", file.version));
|
||||
}
|
||||
if file.notes.len() > 10000
|
||||
|| file.notes.values().any(|n| n.len() > MAX_NOTE)
|
||||
|| file.notes.values().map(String::len).sum::<usize>() > MAX_TEXT
|
||||
{
|
||||
return Err("Notes exceed limits (256 KiB per slide, 8 MiB total, 10000 entries)".into());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
fn read(path: &Path) -> Result<Option<(NotesFile, Vec<u8>)>, String> {
|
||||
match std::fs::symlink_metadata(path) {
|
||||
Err(e) if e.kind() == std::io::ErrorKind::NotFound => return Ok(None),
|
||||
Err(e) => return Err(e.to_string()),
|
||||
Ok(meta) if !meta.file_type().is_file() => {
|
||||
return Err("Notes sidecar must be a regular file, not a symlink or directory".into());
|
||||
}
|
||||
_ => {}
|
||||
}
|
||||
let bytes = read_limited(path, MAX_FILE)?;
|
||||
let file: NotesFile = toml::from_str(std::str::from_utf8(&bytes).map_err(|e| e.to_string())?)
|
||||
.map_err(|e| e.to_string())?;
|
||||
validate(&file)?;
|
||||
Ok(Some((file, bytes)))
|
||||
}
|
||||
/// Named sidecar entries override extracted notes, including explicitly empty entries.
|
||||
pub fn overlay(source: &Path, names: &[String], notes: &mut [String]) -> Result<(), String> {
|
||||
if let Some((file, _)) = read(&sidecar_path(source))? {
|
||||
let mut merged = notes.to_vec();
|
||||
for (key, note) in keys(source, names).iter().zip(&mut merged) {
|
||||
if let Some(value) = file.notes.get(key) {
|
||||
*note = value.clone();
|
||||
}
|
||||
}
|
||||
if merged.iter().map(String::len).sum::<usize>() > MAX_TEXT {
|
||||
return Err("Combined notes exceed 8 MiB".into());
|
||||
}
|
||||
notes.clone_from_slice(&merged);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
type LoadedNotes = (DeckInfo, Option<(NotesFile, Vec<u8>)>);
|
||||
fn document(source: &Path, cache: PathBuf, expected_source: &str) -> Result<LoadedNotes, String> {
|
||||
let path = sidecar_path(source);
|
||||
let before = read(&path)?;
|
||||
let info = Document::open(source, cache)?.info;
|
||||
if info.sha256 != expected_source {
|
||||
return Err("Presentation changed on disk. Reopen it before editing notes.".into());
|
||||
}
|
||||
if let Some(warning) = info
|
||||
.warnings
|
||||
.iter()
|
||||
.find(|w| w.starts_with("Presentation notes:"))
|
||||
{
|
||||
return Err(warning.clone());
|
||||
}
|
||||
let after = read(&path)?;
|
||||
if before.as_ref().map(|(_, b)| b) != after.as_ref().map(|(_, b)| b) {
|
||||
return Err("Notes changed while loading. Retry to read the latest notes.".into());
|
||||
}
|
||||
Ok((info, after))
|
||||
}
|
||||
fn bytes(file: &NotesFile) -> Result<Vec<u8>, String> {
|
||||
validate(file)?;
|
||||
let bytes = toml::to_string_pretty(file)
|
||||
.map_err(|e| e.to_string())?
|
||||
.into_bytes();
|
||||
if bytes.len() as u64 > MAX_FILE {
|
||||
return Err("Serialized notes exceed 16 MiB".into());
|
||||
}
|
||||
Ok(bytes)
|
||||
}
|
||||
fn temporary(path: &Path, bytes: &[u8]) -> Result<tempfile::NamedTempFile, String> {
|
||||
let mut file = tempfile::NamedTempFile::new_in(path.parent().ok_or("No notes parent folder")?)
|
||||
.map_err(|e| e.to_string())?;
|
||||
file.write_all(bytes)
|
||||
.and_then(|_| file.as_file().sync_all())
|
||||
.map_err(|e| e.to_string())?;
|
||||
Ok(file)
|
||||
}
|
||||
pub fn prepare(source: &Path, cache: PathBuf, expected_source: &str) -> Result<Snapshot, String> {
|
||||
let (info, existing) = document(source, cache, expected_source)?;
|
||||
let path = sidecar_path(&info.path);
|
||||
let bytes = match existing {
|
||||
Some((_, bytes)) => bytes,
|
||||
None => {
|
||||
let file = NotesFile {
|
||||
version: 1,
|
||||
notes: keys(&info.path, &info.names)
|
||||
.into_iter()
|
||||
.zip(info.notes.iter().cloned())
|
||||
.collect(),
|
||||
};
|
||||
let bytes = bytes(&file)?;
|
||||
// Never replace a sidecar that appeared while extraction was running.
|
||||
temporary(&path, &bytes)?
|
||||
.persist_noclobber(&path)
|
||||
.map_err(|e| {
|
||||
format!("Could not create notes (retry if the file appeared meanwhile): {e}")
|
||||
})?;
|
||||
bytes
|
||||
}
|
||||
};
|
||||
Ok(Snapshot {
|
||||
path,
|
||||
revision: revision(&bytes),
|
||||
notes: info.notes,
|
||||
})
|
||||
}
|
||||
pub fn save(
|
||||
source: &Path,
|
||||
cache: PathBuf,
|
||||
expected_source: &str,
|
||||
expected_revision: &str,
|
||||
page: usize,
|
||||
text: String,
|
||||
) -> Result<Snapshot, String> {
|
||||
if text.len() > MAX_NOTE {
|
||||
return Err("This note exceeds 256 KiB".into());
|
||||
}
|
||||
let (mut info, existing) = document(source, cache, expected_source)?;
|
||||
let key = keys(&info.path, &info.names)
|
||||
.get(page)
|
||||
.cloned()
|
||||
.ok_or("Slide no longer exists")?;
|
||||
let path = sidecar_path(&info.path);
|
||||
let (mut file, previous) = existing.ok_or("Notes file was removed. Reload before saving.")?;
|
||||
if revision(&previous) != expected_revision {
|
||||
return Err("Notes changed on disk. Copy your edits, then reload before saving.".into());
|
||||
}
|
||||
info.notes[page] = text.clone();
|
||||
if info.notes.iter().map(String::len).sum::<usize>() > MAX_TEXT {
|
||||
return Err("Combined notes exceed 8 MiB; changes were not saved.".into());
|
||||
}
|
||||
file.notes.insert(key, text.clone());
|
||||
let bytes = bytes(&file)?;
|
||||
let temp = temporary(&path, &bytes)?;
|
||||
let (_, latest) = read(&path)?.ok_or("Notes file was removed while saving")?;
|
||||
if latest != previous {
|
||||
return Err("Notes changed while saving; edits were not written.".into());
|
||||
}
|
||||
temp.persist(&path).map_err(|e| e.to_string())?;
|
||||
Ok(Snapshot {
|
||||
path,
|
||||
revision: revision(&bytes),
|
||||
notes: info.notes,
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
pub struct ImportPreview {
|
||||
pub path: PathBuf,
|
||||
pub revision: Option<String>,
|
||||
pub sections: Vec<String>,
|
||||
pub total: usize,
|
||||
}
|
||||
/// Recognize imports without filesystem access on the input thread.
|
||||
pub fn is_import(path: &Path) -> bool {
|
||||
path.extension()
|
||||
.and_then(|s| s.to_str())
|
||||
.is_some_and(|s| s.eq_ignore_ascii_case("txt") || s.eq_ignore_ascii_case("md"))
|
||||
}
|
||||
/// Plain UTF-8 notes; Markdown headings delimit slides, not rendered formatting.
|
||||
pub fn parse_import(text: &str, markdown: bool) -> Result<Vec<String>, String> {
|
||||
if text.len() > MAX_TEXT {
|
||||
return Err("Imported notes exceed 8 MiB".into());
|
||||
}
|
||||
let text = text
|
||||
.strip_prefix('\u{feff}')
|
||||
.unwrap_or(text)
|
||||
.replace("\r\n", "\n");
|
||||
let mut sections = Vec::new();
|
||||
let mut lines = Vec::new();
|
||||
let mut heading_seen = false;
|
||||
let mut fence: Option<(u8, usize)> = None;
|
||||
for line in text.lines() {
|
||||
let trimmed = line.trim();
|
||||
let mut heading = false;
|
||||
if markdown {
|
||||
let start = line.trim_start_matches(' ');
|
||||
let indent = line.len() - start.len();
|
||||
let marker = start.as_bytes().first().copied();
|
||||
let run = start.bytes().take_while(|b| Some(*b) == marker).count();
|
||||
if let Some((ch, len)) = fence {
|
||||
if indent <= 3 && marker == Some(ch) && run >= len && start[run..].trim().is_empty()
|
||||
{
|
||||
fence = None;
|
||||
}
|
||||
} else if indent <= 3 && matches!(marker, Some(b'`' | b'~')) && run >= 3 {
|
||||
fence = Some((marker.unwrap(), run));
|
||||
} else if indent <= 3 {
|
||||
heading = start == "#"
|
||||
|| start
|
||||
.strip_prefix('#')
|
||||
.is_some_and(|tail| tail.starts_with([' ', '\t']));
|
||||
}
|
||||
}
|
||||
let separator = !markdown && trimmed.len() >= 2 && trimmed.bytes().all(|b| b == b'-');
|
||||
if heading || separator {
|
||||
if markdown && !heading_seen {
|
||||
if lines.iter().any(|line: &&str| !line.trim().is_empty()) {
|
||||
return Err(
|
||||
"Markdown notes must begin with a # slide title (blank lines are allowed)."
|
||||
.into(),
|
||||
);
|
||||
}
|
||||
heading_seen = true;
|
||||
} else {
|
||||
sections.push(lines.join("\n").trim_matches('\n').to_owned());
|
||||
}
|
||||
lines.clear();
|
||||
} else {
|
||||
lines.push(line);
|
||||
}
|
||||
if sections.len() >= 10000 {
|
||||
return Err("Imported notes exceed 10000 slides".into());
|
||||
}
|
||||
}
|
||||
if markdown && !heading_seen {
|
||||
return Err("Markdown notes need # slide titles.".into());
|
||||
}
|
||||
sections.push(lines.join("\n").trim_matches('\n').to_owned());
|
||||
if sections.iter().any(|s| s.len() > MAX_NOTE) {
|
||||
return Err("An imported note exceeds 256 KiB".into());
|
||||
}
|
||||
Ok(sections)
|
||||
}
|
||||
pub fn preview_import(
|
||||
source: &Path,
|
||||
cache: PathBuf,
|
||||
source_sha: &str,
|
||||
import: &Path,
|
||||
) -> Result<ImportPreview, String> {
|
||||
if !is_import(import) {
|
||||
return Err("Choose a .txt or .md notes file.".into());
|
||||
}
|
||||
let input = read_limited(import, MAX_TEXT as u64)?;
|
||||
let text = std::str::from_utf8(&input).map_err(|_| "Notes imports must be UTF-8 text.")?;
|
||||
let markdown = import
|
||||
.extension()
|
||||
.is_some_and(|e| e.eq_ignore_ascii_case("md"));
|
||||
let sections = parse_import(text, markdown)?;
|
||||
let (info, existing) = document(source, cache, source_sha)?;
|
||||
if sections.len() > info.notes.len() {
|
||||
return Err(format!(
|
||||
"{} note sections, but only {} slides. Nothing was changed.",
|
||||
sections.len(),
|
||||
info.notes.len()
|
||||
));
|
||||
}
|
||||
Ok(ImportPreview {
|
||||
path: sidecar_path(&info.path),
|
||||
revision: existing.map(|(_, b)| revision(&b)),
|
||||
sections,
|
||||
total: info.notes.len(),
|
||||
})
|
||||
}
|
||||
pub fn apply_import(
|
||||
source: &Path,
|
||||
cache: PathBuf,
|
||||
source_sha: &str,
|
||||
preview: ImportPreview,
|
||||
) -> Result<Snapshot, String> {
|
||||
let (mut info, existing) = document(source, cache, source_sha)?;
|
||||
let path = sidecar_path(&info.path);
|
||||
if path != preview.path
|
||||
|| info.notes.len() != preview.total
|
||||
|| preview.sections.len() > info.notes.len()
|
||||
{
|
||||
return Err("Presentation changed. Import the notes again.".into());
|
||||
}
|
||||
let previous = existing.as_ref().map(|(_, b)| b);
|
||||
if previous.map(|b| revision(b)) != preview.revision {
|
||||
return Err("Notes changed on disk. Import again to review the latest notes.".into());
|
||||
}
|
||||
for (note, imported) in info.notes.iter_mut().zip(preview.sections) {
|
||||
*note = imported;
|
||||
}
|
||||
if info.notes.iter().map(String::len).sum::<usize>() > MAX_TEXT {
|
||||
return Err("Combined notes exceed 8 MiB; nothing was saved.".into());
|
||||
}
|
||||
let mut file = NotesFile {
|
||||
version: 1,
|
||||
notes: BTreeMap::new(),
|
||||
};
|
||||
if let Some((existing, _)) = &existing {
|
||||
file.notes.clone_from(&existing.notes);
|
||||
}
|
||||
file.notes.extend(
|
||||
keys(&info.path, &info.names)
|
||||
.into_iter()
|
||||
.zip(info.notes.iter().cloned()),
|
||||
);
|
||||
let bytes = bytes(&file)?;
|
||||
let temp = temporary(&path, &bytes)?;
|
||||
if read(&path)?.as_ref().map(|(_, b)| b) != previous {
|
||||
return Err("Notes changed while importing; nothing was saved.".into());
|
||||
}
|
||||
if previous.is_some() {
|
||||
temp.persist(&path).map_err(|e| e.to_string())?;
|
||||
} else {
|
||||
temp.persist_noclobber(&path).map_err(|e| e.to_string())?;
|
||||
}
|
||||
Ok(Snapshot {
|
||||
path,
|
||||
revision: revision(&bytes),
|
||||
notes: info.notes,
|
||||
})
|
||||
}
|
||||
|
|
@ -23,6 +23,14 @@ pub enum DisplayAction {
|
|||
}
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct HostState {
|
||||
#[serde(default)]
|
||||
pub zoom: crate::zoom::Sync,
|
||||
#[serde(default)]
|
||||
pub zoom_only: bool,
|
||||
#[serde(default)]
|
||||
pub overlay: crate::tools::Overlay,
|
||||
#[serde(default)]
|
||||
pub overlay_only: bool,
|
||||
#[serde(default)]
|
||||
pub slide_colors: crate::settings::SlideColors,
|
||||
#[serde(default)]
|
||||
|
|
@ -39,11 +47,41 @@ pub struct HostState {
|
|||
pub buffer_mib: u32,
|
||||
pub monitors: Vec<String>,
|
||||
pub fullscreen: bool,
|
||||
#[serde(default)]
|
||||
pub screen_fullscreen: std::collections::BTreeMap<String, bool>,
|
||||
pub blanked: bool,
|
||||
#[serde(default)]
|
||||
pub blank_picture: Option<FrameInfo>,
|
||||
pub quit: bool,
|
||||
}
|
||||
impl HostState {
|
||||
pub fn fullscreen_on(&self, monitor: &str) -> bool {
|
||||
self.screen_fullscreen
|
||||
.get(monitor)
|
||||
.copied()
|
||||
.unwrap_or(self.fullscreen)
|
||||
}
|
||||
}
|
||||
/// Actual size of the reference Slides window, never Presenter content.
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct OutputViewport {
|
||||
pub monitor: String,
|
||||
pub size: [u32; 2],
|
||||
pub fullscreen: bool,
|
||||
}
|
||||
#[derive(Clone, Default, Debug, Serialize, Deserialize)]
|
||||
pub struct Ack {
|
||||
#[serde(default)]
|
||||
pub viewport: Option<OutputViewport>,
|
||||
#[serde(default)]
|
||||
pub zoom: Option<crate::zoom::Sync>,
|
||||
#[serde(default)]
|
||||
pub zoom_slow: bool,
|
||||
/// Explicit operator blanking, separate from diagnostic status messages.
|
||||
#[serde(default)]
|
||||
pub request_blank: bool,
|
||||
#[serde(default)]
|
||||
pub request_quit: bool,
|
||||
#[serde(default)]
|
||||
pub display_action: Option<DisplayAction>,
|
||||
#[serde(default)]
|
||||
|
|
@ -57,6 +95,26 @@ pub struct Ack {
|
|||
#[serde(default)]
|
||||
pub buffered: usize,
|
||||
}
|
||||
/// Lightweight crop/annotation updates must never discard queued frame/routing state.
|
||||
pub fn coalesce(latest: &mut Option<HostState>, command: HostState) {
|
||||
if (command.zoom_only || command.overlay_only)
|
||||
&& let Some(previous) = latest
|
||||
{
|
||||
if previous.generation == command.generation && previous.page == command.page {
|
||||
let previous_is_lightweight = previous.zoom_only || previous.overlay_only;
|
||||
if command.zoom_only {
|
||||
previous.zoom.accept_presenter(command.zoom);
|
||||
previous.zoom_only |= previous_is_lightweight;
|
||||
}
|
||||
if command.overlay_only {
|
||||
previous.overlay = command.overlay.normalized();
|
||||
previous.overlay_only |= previous_is_lightweight;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
*latest = Some(command);
|
||||
}
|
||||
}
|
||||
pub struct OutputLink {
|
||||
pub tx: SyncSender<HostState>,
|
||||
pub rx: Receiver<Ack>,
|
||||
|
|
@ -127,7 +185,7 @@ impl OutputLink {
|
|||
}
|
||||
let mut latest = None;
|
||||
while let Ok(command) = commands.try_recv() {
|
||||
latest = Some(command);
|
||||
coalesce(&mut latest, command);
|
||||
}
|
||||
if let Some(command) = latest {
|
||||
if write_json(&mut stdin, &command).is_err() {
|
||||
|
|
@ -151,8 +209,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:
|
||||
"Slides process 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));
|
||||
}
|
||||
|
|
@ -239,13 +302,19 @@ impl Drop for SleepLease {
|
|||
}
|
||||
}
|
||||
pub fn keep_awake() -> Result<(), String> {
|
||||
#[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))]
|
||||
let guard = keepawake::Builder::default()
|
||||
.display(true)
|
||||
.idle(true)
|
||||
.reason("PDF Presenter presentation")
|
||||
.app_name("PDF Presenter")
|
||||
.reason("Deckstride presentation")
|
||||
.app_name("Deckstride")
|
||||
.app_reverse_domain("com.beffroi.pdfpresenter")
|
||||
.create();
|
||||
#[cfg(not(any(target_os = "linux", target_os = "windows", target_os = "macos")))]
|
||||
let guard: Result<(), String> = Err(format!(
|
||||
"No native sleep-inhibition backend for {}",
|
||||
std::env::consts::OS
|
||||
));
|
||||
#[cfg(target_os = "linux")]
|
||||
let x11 = X11Lease::new();
|
||||
let status = match &guard {
|
||||
|
|
@ -0,0 +1,698 @@
|
|||
//! Bounded, data-only language and theme packs compatible with Canvas Pilot manifests.
|
||||
use crate::theme::Palette;
|
||||
use egui::Color32;
|
||||
use serde::Deserialize;
|
||||
use sha2::{Digest, Sha256};
|
||||
use std::{
|
||||
collections::{BTreeMap, BTreeSet},
|
||||
io::Read,
|
||||
path::{Path, PathBuf},
|
||||
sync::{LazyLock, RwLock},
|
||||
};
|
||||
|
||||
const MAX_ARCHIVE: u64 = 2 * 1024 * 1024;
|
||||
const MAX_EXPANDED: u64 = 4 * 1024 * 1024;
|
||||
const MAX_PACKS: usize = 32;
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct LanguageManifest {
|
||||
version: u32,
|
||||
id: String,
|
||||
revision: u64,
|
||||
languages: Vec<LanguageDescription>,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct LanguageDescription {
|
||||
pub locale: String,
|
||||
pub name: String,
|
||||
pub native_name: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct InstalledLanguagePack {
|
||||
pub id: String,
|
||||
pub revision: u64,
|
||||
pub languages: Vec<LanguageDescription>,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct LanguagePack {
|
||||
manifest: LanguageManifest,
|
||||
catalogs: BTreeMap<String, BTreeMap<String, &'static str>>,
|
||||
path: PathBuf,
|
||||
fingerprint: [u8; 32],
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct ThemeManifest {
|
||||
version: u32,
|
||||
id: String,
|
||||
revision: u64,
|
||||
themes: Vec<ThemeDescription>,
|
||||
#[serde(default)]
|
||||
notices: String,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
pub struct ThemeDescription {
|
||||
pub id: String,
|
||||
pub name: String,
|
||||
pub light: bool,
|
||||
colors: ThemeColors,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Deserialize)]
|
||||
#[serde(deny_unknown_fields)]
|
||||
struct ThemeColors {
|
||||
canvas: String,
|
||||
banner: String,
|
||||
grid: String,
|
||||
layer: String,
|
||||
bg: String,
|
||||
panel: String,
|
||||
field: String,
|
||||
line: String,
|
||||
text: String,
|
||||
muted: String,
|
||||
cyan: String,
|
||||
amber: String,
|
||||
purple: String,
|
||||
pattern: [String; 2],
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct InstalledThemePack {
|
||||
pub id: String,
|
||||
pub revision: u64,
|
||||
pub themes: Vec<ThemeDescription>,
|
||||
pub notices: String,
|
||||
}
|
||||
|
||||
#[derive(Clone)]
|
||||
struct ThemePack {
|
||||
manifest: ThemeManifest,
|
||||
path: PathBuf,
|
||||
fingerprint: [u8; 32],
|
||||
}
|
||||
|
||||
static LANGUAGE_PACKS: LazyLock<RwLock<Vec<LanguagePack>>> =
|
||||
LazyLock::new(|| RwLock::new(Vec::new()));
|
||||
static THEME_PACKS: LazyLock<RwLock<Vec<ThemePack>>> = LazyLock::new(|| RwLock::new(Vec::new()));
|
||||
#[derive(Default)]
|
||||
struct InternPool {
|
||||
values: BTreeMap<String, &'static str>,
|
||||
bytes: usize,
|
||||
}
|
||||
static INTERNED: LazyLock<RwLock<InternPool>> = LazyLock::new(Default::default);
|
||||
|
||||
pub fn valid_id(id: &str) -> bool {
|
||||
!id.is_empty()
|
||||
&& id.len() <= 63
|
||||
&& id
|
||||
.bytes()
|
||||
.all(|byte| byte.is_ascii_lowercase() || byte.is_ascii_digit() || byte == b'-')
|
||||
&& !id.starts_with('-')
|
||||
&& !id.ends_with('-')
|
||||
}
|
||||
|
||||
pub fn valid_theme_choice(id: &str) -> bool {
|
||||
id.split_once('/')
|
||||
.is_some_and(|(pack, theme)| valid_id(pack) && valid_id(theme))
|
||||
}
|
||||
|
||||
fn bounded_read(path: &Path) -> Result<Vec<u8>, String> {
|
||||
let mut bytes = Vec::new();
|
||||
std::fs::File::open(path)
|
||||
.map_err(|error| error.to_string())?
|
||||
.take(MAX_ARCHIVE + 1)
|
||||
.read_to_end(&mut bytes)
|
||||
.map_err(|error| error.to_string())?;
|
||||
if bytes.len() as u64 > MAX_ARCHIVE {
|
||||
return Err("Pack exceeds 2 MiB".into());
|
||||
}
|
||||
Ok(bytes)
|
||||
}
|
||||
|
||||
fn fingerprint(bytes: &[u8]) -> [u8; 32] {
|
||||
Sha256::digest(bytes).into()
|
||||
}
|
||||
|
||||
fn intern(text: String) -> Result<&'static str, String> {
|
||||
let mut pool = INTERNED.write().unwrap();
|
||||
if let Some(value) = pool.values.get(&text) {
|
||||
return Ok(value);
|
||||
}
|
||||
if pool.bytes.saturating_add(text.len()) > 32 * 1024 * 1024 {
|
||||
return Err(
|
||||
"Runtime language-pack text limit reached; restart before importing more".into(),
|
||||
);
|
||||
}
|
||||
let leaked = Box::leak(text.clone().into_boxed_str());
|
||||
pool.bytes += text.len();
|
||||
pool.values.insert(text, leaked);
|
||||
Ok(leaked)
|
||||
}
|
||||
|
||||
fn parse_language(bytes: &[u8], path: PathBuf) -> Result<LanguagePack, String> {
|
||||
if bytes.len() as u64 > MAX_ARCHIVE {
|
||||
return Err("Language pack exceeds 2 MiB".into());
|
||||
}
|
||||
let mut zip = zip::ZipArchive::new(std::io::Cursor::new(bytes)).map_err(|e| e.to_string())?;
|
||||
if zip.is_empty() || zip.len() > 17 {
|
||||
return Err("Expected manifest.json and at most 16 catalogs".into());
|
||||
}
|
||||
let mut entries = BTreeMap::new();
|
||||
let mut expanded = 0_u64;
|
||||
for index in 0..zip.len() {
|
||||
let mut entry = zip.by_index(index).map_err(|e| e.to_string())?;
|
||||
let name = entry.name().to_owned();
|
||||
if name.contains(['/', '\\'])
|
||||
|| !name.ends_with(".json")
|
||||
|| entry.is_dir()
|
||||
|| entry
|
||||
.unix_mode()
|
||||
.is_some_and(|mode| mode & 0o170000 == 0o120000)
|
||||
{
|
||||
return Err("Pack entries must be regular JSON files at the ZIP root".into());
|
||||
}
|
||||
let mut data = Vec::new();
|
||||
(&mut entry)
|
||||
.take(MAX_EXPANDED.saturating_sub(expanded) + 1)
|
||||
.read_to_end(&mut data)
|
||||
.map_err(|e| e.to_string())?;
|
||||
expanded += data.len() as u64;
|
||||
if expanded > MAX_EXPANDED {
|
||||
return Err("Expanded language pack exceeds 4 MiB".into());
|
||||
}
|
||||
if entries.insert(name, data).is_some() {
|
||||
return Err("Duplicate ZIP entry".into());
|
||||
}
|
||||
}
|
||||
let manifest: LanguageManifest = serde_json::from_slice(
|
||||
&entries
|
||||
.remove("manifest.json")
|
||||
.ok_or("Missing manifest.json")?,
|
||||
)
|
||||
.map_err(|e| e.to_string())?;
|
||||
if manifest.version != 2
|
||||
|| manifest.revision == 0
|
||||
|| !valid_id(&manifest.id)
|
||||
|| manifest.languages.is_empty()
|
||||
|| manifest.languages.len() > 16
|
||||
{
|
||||
return Err("Invalid language-pack manifest or unsupported version".into());
|
||||
}
|
||||
let builtins = ["system", "en", "fr", "es", "ja", "zh-cn", "de", "pt-br"];
|
||||
let mut locales = BTreeSet::new();
|
||||
let mut catalogs = BTreeMap::new();
|
||||
for language in &manifest.languages {
|
||||
if !valid_id(&language.locale)
|
||||
|| builtins.contains(&language.locale.as_str())
|
||||
|| !locales.insert(language.locale.clone())
|
||||
{
|
||||
return Err("Invalid, duplicate, or built-in locale identifier".into());
|
||||
}
|
||||
for name in [&language.name, &language.native_name] {
|
||||
if name.trim().is_empty() || name.len() > 160 || name.chars().any(char::is_control) {
|
||||
return Err("Invalid language display name".into());
|
||||
}
|
||||
}
|
||||
let messages: BTreeMap<String, String> = serde_json::from_slice(
|
||||
&entries
|
||||
.remove(&format!("{}.json", language.locale))
|
||||
.ok_or("Missing language catalog")?,
|
||||
)
|
||||
.map_err(|e| e.to_string())?;
|
||||
if messages.is_empty() || messages.len() > 4096 {
|
||||
return Err("Language catalog is empty or too large".into());
|
||||
}
|
||||
let mut checked = BTreeMap::new();
|
||||
for (key, value) in messages {
|
||||
if key.trim().is_empty()
|
||||
|| key.len() > 16_384
|
||||
|| key.chars().any(char::is_control)
|
||||
|| value.trim().is_empty()
|
||||
|| value.len() > 16_384
|
||||
|| value
|
||||
.chars()
|
||||
.any(|c| c.is_control() && c != '\n' && c != '\t')
|
||||
{
|
||||
return Err("Invalid translation key or text".into());
|
||||
}
|
||||
checked.insert(key, intern(value)?);
|
||||
}
|
||||
catalogs.insert(language.locale.clone(), checked);
|
||||
}
|
||||
if !entries.is_empty() {
|
||||
return Err("Unexpected files in language pack".into());
|
||||
}
|
||||
Ok(LanguagePack {
|
||||
manifest,
|
||||
catalogs,
|
||||
path,
|
||||
fingerprint: fingerprint(bytes),
|
||||
})
|
||||
}
|
||||
|
||||
fn color(text: &str) -> Result<Color32, String> {
|
||||
if text.len() != 7
|
||||
|| !text.starts_with('#')
|
||||
|| !text[1..].bytes().all(|byte| byte.is_ascii_hexdigit())
|
||||
{
|
||||
return Err(format!("Expected opaque #RRGGBB color: {text}"));
|
||||
}
|
||||
let value = u32::from_str_radix(&text[1..], 16).map_err(|e| e.to_string())?;
|
||||
Ok(Color32::from_rgb(
|
||||
(value >> 16) as u8,
|
||||
(value >> 8) as u8,
|
||||
value as u8,
|
||||
))
|
||||
}
|
||||
|
||||
impl ThemeColors {
|
||||
fn palette(&self) -> Result<Palette, String> {
|
||||
Ok(Palette {
|
||||
canvas: color(&self.canvas)?,
|
||||
banner: color(&self.banner)?,
|
||||
grid: color(&self.grid)?,
|
||||
layer: color(&self.layer)?,
|
||||
bg: color(&self.bg)?,
|
||||
panel: color(&self.panel)?,
|
||||
field: color(&self.field)?,
|
||||
line: color(&self.line)?,
|
||||
text: color(&self.text)?,
|
||||
muted: color(&self.muted)?,
|
||||
cyan: color(&self.cyan)?,
|
||||
amber: color(&self.amber)?,
|
||||
purple: color(&self.purple)?,
|
||||
pattern: [color(&self.pattern[0])?, color(&self.pattern[1])?],
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn parse_theme(bytes: &[u8], path: PathBuf) -> Result<ThemePack, String> {
|
||||
if bytes.len() as u64 > MAX_ARCHIVE {
|
||||
return Err("Theme pack exceeds 2 MiB".into());
|
||||
}
|
||||
let mut zip = zip::ZipArchive::new(std::io::Cursor::new(bytes)).map_err(|e| e.to_string())?;
|
||||
if zip.len() != 1 {
|
||||
return Err("Expected only manifest.json in the theme pack".into());
|
||||
}
|
||||
let mut entry = zip.by_index(0).map_err(|e| e.to_string())?;
|
||||
if entry.name() != "manifest.json"
|
||||
|| entry.is_dir()
|
||||
|| entry
|
||||
.unix_mode()
|
||||
.is_some_and(|mode| mode & 0o170000 == 0o120000)
|
||||
{
|
||||
return Err("Expected a regular manifest.json at the ZIP root".into());
|
||||
}
|
||||
let mut data = Vec::new();
|
||||
(&mut entry)
|
||||
.take(MAX_EXPANDED + 1)
|
||||
.read_to_end(&mut data)
|
||||
.map_err(|e| e.to_string())?;
|
||||
if data.len() as u64 > MAX_EXPANDED {
|
||||
return Err("Expanded theme pack exceeds 4 MiB".into());
|
||||
}
|
||||
let manifest: ThemeManifest = serde_json::from_slice(&data).map_err(|e| e.to_string())?;
|
||||
if manifest.version != 1
|
||||
|| manifest.revision == 0
|
||||
|| !valid_id(&manifest.id)
|
||||
|| manifest.themes.is_empty()
|
||||
|| manifest.themes.len() > 16
|
||||
|| manifest.notices.len() > 65_536
|
||||
|| manifest
|
||||
.notices
|
||||
.chars()
|
||||
.any(|c| c.is_control() && !matches!(c, '\n' | '\r' | '\t'))
|
||||
{
|
||||
return Err("Invalid theme-pack manifest or unsupported version".into());
|
||||
}
|
||||
let mut ids = BTreeSet::new();
|
||||
for theme in &manifest.themes {
|
||||
if !valid_id(&theme.id)
|
||||
|| !ids.insert(theme.id.clone())
|
||||
|| theme.name.trim().is_empty()
|
||||
|| theme.name.len() > 160
|
||||
|| theme.name.chars().any(char::is_control)
|
||||
{
|
||||
return Err("Invalid or duplicate theme identifier/name".into());
|
||||
}
|
||||
theme.colors.palette()?;
|
||||
}
|
||||
Ok(ThemePack {
|
||||
manifest,
|
||||
path,
|
||||
fingerprint: fingerprint(bytes),
|
||||
})
|
||||
}
|
||||
|
||||
fn zip_paths(directory: &Path) -> Result<Vec<PathBuf>, String> {
|
||||
let entries = match std::fs::read_dir(directory) {
|
||||
Ok(entries) => entries,
|
||||
Err(error) if error.kind() == std::io::ErrorKind::NotFound => return Ok(Vec::new()),
|
||||
Err(error) => return Err(error.to_string()),
|
||||
};
|
||||
let mut paths: Vec<_> = entries
|
||||
.filter_map(Result::ok)
|
||||
.map(|entry| entry.path())
|
||||
.filter(|path| path.extension().is_some_and(|extension| extension == "zip"))
|
||||
.collect();
|
||||
paths.sort();
|
||||
if paths.len() > MAX_PACKS {
|
||||
return Err("Too many packs (maximum 32)".into());
|
||||
}
|
||||
Ok(paths)
|
||||
}
|
||||
|
||||
pub fn load(root: &Path) -> Vec<String> {
|
||||
let mut errors = Vec::new();
|
||||
let mut languages = Vec::new();
|
||||
match zip_paths(&root.join("language-packs")) {
|
||||
Ok(paths) => {
|
||||
for path in paths {
|
||||
match bounded_read(&path).and_then(|bytes| parse_language(&bytes, path.clone())) {
|
||||
Ok(pack)
|
||||
if !languages.iter().any(|old: &LanguagePack| {
|
||||
old.manifest.id == pack.manifest.id
|
||||
|| old.manifest.languages.iter().any(|old_language| {
|
||||
pack.manifest
|
||||
.languages
|
||||
.iter()
|
||||
.any(|new| new.locale == old_language.locale)
|
||||
})
|
||||
}) =>
|
||||
{
|
||||
languages.push(pack)
|
||||
}
|
||||
Ok(_) => errors.push(format!("{}: duplicate pack or locale", path.display())),
|
||||
Err(error) => errors.push(format!("{}: {error}", path.display())),
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(error) => errors.push(error),
|
||||
}
|
||||
let mut themes = Vec::new();
|
||||
match zip_paths(&root.join("theme-packs")) {
|
||||
Ok(paths) => {
|
||||
for path in paths {
|
||||
match bounded_read(&path).and_then(|bytes| parse_theme(&bytes, path.clone())) {
|
||||
Ok(pack)
|
||||
if !themes
|
||||
.iter()
|
||||
.any(|old: &ThemePack| old.manifest.id == pack.manifest.id) =>
|
||||
{
|
||||
themes.push(pack)
|
||||
}
|
||||
Ok(_) => errors.push(format!("{}: duplicate pack identifier", path.display())),
|
||||
Err(error) => errors.push(format!("{}: {error}", path.display())),
|
||||
}
|
||||
}
|
||||
}
|
||||
Err(error) => errors.push(error),
|
||||
}
|
||||
*LANGUAGE_PACKS.write().unwrap() = languages;
|
||||
*THEME_PACKS.write().unwrap() = themes;
|
||||
errors
|
||||
}
|
||||
|
||||
fn install_bytes(
|
||||
directory: &Path,
|
||||
id: &str,
|
||||
revision: u64,
|
||||
previous: Option<(PathBuf, u64, [u8; 32])>,
|
||||
bytes: &[u8],
|
||||
) -> Result<PathBuf, String> {
|
||||
let destination = previous
|
||||
.as_ref()
|
||||
.map(|(path, _, _)| path.clone())
|
||||
.unwrap_or_else(|| directory.join(format!("{id}.zip")));
|
||||
if let Some((_, old_revision, _)) = &previous
|
||||
&& revision <= *old_revision
|
||||
{
|
||||
return Err(format!(
|
||||
"Installed revision {old_revision} is not older than revision {revision}"
|
||||
));
|
||||
}
|
||||
if previous.is_none() && destination.exists() {
|
||||
return Err("Pack destination already exists; remove or rename it before importing".into());
|
||||
}
|
||||
if let Some((_, _, expected)) = previous
|
||||
&& fingerprint(&bounded_read(&destination)?) != expected
|
||||
{
|
||||
return Err("Installed pack changed on disk; restart before updating it".into());
|
||||
}
|
||||
if !destination.exists() && zip_paths(directory).is_ok_and(|paths| paths.len() >= MAX_PACKS) {
|
||||
return Err("Too many packs (maximum 32)".into());
|
||||
}
|
||||
crate::settings::atomic_write(&destination, bytes)?;
|
||||
Ok(destination)
|
||||
}
|
||||
|
||||
pub fn install_language(root: &Path, source: &Path) -> Result<String, String> {
|
||||
let bytes = bounded_read(source)?;
|
||||
let parsed = parse_language(&bytes, PathBuf::new())?;
|
||||
let installed = LANGUAGE_PACKS.read().unwrap().clone();
|
||||
for old in &installed {
|
||||
if old.manifest.id != parsed.manifest.id
|
||||
&& old.manifest.languages.iter().any(|old_language| {
|
||||
parsed
|
||||
.manifest
|
||||
.languages
|
||||
.iter()
|
||||
.any(|new| new.locale == old_language.locale)
|
||||
})
|
||||
{
|
||||
return Err(format!(
|
||||
"Locale belongs to installed pack {}",
|
||||
old.manifest.id
|
||||
));
|
||||
}
|
||||
}
|
||||
let previous = installed
|
||||
.iter()
|
||||
.find(|pack| pack.manifest.id == parsed.manifest.id)
|
||||
.map(|pack| (pack.path.clone(), pack.manifest.revision, pack.fingerprint));
|
||||
let directory = root.join("language-packs");
|
||||
let path = install_bytes(
|
||||
&directory,
|
||||
&parsed.manifest.id,
|
||||
parsed.manifest.revision,
|
||||
previous,
|
||||
&bytes,
|
||||
)?;
|
||||
let id = parsed.manifest.id.clone();
|
||||
let parsed = parse_language(&bytes, path)?;
|
||||
let mut packs = LANGUAGE_PACKS.write().unwrap();
|
||||
packs.retain(|pack| pack.manifest.id != id);
|
||||
packs.push(parsed);
|
||||
packs.sort_by(|a, b| a.manifest.id.cmp(&b.manifest.id));
|
||||
Ok(id)
|
||||
}
|
||||
|
||||
pub fn install_theme(root: &Path, source: &Path) -> Result<String, String> {
|
||||
let bytes = bounded_read(source)?;
|
||||
let parsed = parse_theme(&bytes, PathBuf::new())?;
|
||||
let installed = THEME_PACKS.read().unwrap().clone();
|
||||
let previous = installed
|
||||
.iter()
|
||||
.find(|pack| pack.manifest.id == parsed.manifest.id)
|
||||
.map(|pack| (pack.path.clone(), pack.manifest.revision, pack.fingerprint));
|
||||
let directory = root.join("theme-packs");
|
||||
let path = install_bytes(
|
||||
&directory,
|
||||
&parsed.manifest.id,
|
||||
parsed.manifest.revision,
|
||||
previous,
|
||||
&bytes,
|
||||
)?;
|
||||
let id = parsed.manifest.id.clone();
|
||||
let parsed = parse_theme(&bytes, path)?;
|
||||
let mut packs = THEME_PACKS.write().unwrap();
|
||||
packs.retain(|pack| pack.manifest.id != id);
|
||||
packs.push(parsed);
|
||||
packs.sort_by(|a, b| a.manifest.id.cmp(&b.manifest.id));
|
||||
Ok(id)
|
||||
}
|
||||
|
||||
pub fn language_packs() -> Vec<InstalledLanguagePack> {
|
||||
LANGUAGE_PACKS
|
||||
.read()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.map(|pack| InstalledLanguagePack {
|
||||
id: pack.manifest.id.clone(),
|
||||
revision: pack.manifest.revision,
|
||||
languages: pack.manifest.languages.clone(),
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn theme_packs() -> Vec<InstalledThemePack> {
|
||||
THEME_PACKS
|
||||
.read()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.map(|pack| InstalledThemePack {
|
||||
id: pack.manifest.id.clone(),
|
||||
revision: pack.manifest.revision,
|
||||
themes: pack.manifest.themes.clone(),
|
||||
notices: pack.manifest.notices.clone(),
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn translation(locale: &str, source: &str) -> Option<&'static str> {
|
||||
LANGUAGE_PACKS
|
||||
.read()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.find_map(|pack| pack.catalogs.get(locale)?.get(source).copied())
|
||||
}
|
||||
|
||||
pub fn language_name(locale: &str) -> Option<String> {
|
||||
LANGUAGE_PACKS.read().unwrap().iter().find_map(|pack| {
|
||||
pack.manifest
|
||||
.languages
|
||||
.iter()
|
||||
.find(|language| language.locale == locale)
|
||||
.map(|language| format!("{} — {}", language.native_name, language.name))
|
||||
})
|
||||
}
|
||||
|
||||
pub fn theme_choices() -> Vec<(String, String)> {
|
||||
THEME_PACKS
|
||||
.read()
|
||||
.unwrap()
|
||||
.iter()
|
||||
.flat_map(|pack| {
|
||||
pack.manifest.themes.iter().map(|theme| {
|
||||
(
|
||||
format!("{}/{}", pack.manifest.id, theme.id),
|
||||
theme.name.clone(),
|
||||
)
|
||||
})
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
pub fn packed_theme(choice: &str) -> Option<(Palette, bool, String)> {
|
||||
let (pack_id, theme_id) = choice.split_once('/')?;
|
||||
THEME_PACKS.read().unwrap().iter().find_map(|pack| {
|
||||
if pack.manifest.id != pack_id {
|
||||
return None;
|
||||
}
|
||||
let theme = pack
|
||||
.manifest
|
||||
.themes
|
||||
.iter()
|
||||
.find(|theme| theme.id == theme_id)?;
|
||||
Some((
|
||||
theme.colors.palette().ok()?,
|
||||
theme.light,
|
||||
theme.name.clone(),
|
||||
))
|
||||
})
|
||||
}
|
||||
|
||||
pub fn pack_root(settings_path: &Path) -> Result<&Path, String> {
|
||||
settings_path
|
||||
.parent()
|
||||
.ok_or("Settings directory unavailable".into())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use std::io::Write;
|
||||
|
||||
fn archive(files: &[(&str, &[u8])]) -> Vec<u8> {
|
||||
let mut writer = zip::ZipWriter::new(std::io::Cursor::new(Vec::new()));
|
||||
for (name, bytes) in files {
|
||||
writer
|
||||
.start_file(*name, zip::write::SimpleFileOptions::default())
|
||||
.unwrap();
|
||||
writer.write_all(bytes).unwrap();
|
||||
}
|
||||
writer.finish().unwrap().into_inner()
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn example_packs_install_load_and_resolve() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let language = temp.path().join("language.zip");
|
||||
let theme = temp.path().join("theme.zip");
|
||||
std::fs::write(
|
||||
&language,
|
||||
include_bytes!("../../../docs/packs/deckstride-language-pack.zip"),
|
||||
)
|
||||
.unwrap();
|
||||
std::fs::write(
|
||||
&theme,
|
||||
include_bytes!("../../../docs/packs/deckstride-theme-pack.zip"),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
install_language(temp.path(), &language).unwrap(),
|
||||
"example-language"
|
||||
);
|
||||
assert_eq!(translation("eo-example", "Close"), Some("Fermi"));
|
||||
assert_eq!(install_theme(temp.path(), &theme).unwrap(), "example-theme");
|
||||
assert!(packed_theme("example-theme/night").is_some());
|
||||
assert!(load(temp.path()).is_empty());
|
||||
assert_eq!(language_packs()[0].revision, 1);
|
||||
assert_eq!(theme_packs()[0].revision, 1);
|
||||
let ctx = egui::Context::default();
|
||||
crate::localization::apply_selected(
|
||||
&ctx,
|
||||
&crate::localization::Language::En,
|
||||
Some("eo-example"),
|
||||
);
|
||||
assert_eq!(crate::localization::tr(&ctx, "Close"), "Fermi");
|
||||
crate::theme::apply_selected(
|
||||
&ctx,
|
||||
crate::theme::Theme::Midra,
|
||||
Some("example-theme/night"),
|
||||
);
|
||||
assert_eq!(
|
||||
ctx.global_style().visuals.panel_fill,
|
||||
color("#101820").unwrap()
|
||||
);
|
||||
let mut manifest: serde_json::Value = serde_json::from_str(include_str!(
|
||||
"../../../docs/packs/language-example/manifest.json"
|
||||
))
|
||||
.unwrap();
|
||||
manifest["revision"] = 2.into();
|
||||
let updated = archive(&[
|
||||
("manifest.json", &serde_json::to_vec(&manifest).unwrap()),
|
||||
(
|
||||
"eo-example.json",
|
||||
include_bytes!("../../../docs/packs/language-example/eo-example.json"),
|
||||
),
|
||||
]);
|
||||
std::fs::write(
|
||||
temp.path().join("language-packs/example-language.zip"),
|
||||
b"changed",
|
||||
)
|
||||
.unwrap();
|
||||
std::fs::write(&language, updated).unwrap();
|
||||
assert!(
|
||||
install_language(temp.path(), &language)
|
||||
.unwrap_err()
|
||||
.contains("changed on disk")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn malformed_and_traversing_archives_are_rejected() {
|
||||
let bad = archive(&[("../manifest.json", b"{}")]);
|
||||
assert!(parse_language(&bad, PathBuf::new()).is_err());
|
||||
assert!(parse_theme(&bad, PathBuf::new()).is_err());
|
||||
}
|
||||
}
|
||||
|
|
@ -27,7 +27,7 @@ pub enum Action {
|
|||
Swap,
|
||||
/// Cycle the presenter display, keeping roles separate when possible.
|
||||
PresenterDisplay,
|
||||
/// Cycle the audience display, keeping roles separate when possible.
|
||||
/// Cycle the Slides screen, keeping roles separate when possible.
|
||||
AudienceDisplay,
|
||||
/// Toggle audience fullscreen.
|
||||
Fullscreen,
|
||||
|
|
@ -80,7 +80,7 @@ impl Model {
|
|||
return Err("Display index is out of range; use --list-monitors.".into());
|
||||
}
|
||||
if displays.len() > 1 && presenter == audience {
|
||||
return Err("Choose different presenter and audience displays.".into());
|
||||
return Err("Choose different Presenter and Slides screens.".into());
|
||||
}
|
||||
let fullscreen = !windowed;
|
||||
Ok(Self {
|
||||
|
|
@ -0,0 +1,539 @@
|
|||
//! Versioned per-user settings and deterministic monitor/layout recovery.
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sha2::{Digest, Sha256};
|
||||
use std::{
|
||||
collections::BTreeMap,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
pub struct Widget {
|
||||
pub show: bool,
|
||||
pub size: f32,
|
||||
}
|
||||
/// Fixed presenter-only timer locations; body rows remain visible with hidden bars.
|
||||
#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum TimerPosition {
|
||||
#[default]
|
||||
Header,
|
||||
AboveSlides,
|
||||
BelowNotes,
|
||||
LeftOfNotes,
|
||||
RightOfNotes,
|
||||
LeftOfSlides,
|
||||
RightOfSlides,
|
||||
}
|
||||
impl TimerPosition {
|
||||
pub const ALL: [Self; 7] = [
|
||||
Self::Header,
|
||||
Self::AboveSlides,
|
||||
Self::BelowNotes,
|
||||
Self::LeftOfNotes,
|
||||
Self::RightOfNotes,
|
||||
Self::LeftOfSlides,
|
||||
Self::RightOfSlides,
|
||||
];
|
||||
pub fn label(self) -> &'static str {
|
||||
match self {
|
||||
Self::Header => "Header",
|
||||
Self::AboveSlides => "Above slides",
|
||||
Self::BelowNotes => "Below notes",
|
||||
Self::LeftOfNotes => "Left of notes",
|
||||
Self::RightOfNotes => "Right of notes",
|
||||
Self::LeftOfSlides => "Left of slides",
|
||||
Self::RightOfSlides => "Right of slides",
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum TimerMode {
|
||||
#[default]
|
||||
Elapsed,
|
||||
Countdown,
|
||||
}
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(default)]
|
||||
pub struct Layout {
|
||||
pub previous: Widget,
|
||||
pub current: Widget,
|
||||
pub next: Widget,
|
||||
pub notes: Widget,
|
||||
pub elapsed: Widget,
|
||||
pub clock: Widget,
|
||||
pub elapsed_position: TimerPosition,
|
||||
pub clock_position: TimerPosition,
|
||||
pub slide_progress: bool,
|
||||
pub slide_progress_height: f32,
|
||||
pub timer_mode: TimerMode,
|
||||
pub countdown_seconds: u32,
|
||||
pub timer_autostart: bool,
|
||||
pub header: bool,
|
||||
pub footer: bool,
|
||||
}
|
||||
impl Default for Layout {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
previous: Widget {
|
||||
show: false,
|
||||
size: 60.,
|
||||
},
|
||||
current: Widget {
|
||||
show: true,
|
||||
size: 130.,
|
||||
},
|
||||
next: Widget {
|
||||
show: true,
|
||||
size: 75.,
|
||||
},
|
||||
notes: Widget {
|
||||
show: true,
|
||||
size: 28.,
|
||||
},
|
||||
elapsed: Widget {
|
||||
show: true,
|
||||
size: 28.,
|
||||
},
|
||||
clock: Widget {
|
||||
show: true,
|
||||
size: 28.,
|
||||
},
|
||||
elapsed_position: TimerPosition::Header,
|
||||
clock_position: TimerPosition::Header,
|
||||
slide_progress: false,
|
||||
slide_progress_height: 24.,
|
||||
timer_mode: TimerMode::Elapsed,
|
||||
countdown_seconds: 1200,
|
||||
timer_autostart: true,
|
||||
header: true,
|
||||
footer: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl Layout {
|
||||
pub fn validate(&self) -> Result<(), String> {
|
||||
if !self.slide_progress_height.is_finite()
|
||||
|| !(8. ..=120.).contains(&self.slide_progress_height)
|
||||
|| !(1..=86400).contains(&self.countdown_seconds)
|
||||
{
|
||||
return Err("Invalid timer duration or progress bar size".into());
|
||||
}
|
||||
for (w, min, max) in [
|
||||
(&self.previous, 30., 160.),
|
||||
(&self.current, 60., 200.),
|
||||
(&self.next, 30., 160.),
|
||||
(&self.notes, 12., 65.),
|
||||
(&self.elapsed, 16., 320.),
|
||||
(&self.clock, 16., 320.),
|
||||
] {
|
||||
if !w.size.is_finite() || w.size < min || w.size > max {
|
||||
return Err("Invalid layout size".into());
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(default)]
|
||||
pub struct Routes {
|
||||
pub presenter: Vec<String>,
|
||||
pub presentation: Vec<String>,
|
||||
}
|
||||
impl Routes {
|
||||
pub fn resolve(&self, available: &[String], primary: usize) -> Self {
|
||||
if available.is_empty() {
|
||||
return Self::default();
|
||||
}
|
||||
let mut presenter: Vec<_> = self
|
||||
.presenter
|
||||
.iter()
|
||||
.filter(|id| available.contains(id))
|
||||
.cloned()
|
||||
.collect();
|
||||
if presenter.is_empty() {
|
||||
presenter.push(available[primary.min(available.len() - 1)].clone());
|
||||
}
|
||||
let mut presentation: Vec<_> = self
|
||||
.presentation
|
||||
.iter()
|
||||
.filter(|id| available.contains(id) && !presenter.contains(id))
|
||||
.cloned()
|
||||
.collect();
|
||||
if presentation.is_empty()
|
||||
&& (!self.presentation.is_empty() || self.presenter.is_empty())
|
||||
&& let Some(id) = available.iter().find(|id| !presenter.contains(id))
|
||||
{
|
||||
presentation.push(id.clone());
|
||||
}
|
||||
Self {
|
||||
presenter,
|
||||
presentation,
|
||||
}
|
||||
}
|
||||
pub fn validate(&self) -> Result<(), String> {
|
||||
if self.presenter.len() + self.presentation.len() > 32
|
||||
|| self.presenter.iter().any(|p| self.presentation.contains(p))
|
||||
{
|
||||
return Err("Invalid screen roles".into());
|
||||
}
|
||||
for group in [&self.presenter, &self.presentation] {
|
||||
let mut unique = group.clone();
|
||||
unique.sort();
|
||||
unique.dedup();
|
||||
if unique.len() != group.len() {
|
||||
return Err("Duplicate screen assignment".into());
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
/// Opaque display colors; cached slide pixels retain their original transparency.
|
||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(default)]
|
||||
pub struct SlideColors {
|
||||
#[serde(deserialize_with = "read_rgb")]
|
||||
pub page_background: [u8; 3],
|
||||
#[serde(deserialize_with = "read_rgb")]
|
||||
pub fit_padding: [u8; 3],
|
||||
}
|
||||
fn read_rgb<'de, D: serde::Deserializer<'de>>(deserializer: D) -> Result<[u8; 3], D::Error> {
|
||||
let channels = Vec::<u8>::deserialize(deserializer)?;
|
||||
channels
|
||||
.try_into()
|
||||
.map_err(|_| serde::de::Error::custom("RGB colors require exactly three channels"))
|
||||
}
|
||||
impl Default for SlideColors {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
page_background: [255; 3],
|
||||
fit_padding: [0; 3],
|
||||
}
|
||||
}
|
||||
}
|
||||
/// Per-monitor preference that takes priority over role-wide fullscreen commands.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum ScreenMode {
|
||||
#[default]
|
||||
FollowGlobal,
|
||||
AlwaysFullscreen,
|
||||
AlwaysWindowed,
|
||||
}
|
||||
impl ScreenMode {
|
||||
pub fn fullscreen(self, global: bool) -> bool {
|
||||
match self {
|
||||
Self::FollowGlobal => global,
|
||||
Self::AlwaysFullscreen => true,
|
||||
Self::AlwaysWindowed => false,
|
||||
}
|
||||
}
|
||||
pub fn label(self) -> &'static str {
|
||||
match self {
|
||||
Self::FollowGlobal => "Follow global",
|
||||
Self::AlwaysFullscreen => "Always fullscreen",
|
||||
Self::AlwaysWindowed => "Always windowed",
|
||||
}
|
||||
}
|
||||
}
|
||||
pub fn validate_screen_modes(modes: &BTreeMap<String, ScreenMode>) -> Result<(), String> {
|
||||
if modes.len() > 128 || modes.keys().any(|id| id.is_empty() || id.len() > 1024) {
|
||||
return Err(
|
||||
"Invalid screen modes: at most 128 nonempty monitor IDs of at most 1024 bytes".into(),
|
||||
);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
pub fn validate_single_screens(displays: &[String]) -> Result<(), String> {
|
||||
let unique: std::collections::HashSet<_> = displays.iter().collect();
|
||||
if displays.len() > 32
|
||||
|| unique.len() != displays.len()
|
||||
|| displays.iter().any(|id| id.is_empty() || id.len() > 1024)
|
||||
{
|
||||
return Err("Invalid single-screen assignments".into());
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
/// Saved visual layouts for one monitor; shared timer behavior uses legacy layouts.
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct DisplayLayouts {
|
||||
pub layout: Layout,
|
||||
pub projects: BTreeMap<String, Layout>,
|
||||
}
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct Settings {
|
||||
pub version: u32,
|
||||
pub slide_colors: SlideColors,
|
||||
pub layout: Layout,
|
||||
pub projects: BTreeMap<String, Layout>,
|
||||
pub display_layouts: BTreeMap<String, DisplayLayouts>,
|
||||
pub screen_modes: BTreeMap<String, ScreenMode>,
|
||||
pub single_screens: Vec<String>,
|
||||
pub routes: Routes,
|
||||
pub presenter_fullscreen: bool,
|
||||
pub presentation_fullscreen: bool,
|
||||
pub browser_monitor: Option<String>,
|
||||
pub thumbnail_size: f32,
|
||||
pub buffer_mib: u32,
|
||||
pub disk_cache: crate::cache::Policy,
|
||||
pub auto_show: bool,
|
||||
pub autoplay_enabled: bool,
|
||||
pub autoplay_seconds: f32,
|
||||
pub autoplay_loop: bool,
|
||||
pub blank_picture: bool,
|
||||
pub zoom_enabled: bool,
|
||||
pub zoom_keep_fitted_area: bool,
|
||||
pub theme: crate::theme::Theme,
|
||||
pub theme_pack: Option<String>,
|
||||
pub language: crate::localization::Language,
|
||||
pub language_pack: Option<String>,
|
||||
}
|
||||
/// Choose a per-process decoded-frame budget from available physical RAM.
|
||||
/// Prefer 15%, with a soft 512 MiB floor that never exceeds 20% (except the
|
||||
/// 64 MiB operational minimum). Unknown memory uses a conservative 256 MiB.
|
||||
pub fn buffer_budget_mib(available_bytes: Option<u64>) -> u32 {
|
||||
let Some(bytes) = available_bytes else {
|
||||
return 256;
|
||||
};
|
||||
let mib = bytes / (1024 * 1024);
|
||||
(mib.saturating_mul(15) / 100)
|
||||
.max(512)
|
||||
.min(mib / 5)
|
||||
.clamp(64, 16384) as u32
|
||||
}
|
||||
|
||||
fn default_buffer_mib() -> u32 {
|
||||
// Probe only RAM, once per process: no process enumeration or UI polling.
|
||||
static BUDGET: std::sync::OnceLock<u32> = std::sync::OnceLock::new();
|
||||
*BUDGET.get_or_init(|| {
|
||||
let mut system = sysinfo::System::new();
|
||||
system.refresh_memory_specifics(sysinfo::MemoryRefreshKind::nothing().with_ram());
|
||||
buffer_budget_mib((system.total_memory() > 0).then(|| system.available_memory()))
|
||||
})
|
||||
}
|
||||
|
||||
impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
version: 1,
|
||||
slide_colors: SlideColors::default(),
|
||||
layout: Layout::default(),
|
||||
projects: BTreeMap::new(),
|
||||
display_layouts: BTreeMap::new(),
|
||||
screen_modes: BTreeMap::new(),
|
||||
single_screens: Vec::new(),
|
||||
routes: Routes::default(),
|
||||
presenter_fullscreen: true,
|
||||
presentation_fullscreen: true,
|
||||
browser_monitor: None,
|
||||
thumbnail_size: 220.,
|
||||
buffer_mib: default_buffer_mib(),
|
||||
disk_cache: Default::default(),
|
||||
auto_show: true,
|
||||
autoplay_enabled: false,
|
||||
autoplay_seconds: 5.0,
|
||||
autoplay_loop: false,
|
||||
blank_picture: false,
|
||||
zoom_enabled: false,
|
||||
zoom_keep_fitted_area: false,
|
||||
theme: Default::default(),
|
||||
theme_pack: None,
|
||||
language: Default::default(),
|
||||
language_pack: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl Settings {
|
||||
pub fn validate(&self) -> Result<(), String> {
|
||||
if self.version != 1 {
|
||||
return Err(format!("Unsupported settings version {}", self.version));
|
||||
}
|
||||
if self
|
||||
.theme_pack
|
||||
.as_deref()
|
||||
.is_some_and(|choice| !crate::packs::valid_theme_choice(choice))
|
||||
|| self
|
||||
.language_pack
|
||||
.as_deref()
|
||||
.is_some_and(|locale| !crate::packs::valid_id(locale))
|
||||
{
|
||||
return Err("Invalid language or theme pack choice".into());
|
||||
}
|
||||
self.disk_cache.validate()?;
|
||||
if !(64..=16384).contains(&self.buffer_mib) {
|
||||
return Err("RAM buffer must be 64–16384 MiB per process".into());
|
||||
}
|
||||
if !self.autoplay_seconds.is_finite() || !(0.25..=3600.0).contains(&self.autoplay_seconds) {
|
||||
return Err("Autoplay timing must be 0.25–3600 seconds".into());
|
||||
}
|
||||
if self.projects.len() > 4096 || !(100. ..=400.).contains(&self.thumbnail_size) {
|
||||
return Err("Invalid settings limits".into());
|
||||
}
|
||||
if self.display_layouts.len() > 128
|
||||
|| self
|
||||
.display_layouts
|
||||
.values()
|
||||
.map(|profile| profile.projects.len())
|
||||
.sum::<usize>()
|
||||
> 4096
|
||||
{
|
||||
return Err("Too many display layouts".into());
|
||||
}
|
||||
for (display, profile) in &self.display_layouts {
|
||||
if display.is_empty() || display.len() > 1024 {
|
||||
return Err("Invalid display layout identifier".into());
|
||||
}
|
||||
profile.layout.validate()?;
|
||||
for layout in profile.projects.values() {
|
||||
layout.validate()?;
|
||||
}
|
||||
}
|
||||
validate_single_screens(&self.single_screens)?;
|
||||
validate_screen_modes(&self.screen_modes)?;
|
||||
self.routes.validate()?;
|
||||
self.layout.validate()?;
|
||||
for layout in self.projects.values() {
|
||||
layout.validate()?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
pub fn for_display(&self, display: &str, project: &str) -> Layout {
|
||||
self.display_layouts.get(display).map_or_else(
|
||||
|| self.for_project(project),
|
||||
|profile| {
|
||||
profile
|
||||
.projects
|
||||
.get(project)
|
||||
.unwrap_or(&profile.layout)
|
||||
.clone()
|
||||
},
|
||||
)
|
||||
}
|
||||
pub fn for_project(&self, key: &str) -> Layout {
|
||||
self.projects.get(key).unwrap_or(&self.layout).clone()
|
||||
}
|
||||
}
|
||||
fn select_renamed_paths(
|
||||
settings: PathBuf,
|
||||
cache: PathBuf,
|
||||
legacy_settings: PathBuf,
|
||||
legacy_cache: PathBuf,
|
||||
) -> (PathBuf, PathBuf) {
|
||||
if !settings.exists()
|
||||
&& legacy_settings.is_file()
|
||||
&& let Ok(value) = read(&legacy_settings)
|
||||
{
|
||||
let _ = write(&settings, &value);
|
||||
}
|
||||
let settings = if settings.exists() || !legacy_settings.is_file() {
|
||||
settings
|
||||
} else {
|
||||
legacy_settings
|
||||
};
|
||||
let cache = if cache.exists() || !legacy_cache.exists() {
|
||||
cache
|
||||
} else {
|
||||
legacy_cache
|
||||
};
|
||||
(settings, cache)
|
||||
}
|
||||
|
||||
pub fn paths() -> Result<(PathBuf, PathBuf), String> {
|
||||
let dirs = directories::ProjectDirs::from("com", "Beffroi", "Deckstride")
|
||||
.ok_or("No user configuration directory")?;
|
||||
let legacy_dirs = directories::ProjectDirs::from("com", "Beffroi", "PdfPresenter")
|
||||
.ok_or("No user configuration directory")?;
|
||||
#[cfg(target_os = "linux")]
|
||||
let (config, legacy_config) = {
|
||||
let base = directories::BaseDirs::new().ok_or("No user configuration directory")?;
|
||||
(
|
||||
base.config_dir().join("deckstride"),
|
||||
base.config_dir().join("pdf-presenter"),
|
||||
)
|
||||
};
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
let (config, legacy_config) = (
|
||||
dirs.config_dir().to_path_buf(),
|
||||
legacy_dirs.config_dir().to_path_buf(),
|
||||
);
|
||||
Ok(select_renamed_paths(
|
||||
config.join("settings.toml"),
|
||||
dirs.cache_dir().join("slides-v1"),
|
||||
legacy_config.join("settings.toml"),
|
||||
legacy_dirs.cache_dir().join("slides-v1"),
|
||||
))
|
||||
}
|
||||
pub fn read(path: &Path) -> Result<Settings, String> {
|
||||
match std::fs::File::open(path) {
|
||||
Ok(file) => {
|
||||
use std::io::Read;
|
||||
let mut bytes = Vec::new();
|
||||
file.take(4 * 1024 * 1024 + 1)
|
||||
.read_to_end(&mut bytes)
|
||||
.map_err(|e| e.to_string())?;
|
||||
if bytes.len() > 4 * 1024 * 1024 {
|
||||
return Err("Settings exceed 4 MiB".into());
|
||||
}
|
||||
let value: Settings =
|
||||
toml::from_str(std::str::from_utf8(&bytes).map_err(|e| e.to_string())?)
|
||||
.map_err(|e| e.to_string())?;
|
||||
value.validate()?;
|
||||
Ok(value)
|
||||
}
|
||||
Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(Settings::default()),
|
||||
Err(e) => Err(e.to_string()),
|
||||
}
|
||||
}
|
||||
pub fn write(path: &Path, settings: &Settings) -> Result<(), String> {
|
||||
settings.validate()?;
|
||||
atomic_write(
|
||||
path,
|
||||
toml::to_string_pretty(settings)
|
||||
.map_err(|e| e.to_string())?
|
||||
.as_bytes(),
|
||||
)
|
||||
}
|
||||
pub fn atomic_write(path: &Path, bytes: &[u8]) -> Result<(), String> {
|
||||
use std::io::Write;
|
||||
let dir = path.parent().ok_or("No parent directory")?;
|
||||
std::fs::create_dir_all(dir).map_err(|e| e.to_string())?;
|
||||
let mut file = tempfile::NamedTempFile::new_in(dir).map_err(|e| e.to_string())?;
|
||||
file.write_all(bytes)
|
||||
.and_then(|_| file.as_file().sync_all())
|
||||
.map_err(|e| e.to_string())?;
|
||||
file.persist(path).map_err(|e| e.to_string())?;
|
||||
Ok(())
|
||||
}
|
||||
pub fn project_key(path: &Path) -> String {
|
||||
format!("{:x}", Sha256::digest(path.as_os_str().as_encoded_bytes()))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod rename_tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn renamed_paths_copy_settings_and_reuse_a_warm_cache() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let settings = temp.path().join("new/settings.toml");
|
||||
let cache = temp.path().join("new/cache");
|
||||
let legacy_settings = temp.path().join("legacy/settings.toml");
|
||||
let legacy_cache = temp.path().join("legacy/cache");
|
||||
write(&legacy_settings, &Settings::default()).unwrap();
|
||||
std::fs::create_dir_all(&legacy_cache).unwrap();
|
||||
|
||||
let selected = select_renamed_paths(
|
||||
settings.clone(),
|
||||
cache,
|
||||
legacy_settings,
|
||||
legacy_cache.clone(),
|
||||
);
|
||||
|
||||
assert_eq!(selected, (settings.clone(), legacy_cache));
|
||||
let migrated = read(&settings).unwrap();
|
||||
assert_eq!(migrated.version, 1);
|
||||
assert_eq!(migrated.layout, Layout::default());
|
||||
}
|
||||
}
|
||||
|
|
@ -9,7 +9,7 @@ const MUTED: Color32 = Color32::from_rgb(165, 181, 201);
|
|||
const CYAN: Color32 = Color32::from_rgb(102, 219, 239);
|
||||
const AMBER: Color32 = Color32::from_rgb(246, 197, 119);
|
||||
const PURPLE: Color32 = Color32::from_rgb(102, 85, 217);
|
||||
#[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum Theme {
|
||||
#[default]
|
||||
|
|
@ -53,6 +53,12 @@ pub struct Palette {
|
|||
pub purple: Color32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
enum AppliedTheme {
|
||||
Builtin(Theme),
|
||||
Pack(String),
|
||||
}
|
||||
|
||||
impl Theme {
|
||||
pub const ALL: [Self; 20] = [
|
||||
Self::Midra,
|
||||
|
|
@ -76,7 +82,7 @@ impl Theme {
|
|||
Self::VerdantRebel,
|
||||
Self::WeicatIndustrial,
|
||||
];
|
||||
pub fn name(&self) -> &str {
|
||||
pub fn name(&self) -> &'static str {
|
||||
match self {
|
||||
Self::Midra => "Midra Dark",
|
||||
Self::HighContrast => "High Contrast",
|
||||
|
|
@ -276,49 +282,78 @@ impl Theme {
|
|||
}
|
||||
}
|
||||
pub fn apply(&self, ctx: &egui::Context) {
|
||||
let p = self.palette();
|
||||
let mut v = if self.is_light() {
|
||||
egui::Visuals::light()
|
||||
} else {
|
||||
egui::Visuals::dark()
|
||||
};
|
||||
v.override_text_color = Some(p.text);
|
||||
v.panel_fill = p.bg;
|
||||
v.window_fill = p.panel;
|
||||
v.extreme_bg_color = p.field;
|
||||
v.faint_bg_color = p.bg;
|
||||
v.hyperlink_color = p.cyan;
|
||||
v.warn_fg_color = p.amber;
|
||||
v.error_fg_color = if self.is_light() {
|
||||
Color32::from_rgb(165, 30, 40)
|
||||
} else {
|
||||
Color32::LIGHT_RED
|
||||
};
|
||||
v.window_stroke = egui::Stroke::new(1_f32, p.line);
|
||||
v.selection.bg_fill = p.purple;
|
||||
v.selection.stroke.color = p.text;
|
||||
for (w, fill) in [
|
||||
(&mut v.widgets.noninteractive, p.panel),
|
||||
(&mut v.widgets.inactive, p.field),
|
||||
(&mut v.widgets.hovered, p.panel.lerp_to_gamma(p.text, 0.08)),
|
||||
(&mut v.widgets.active, p.purple),
|
||||
(&mut v.widgets.open, p.panel),
|
||||
] {
|
||||
w.bg_fill = fill;
|
||||
w.weak_bg_fill = fill;
|
||||
w.bg_stroke = egui::Stroke::new(
|
||||
if *self == Self::HighContrast {
|
||||
2_f32
|
||||
} else {
|
||||
1_f32
|
||||
},
|
||||
p.line,
|
||||
);
|
||||
w.fg_stroke = egui::Stroke::new(1_f32, p.text);
|
||||
}
|
||||
ctx.set_visuals(v);
|
||||
apply_palette(
|
||||
ctx,
|
||||
AppliedTheme::Builtin(*self),
|
||||
self.palette(),
|
||||
self.is_light(),
|
||||
*self == Self::HighContrast,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
pub fn apply_selected(ctx: &egui::Context, builtin: Theme, packed: Option<&str>) {
|
||||
if let Some(choice) = packed
|
||||
&& let Some((palette, light, _)) = crate::packs::packed_theme(choice)
|
||||
{
|
||||
apply_palette(
|
||||
ctx,
|
||||
AppliedTheme::Pack(choice.to_owned()),
|
||||
palette,
|
||||
light,
|
||||
false,
|
||||
);
|
||||
} else {
|
||||
builtin.apply(ctx);
|
||||
}
|
||||
}
|
||||
|
||||
fn apply_palette(
|
||||
ctx: &egui::Context,
|
||||
choice: AppliedTheme,
|
||||
p: Palette,
|
||||
light: bool,
|
||||
high_contrast: bool,
|
||||
) {
|
||||
let applied = egui::Id::new("deckstride-theme");
|
||||
if ctx.data(|data| data.get_temp::<AppliedTheme>(applied)) == Some(choice.clone()) {
|
||||
return;
|
||||
}
|
||||
let mut v = if light {
|
||||
egui::Visuals::light()
|
||||
} else {
|
||||
egui::Visuals::dark()
|
||||
};
|
||||
v.override_text_color = Some(p.text);
|
||||
v.panel_fill = p.bg;
|
||||
v.window_fill = p.panel;
|
||||
v.extreme_bg_color = p.field;
|
||||
v.faint_bg_color = p.bg;
|
||||
v.hyperlink_color = p.cyan;
|
||||
v.warn_fg_color = p.amber;
|
||||
v.error_fg_color = if light {
|
||||
Color32::from_rgb(165, 30, 40)
|
||||
} else {
|
||||
Color32::LIGHT_RED
|
||||
};
|
||||
v.window_stroke = egui::Stroke::new(1_f32, p.line);
|
||||
v.selection.bg_fill = p.purple;
|
||||
v.selection.stroke.color = p.text;
|
||||
for (w, fill) in [
|
||||
(&mut v.widgets.noninteractive, p.panel),
|
||||
(&mut v.widgets.inactive, p.field),
|
||||
(&mut v.widgets.hovered, p.panel.lerp_to_gamma(p.text, 0.08)),
|
||||
(&mut v.widgets.active, p.purple),
|
||||
(&mut v.widgets.open, p.panel),
|
||||
] {
|
||||
w.bg_fill = fill;
|
||||
w.weak_bg_fill = fill;
|
||||
w.bg_stroke = egui::Stroke::new(if high_contrast { 2_f32 } else { 1_f32 }, p.line);
|
||||
w.fg_stroke = egui::Stroke::new(1_f32, p.text);
|
||||
}
|
||||
ctx.set_visuals(v);
|
||||
ctx.data_mut(|data| data.insert_temp(applied, choice));
|
||||
}
|
||||
fn sotv_palette(colors: [u32; 8], light: bool) -> Palette {
|
||||
let [bg, panel, field, layer, text, subtle, accent, line] =
|
||||
colors.map(|hex| Color32::from_rgb((hex >> 16) as u8, (hex >> 8) as u8, hex as u8));
|
||||
|
|
@ -350,3 +385,19 @@ fn sotv_palette(colors: [u32; 8], light: bool) -> Palette {
|
|||
pattern: [layer, panel],
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn repeated_theme_application_keeps_the_existing_style() {
|
||||
let ctx = egui::Context::default();
|
||||
Theme::Midra.apply(&ctx);
|
||||
let first = ctx.global_style();
|
||||
Theme::Midra.apply(&ctx);
|
||||
assert!(std::sync::Arc::ptr_eq(&first, &ctx.global_style()));
|
||||
Theme::CorporateLight.apply(&ctx);
|
||||
assert!(!std::sync::Arc::ptr_eq(&first, &ctx.global_style()));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,65 @@
|
|||
//! Monotonic presentation timer; no threads or wall-clock dependence.
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Timer {
|
||||
accumulated: Duration,
|
||||
running_since: Option<Instant>,
|
||||
pub waiting_for_action: bool,
|
||||
}
|
||||
impl Default for Timer {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
accumulated: Duration::ZERO,
|
||||
running_since: None,
|
||||
waiting_for_action: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl Timer {
|
||||
pub fn elapsed(&self, now: Instant) -> Duration {
|
||||
self.accumulated
|
||||
+ self
|
||||
.running_since
|
||||
.map_or(Duration::ZERO, |start| now.saturating_duration_since(start))
|
||||
}
|
||||
pub fn running(&self, now: Instant, limit: Option<Duration>) -> bool {
|
||||
self.running_since.is_some() && limit.is_none_or(|limit| self.elapsed(now) < limit)
|
||||
}
|
||||
pub fn seconds(&self, now: Instant, limit: Option<Duration>) -> u64 {
|
||||
let elapsed = self.elapsed(now);
|
||||
match limit {
|
||||
Some(limit) => {
|
||||
let remaining = limit.saturating_sub(elapsed);
|
||||
remaining.as_secs() + u64::from(remaining.subsec_nanos() > 0)
|
||||
}
|
||||
None => elapsed.as_secs(),
|
||||
}
|
||||
}
|
||||
/// Return to zero and wait for the next presentation action.
|
||||
pub fn reset(&mut self) {
|
||||
self.accumulated = Duration::ZERO;
|
||||
self.running_since = None;
|
||||
self.waiting_for_action = true;
|
||||
}
|
||||
pub fn toggle(&mut self, now: Instant, limit: Option<Duration>) {
|
||||
self.waiting_for_action = false;
|
||||
if self.running(now, limit) {
|
||||
self.accumulated = self.elapsed(now);
|
||||
self.running_since = None;
|
||||
} else if limit.is_some_and(|limit| self.elapsed(now) >= limit) {
|
||||
self.accumulated = Duration::ZERO;
|
||||
self.running_since = Some(now);
|
||||
} else {
|
||||
self.running_since = Some(now);
|
||||
}
|
||||
}
|
||||
pub fn presentation_action(&mut self, now: Instant, automatic: bool) {
|
||||
if self.waiting_for_action {
|
||||
self.waiting_for_action = false;
|
||||
if automatic {
|
||||
self.running_since = Some(now);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,318 @@
|
|||
//! Bounded, resolution-independent presentation annotations.
|
||||
use egui::{Color32, Pos2, Rect, Stroke, Vec2};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
pub const MAX_MARKS: usize = 64;
|
||||
pub const MIN_TOOL_SIZE: f32 = 4.;
|
||||
pub const MAX_TOOL_SIZE: f32 = 48.;
|
||||
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
|
||||
pub enum Tool {
|
||||
#[default]
|
||||
Off,
|
||||
Pointer,
|
||||
Arrow,
|
||||
Highlighter,
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Serialize, Deserialize)]
|
||||
pub enum MarkKind {
|
||||
Arrow,
|
||||
Highlighter,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Mark {
|
||||
pub kind: MarkKind,
|
||||
pub from: [f32; 2],
|
||||
pub to: [f32; 2],
|
||||
pub color: [u8; 3],
|
||||
pub width: f32,
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Overlay {
|
||||
#[serde(default)]
|
||||
pub pointer: Option<[f32; 2]>,
|
||||
#[serde(default)]
|
||||
pub pointer_color: [u8; 3],
|
||||
#[serde(default)]
|
||||
pub pointer_size: f32,
|
||||
#[serde(default)]
|
||||
pub marks: Vec<Mark>,
|
||||
}
|
||||
|
||||
impl Overlay {
|
||||
pub fn normalized(mut self) -> Self {
|
||||
self.pointer = self.pointer.and_then(normalized_point);
|
||||
self.pointer_size = finite_clamp(self.pointer_size, MIN_TOOL_SIZE, MAX_TOOL_SIZE, 12.);
|
||||
self.marks.truncate(MAX_MARKS);
|
||||
self.marks.retain_mut(|mark| {
|
||||
let Some(from) = normalized_point(mark.from) else {
|
||||
return false;
|
||||
};
|
||||
let Some(to) = normalized_point(mark.to) else {
|
||||
return false;
|
||||
};
|
||||
mark.from = from;
|
||||
mark.to = to;
|
||||
mark.width = finite_clamp(mark.width, 2., MAX_TOOL_SIZE, 8.);
|
||||
true
|
||||
});
|
||||
self
|
||||
}
|
||||
}
|
||||
|
||||
fn finite_clamp(value: f32, min: f32, max: f32, fallback: f32) -> f32 {
|
||||
if value.is_finite() {
|
||||
value.clamp(min, max)
|
||||
} else {
|
||||
fallback
|
||||
}
|
||||
}
|
||||
|
||||
fn normalized_point(point: [f32; 2]) -> Option<[f32; 2]> {
|
||||
point
|
||||
.iter()
|
||||
.all(|value| value.is_finite())
|
||||
.then(|| point.map(|value| value.clamp(0., 1.)))
|
||||
}
|
||||
|
||||
pub struct Toolbox {
|
||||
pub open: bool,
|
||||
pub tool: Tool,
|
||||
pub color: [u8; 3],
|
||||
pub size: f32,
|
||||
pub overlay: Overlay,
|
||||
drag_mark: Option<usize>,
|
||||
}
|
||||
|
||||
impl Default for Toolbox {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
open: false,
|
||||
tool: Tool::Off,
|
||||
color: [244, 67, 54],
|
||||
size: 10.,
|
||||
overlay: Overlay {
|
||||
pointer_color: [244, 67, 54],
|
||||
pointer_size: 10.,
|
||||
..Default::default()
|
||||
},
|
||||
drag_mark: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Toolbox {
|
||||
pub fn select(&mut self, tool: Tool) -> bool {
|
||||
self.tool = tool;
|
||||
self.drag_mark = None;
|
||||
tool != Tool::Pointer && self.overlay.pointer.take().is_some()
|
||||
}
|
||||
|
||||
pub fn set_pointer(&mut self, point: Option<[f32; 2]>) -> bool {
|
||||
let point = point.and_then(normalized_point);
|
||||
let changed = self.overlay.pointer != point
|
||||
|| self.overlay.pointer_color != self.color
|
||||
|| self.overlay.pointer_size != self.size;
|
||||
self.overlay.pointer = point;
|
||||
self.overlay.pointer_color = self.color;
|
||||
self.overlay.pointer_size = self.size;
|
||||
changed
|
||||
}
|
||||
|
||||
pub fn begin_mark(&mut self, point: [f32; 2]) -> bool {
|
||||
let kind = match self.tool {
|
||||
Tool::Arrow => MarkKind::Arrow,
|
||||
Tool::Highlighter => MarkKind::Highlighter,
|
||||
_ => return false,
|
||||
};
|
||||
if self.overlay.marks.len() == MAX_MARKS {
|
||||
self.overlay.marks.remove(0);
|
||||
}
|
||||
self.overlay.marks.push(Mark {
|
||||
kind,
|
||||
from: point,
|
||||
to: point,
|
||||
color: self.color,
|
||||
width: self.size,
|
||||
});
|
||||
self.drag_mark = Some(self.overlay.marks.len() - 1);
|
||||
true
|
||||
}
|
||||
|
||||
pub fn update_mark(&mut self, point: [f32; 2]) -> bool {
|
||||
let Some(mark) = self
|
||||
.drag_mark
|
||||
.and_then(|index| self.overlay.marks.get_mut(index))
|
||||
else {
|
||||
return false;
|
||||
};
|
||||
let Some(point) = normalized_point(point) else {
|
||||
return false;
|
||||
};
|
||||
if mark.to == point {
|
||||
return false;
|
||||
}
|
||||
mark.to = point;
|
||||
true
|
||||
}
|
||||
|
||||
pub fn end_mark(&mut self) {
|
||||
self.drag_mark = None;
|
||||
}
|
||||
|
||||
pub fn undo(&mut self) -> bool {
|
||||
self.drag_mark = None;
|
||||
self.overlay.marks.pop().is_some()
|
||||
}
|
||||
|
||||
pub fn clear(&mut self) -> bool {
|
||||
self.drag_mark = None;
|
||||
let changed = self.overlay.pointer.take().is_some() || !self.overlay.marks.is_empty();
|
||||
self.overlay.marks.clear();
|
||||
changed
|
||||
}
|
||||
}
|
||||
|
||||
pub fn screen_to_page(target: Rect, uv: Rect, point: Pos2) -> [f32; 2] {
|
||||
let local = (point - target.min) / target.size().max(Vec2::splat(1.));
|
||||
let page = uv.min + local * uv.size();
|
||||
[page.x.clamp(0., 1.), page.y.clamp(0., 1.)]
|
||||
}
|
||||
|
||||
fn page_to_screen(target: Rect, uv: Rect, point: [f32; 2]) -> Option<Pos2> {
|
||||
let point = Pos2::new(point[0], point[1]);
|
||||
uv.contains(point).then(|| {
|
||||
target.min + (point - uv.min) / uv.size().max(Vec2::splat(f32::EPSILON)) * target.size()
|
||||
})
|
||||
}
|
||||
|
||||
pub fn paint(painter: &egui::Painter, target: Rect, uv: Rect, overlay: &Overlay) {
|
||||
paint_scaled(painter, target, uv, overlay, 1.);
|
||||
}
|
||||
|
||||
/// Scale fixed-width marks so a smaller Presenter preview resembles the Slides view.
|
||||
pub fn paint_scaled(
|
||||
painter: &egui::Painter,
|
||||
target: Rect,
|
||||
uv: Rect,
|
||||
overlay: &Overlay,
|
||||
scale: f32,
|
||||
) {
|
||||
let scale = finite_clamp(scale, 0.05, 4., 1.);
|
||||
for mark in overlay.marks.iter().take(MAX_MARKS) {
|
||||
let (Some(from), Some(to)) = (
|
||||
page_to_screen(target, uv, mark.from),
|
||||
page_to_screen(target, uv, mark.to),
|
||||
) else {
|
||||
continue;
|
||||
};
|
||||
let color = match mark.kind {
|
||||
MarkKind::Arrow => Color32::from_rgb(mark.color[0], mark.color[1], mark.color[2]),
|
||||
MarkKind::Highlighter => {
|
||||
Color32::from_rgba_unmultiplied(mark.color[0], mark.color[1], mark.color[2], 105)
|
||||
}
|
||||
};
|
||||
let width = mark.width * scale;
|
||||
if mark.kind == MarkKind::Arrow
|
||||
&& let Some((shaft_end, head)) = arrow_geometry(from, to, mark.width, scale)
|
||||
{
|
||||
painter.line_segment([from, shaft_end], Stroke::new(width, color));
|
||||
painter.add(egui::Shape::convex_polygon(
|
||||
head.to_vec(),
|
||||
color,
|
||||
Stroke::NONE,
|
||||
));
|
||||
} else {
|
||||
painter.line_segment([from, to], Stroke::new(width, color));
|
||||
}
|
||||
}
|
||||
if let Some(point) = overlay
|
||||
.pointer
|
||||
.and_then(|point| page_to_screen(target, uv, point))
|
||||
{
|
||||
let color = Color32::from_rgb(
|
||||
overlay.pointer_color[0],
|
||||
overlay.pointer_color[1],
|
||||
overlay.pointer_color[2],
|
||||
);
|
||||
painter.circle_filled(point, overlay.pointer_size * scale, color);
|
||||
painter.circle_stroke(
|
||||
point,
|
||||
(overlay.pointer_size + 2.) * scale,
|
||||
Stroke::new(2. * scale, Color32::WHITE),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// Make a tool size occupy the same share of the slide at every output resolution.
|
||||
/// egui points account for monitor DPI, so 1080 logical points is also the correct
|
||||
/// baseline for a 4K screen using 200% display scaling.
|
||||
pub fn slide_paint_scale(target: Rect) -> f32 {
|
||||
finite_clamp(target.height() / 1080., 0.05, 4., 1.)
|
||||
}
|
||||
|
||||
/// A filled head avoids the three overlapping thick strokes that deform large arrows.
|
||||
fn arrow_geometry(from: Pos2, to: Pos2, width: f32, scale: f32) -> Option<(Pos2, [Pos2; 3])> {
|
||||
let vector = to - from;
|
||||
let distance = vector.length();
|
||||
if distance <= 2. * scale {
|
||||
return None;
|
||||
}
|
||||
let direction = vector / distance;
|
||||
let normal = Vec2::new(-direction.y, direction.x);
|
||||
let width = width * scale;
|
||||
let head_length = (width * 1.8)
|
||||
.clamp(10. * scale, 56. * scale)
|
||||
.min(distance * 0.45);
|
||||
let head_half_width = (width * 0.9)
|
||||
.clamp(6. * scale, 30. * scale)
|
||||
.min(head_length * 0.75);
|
||||
let base = to - direction * head_length;
|
||||
let shaft_end = base + direction * (width * 0.12).min(head_length * 0.12);
|
||||
Some((
|
||||
shaft_end,
|
||||
[
|
||||
to,
|
||||
base + normal * head_half_width,
|
||||
base - normal * head_half_width,
|
||||
],
|
||||
))
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn large_arrow_has_a_bounded_filled_head_and_shortened_shaft() {
|
||||
let from = Pos2::new(0., 0.);
|
||||
let to = Pos2::new(0., 200.);
|
||||
let (shaft_end, head) = arrow_geometry(from, to, 48., 1.).unwrap();
|
||||
assert!(shaft_end.y < to.y);
|
||||
assert_eq!(head[0], to);
|
||||
assert!(head[1].distance(head[2]) <= 60.);
|
||||
assert!(to.distance(head[1]) < 70.);
|
||||
|
||||
let (_, short_head) = arrow_geometry(from, Pos2::new(20., 0.), 48., 1.).unwrap();
|
||||
assert!(short_head[0].distance(short_head[1]) < 15.);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn screen_scale_keeps_tools_and_arrow_heads_proportional() {
|
||||
let hd = Rect::from_min_size(Pos2::ZERO, Vec2::new(1920., 1080.));
|
||||
let uhd = Rect::from_min_size(Pos2::ZERO, Vec2::new(3840., 2160.));
|
||||
let preview = Rect::from_min_size(Pos2::ZERO, Vec2::new(480., 270.));
|
||||
assert_eq!(slide_paint_scale(hd), 1.);
|
||||
assert_eq!(slide_paint_scale(uhd), 2.);
|
||||
assert_eq!(slide_paint_scale(preview), 0.25);
|
||||
assert_eq!(MAX_TOOL_SIZE * slide_paint_scale(hd), 48.);
|
||||
assert_eq!(MAX_TOOL_SIZE * slide_paint_scale(uhd), 96.);
|
||||
|
||||
let (_, full) = arrow_geometry(Pos2::ZERO, Pos2::new(400., 0.), 32., 1.).unwrap();
|
||||
let (_, small) = arrow_geometry(Pos2::ZERO, Pos2::new(100., 0.), 32., 0.25).unwrap();
|
||||
assert!((full[1].distance(full[2]) * 0.25 - small[1].distance(small[2])).abs() < 0.01);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,181 @@
|
|||
//! Per-user Windows shell registration for the portable executable.
|
||||
|
||||
#[cfg(any(target_os = "windows", test))]
|
||||
use std::path::Path;
|
||||
|
||||
#[cfg(any(target_os = "windows", test))]
|
||||
fn open_command(executable: &Path) -> String {
|
||||
format!(r#"\"{}\" --open \"%1\""#, executable.display())
|
||||
}
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
pub fn register_pdf_association() -> Result<(), String> {
|
||||
use std::{ffi::c_void, os::windows::ffi::OsStrExt, ptr};
|
||||
|
||||
type Hkey = *mut c_void;
|
||||
const HKEY_CURRENT_USER: Hkey = 0x8000_0001usize as Hkey;
|
||||
const KEY_SET_VALUE: u32 = 0x0002;
|
||||
const REG_SZ: u32 = 1;
|
||||
const SHCNE_ASSOCCHANGED: i32 = 0x0800_0000;
|
||||
const SHCNF_IDLIST: u32 = 0;
|
||||
|
||||
#[link(name = "advapi32")]
|
||||
unsafe extern "system" {
|
||||
fn RegCreateKeyExW(
|
||||
root: Hkey,
|
||||
subkey: *const u16,
|
||||
reserved: u32,
|
||||
class: *mut u16,
|
||||
options: u32,
|
||||
access: u32,
|
||||
security: *const c_void,
|
||||
result: *mut Hkey,
|
||||
disposition: *mut u32,
|
||||
) -> i32;
|
||||
fn RegSetValueExW(
|
||||
key: Hkey,
|
||||
name: *const u16,
|
||||
reserved: u32,
|
||||
kind: u32,
|
||||
data: *const u8,
|
||||
bytes: u32,
|
||||
) -> i32;
|
||||
fn RegCloseKey(key: Hkey) -> i32;
|
||||
}
|
||||
#[link(name = "shell32")]
|
||||
unsafe extern "system" {
|
||||
fn SHChangeNotify(event: i32, flags: u32, item1: *const c_void, item2: *const c_void);
|
||||
fn ShellExecuteW(
|
||||
window: *mut c_void,
|
||||
operation: *const u16,
|
||||
file: *const u16,
|
||||
parameters: *const u16,
|
||||
directory: *const u16,
|
||||
show: i32,
|
||||
) -> isize;
|
||||
}
|
||||
|
||||
fn wide(value: &std::ffi::OsStr) -> Vec<u16> {
|
||||
value.encode_wide().chain(Some(0)).collect()
|
||||
}
|
||||
fn set_value(root: Hkey, subkey: &str, name: Option<&str>, value: &str) -> Result<(), String> {
|
||||
let subkey = wide(std::ffi::OsStr::new(subkey));
|
||||
let name = name.map(|name| wide(std::ffi::OsStr::new(name)));
|
||||
let value = wide(std::ffi::OsStr::new(value));
|
||||
let mut key = ptr::null_mut();
|
||||
// SAFETY: all pointers refer to live, NUL-terminated buffers. The returned
|
||||
// handle is closed before this function returns.
|
||||
let created = unsafe {
|
||||
RegCreateKeyExW(
|
||||
root,
|
||||
subkey.as_ptr(),
|
||||
0,
|
||||
ptr::null_mut(),
|
||||
0,
|
||||
KEY_SET_VALUE,
|
||||
ptr::null(),
|
||||
&mut key,
|
||||
ptr::null_mut(),
|
||||
)
|
||||
};
|
||||
if created != 0 {
|
||||
return Err(format!("Windows registry error {created}"));
|
||||
}
|
||||
// SAFETY: key is valid and value/name remain live for the duration of the call.
|
||||
let written = unsafe {
|
||||
RegSetValueExW(
|
||||
key,
|
||||
name.as_ref().map_or(ptr::null(), |name| name.as_ptr()),
|
||||
0,
|
||||
REG_SZ,
|
||||
value.as_ptr().cast(),
|
||||
(value.len() * 2) as u32,
|
||||
)
|
||||
};
|
||||
// SAFETY: key was returned by RegCreateKeyExW and is no longer used.
|
||||
unsafe { RegCloseKey(key) };
|
||||
(written == 0)
|
||||
.then_some(())
|
||||
.ok_or_else(|| format!("Windows registry error {written}"))
|
||||
}
|
||||
|
||||
let executable = std::env::current_exe().map_err(|error| error.to_string())?;
|
||||
let executable_text = executable.to_string_lossy();
|
||||
let icon = format!(r#"\"{executable_text}\",0"#);
|
||||
let command = open_command(&executable);
|
||||
let values = [
|
||||
(
|
||||
r"Software\Classes\Deckstride.Document",
|
||||
None,
|
||||
"Deckstride document",
|
||||
),
|
||||
(
|
||||
r"Software\Classes\Deckstride.Document\DefaultIcon",
|
||||
None,
|
||||
icon.as_str(),
|
||||
),
|
||||
(
|
||||
r"Software\Classes\Deckstride.Document\shell\open\command",
|
||||
None,
|
||||
command.as_str(),
|
||||
),
|
||||
(
|
||||
r"Software\Deckstride\Capabilities",
|
||||
Some("ApplicationName"),
|
||||
"Deckstride",
|
||||
),
|
||||
(
|
||||
r"Software\Deckstride\Capabilities",
|
||||
Some("ApplicationDescription"),
|
||||
"Fast multi-screen PDF presenter",
|
||||
),
|
||||
(
|
||||
r"Software\Deckstride\Capabilities\FileAssociations",
|
||||
Some(".pdf"),
|
||||
"Deckstride.Document",
|
||||
),
|
||||
(
|
||||
r"Software\RegisteredApplications",
|
||||
Some("Deckstride"),
|
||||
r"Software\Deckstride\Capabilities",
|
||||
),
|
||||
];
|
||||
for (subkey, name, value) in values {
|
||||
set_value(HKEY_CURRENT_USER, subkey, name, value)?;
|
||||
}
|
||||
// SAFETY: association refresh carries no payload for SHCNE_ASSOCCHANGED.
|
||||
unsafe { SHChangeNotify(SHCNE_ASSOCCHANGED, SHCNF_IDLIST, ptr::null(), ptr::null()) };
|
||||
|
||||
let operation = wide(std::ffi::OsStr::new("open"));
|
||||
let settings = wide(std::ffi::OsStr::new("ms-settings:defaultapps"));
|
||||
// SAFETY: strings are NUL terminated and remain live through the call.
|
||||
let opened = unsafe {
|
||||
ShellExecuteW(
|
||||
ptr::null_mut(),
|
||||
operation.as_ptr(),
|
||||
settings.as_ptr(),
|
||||
ptr::null(),
|
||||
ptr::null(),
|
||||
1,
|
||||
)
|
||||
};
|
||||
if opened <= 32 {
|
||||
return Err(format!(
|
||||
"Registered successfully, but Windows Settings could not open ({opened})"
|
||||
));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn association_command_quotes_executable_and_document() {
|
||||
assert_eq!(
|
||||
open_command(Path::new(r"C:\Portable Apps\deckstride.exe")),
|
||||
r#"\"C:\Portable Apps\deckstride.exe\" --open \"%1\""#
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -34,6 +34,45 @@ pub enum Request {
|
|||
path: PathBuf,
|
||||
cache: PathBuf,
|
||||
},
|
||||
PreviewNotesImport {
|
||||
path: PathBuf,
|
||||
cache: PathBuf,
|
||||
source_sha: String,
|
||||
import: PathBuf,
|
||||
},
|
||||
ApplyNotesImport {
|
||||
path: PathBuf,
|
||||
cache: PathBuf,
|
||||
source_sha: String,
|
||||
preview: crate::notes::ImportPreview,
|
||||
},
|
||||
PickBlankPicture {
|
||||
owner: Option<isize>,
|
||||
},
|
||||
BlankPicture {
|
||||
source: Option<PathBuf>,
|
||||
path: PathBuf,
|
||||
},
|
||||
PickNotes {
|
||||
owner: Option<isize>,
|
||||
},
|
||||
PickPack {
|
||||
language: bool,
|
||||
owner: Option<isize>,
|
||||
},
|
||||
PrepareNotes {
|
||||
path: PathBuf,
|
||||
cache: PathBuf,
|
||||
source_sha: String,
|
||||
},
|
||||
SaveNotes {
|
||||
path: PathBuf,
|
||||
cache: PathBuf,
|
||||
source_sha: String,
|
||||
revision: String,
|
||||
page: usize,
|
||||
text: String,
|
||||
},
|
||||
Preview {
|
||||
epoch: u64,
|
||||
path: PathBuf,
|
||||
|
|
@ -43,6 +82,12 @@ pub enum Request {
|
|||
},
|
||||
ReadFrame(PathBuf),
|
||||
LoadSettings(PathBuf),
|
||||
CleanCache {
|
||||
path: PathBuf,
|
||||
policy: crate::cache::Policy,
|
||||
protected: Vec<String>,
|
||||
manual: bool,
|
||||
},
|
||||
SaveSettings {
|
||||
path: PathBuf,
|
||||
settings: Box<Settings>,
|
||||
|
|
@ -60,10 +105,13 @@ pub struct Reply {
|
|||
pub info: Option<DeckInfo>,
|
||||
pub frame: Option<FrameInfo>,
|
||||
pub settings: Option<Settings>,
|
||||
pub notes: Option<crate::notes::Snapshot>,
|
||||
pub notes_import: Option<crate::notes::ImportPreview>,
|
||||
pub picked: Option<PathBuf>,
|
||||
pub bytes: usize,
|
||||
pub edge: Option<u32>,
|
||||
pub cached: bool,
|
||||
pub cleanup: Option<crate::cache::Report>,
|
||||
}
|
||||
pub struct ResultPacket {
|
||||
pub reply: Reply,
|
||||
|
|
@ -189,6 +237,91 @@ pub fn run() -> Result<(), String> {
|
|||
Request::Notes { path, cache } => {
|
||||
reply.info = Some(document::Document::open(&path, cache)?.info);
|
||||
}
|
||||
Request::PreviewNotesImport {
|
||||
path,
|
||||
cache,
|
||||
source_sha,
|
||||
import,
|
||||
} => {
|
||||
reply.notes_import = Some(crate::notes::preview_import(
|
||||
&path,
|
||||
cache,
|
||||
&source_sha,
|
||||
&import,
|
||||
)?);
|
||||
}
|
||||
Request::ApplyNotesImport {
|
||||
path,
|
||||
cache,
|
||||
source_sha,
|
||||
preview,
|
||||
} => {
|
||||
reply.notes = Some(crate::notes::apply_import(
|
||||
&path,
|
||||
cache,
|
||||
&source_sha,
|
||||
preview,
|
||||
)?);
|
||||
}
|
||||
Request::PickBlankPicture { owner } => {
|
||||
reply.picked = picker_dialog(owner)?
|
||||
.add_filter(
|
||||
"Picture",
|
||||
&["png", "jpg", "jpeg", "webp", "bmp", "gif", "tif", "tiff"],
|
||||
)
|
||||
.pick_file();
|
||||
}
|
||||
Request::BlankPicture { source, path } => {
|
||||
let frame = crate::blank::prepare(source.as_deref(), &path)?;
|
||||
reply.frame = Some(frame.info);
|
||||
data = frame.rgba;
|
||||
}
|
||||
Request::PickNotes { owner } => {
|
||||
reply.picked = picker_dialog(owner)?
|
||||
.add_filter("Notes (TXT, Markdown)", &["txt", "md"])
|
||||
.pick_file();
|
||||
}
|
||||
Request::PickPack { language, owner } => {
|
||||
reply.picked = picker_dialog(owner)?
|
||||
.set_title(if language {
|
||||
"Import language pack"
|
||||
} else {
|
||||
"Import theme pack"
|
||||
})
|
||||
.add_filter(
|
||||
if language {
|
||||
"Language pack"
|
||||
} else {
|
||||
"Theme pack"
|
||||
},
|
||||
&["zip"],
|
||||
)
|
||||
.pick_file();
|
||||
}
|
||||
Request::PrepareNotes {
|
||||
path,
|
||||
cache,
|
||||
source_sha,
|
||||
} => {
|
||||
reply.notes = Some(crate::notes::prepare(&path, cache, &source_sha)?);
|
||||
}
|
||||
Request::SaveNotes {
|
||||
path,
|
||||
cache,
|
||||
source_sha,
|
||||
revision,
|
||||
page,
|
||||
text,
|
||||
} => {
|
||||
reply.notes = Some(crate::notes::save(
|
||||
&path,
|
||||
cache,
|
||||
&source_sha,
|
||||
&revision,
|
||||
page,
|
||||
text,
|
||||
)?);
|
||||
}
|
||||
Request::ReadFrame(path) => {
|
||||
let (width, height, rgba) = document::read_frame(&path)?;
|
||||
reply.frame = Some(FrameInfo {
|
||||
|
|
@ -200,6 +333,20 @@ pub fn run() -> Result<(), String> {
|
|||
});
|
||||
data = rgba;
|
||||
}
|
||||
Request::CleanCache {
|
||||
path,
|
||||
policy,
|
||||
protected,
|
||||
manual,
|
||||
} => {
|
||||
reply.cleanup = Some(crate::cache::clean(
|
||||
&path,
|
||||
&policy,
|
||||
&protected,
|
||||
manual,
|
||||
std::time::SystemTime::now(),
|
||||
)?);
|
||||
}
|
||||
Request::LoadSettings(path) => reply.settings = Some(settings::read(&path)?),
|
||||
Request::SaveSettings { path, settings } => settings::write(&path, &settings)?,
|
||||
Request::Pick { folder, owner } => {
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
//! Bounded, resolution-independent crop of an already buffered slide.
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
|
||||
pub struct View {
|
||||
pub scale: f32,
|
||||
pub center: [f32; 2],
|
||||
}
|
||||
impl Default for View {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
scale: 1.,
|
||||
center: [0.5; 2],
|
||||
}
|
||||
}
|
||||
}
|
||||
impl View {
|
||||
pub fn normalized(self) -> Self {
|
||||
if !self.scale.is_finite() || self.center.iter().any(|v| !v.is_finite()) {
|
||||
return Self::default();
|
||||
}
|
||||
let scale = self.scale.clamp(1., 8.);
|
||||
let half = 0.5 / scale;
|
||||
Self {
|
||||
scale,
|
||||
center: self.center.map(|v| v.clamp(half, 1. - half)),
|
||||
}
|
||||
}
|
||||
pub fn zoom_at(self, scale: f32, anchor: [f32; 2]) -> Self {
|
||||
let old = self.normalized();
|
||||
let scale = if scale.is_finite() {
|
||||
scale.clamp(1., 8.)
|
||||
} else {
|
||||
old.scale
|
||||
};
|
||||
let mut next = Self { scale, ..old };
|
||||
for (i, a) in anchor.into_iter().enumerate() {
|
||||
if a.is_finite() {
|
||||
next.center[i] += (a.clamp(0., 1.) - 0.5) * (1. / old.scale - 1. / scale);
|
||||
}
|
||||
}
|
||||
next.normalized()
|
||||
}
|
||||
/// Drag displacement as a fraction of the fitted slide viewport.
|
||||
pub fn pan(self, delta: [f32; 2]) -> Self {
|
||||
let mut next = self.normalized();
|
||||
for (i, d) in delta.into_iter().enumerate() {
|
||||
if d.is_finite() {
|
||||
next.center[i] -= d / next.scale;
|
||||
}
|
||||
}
|
||||
next.normalized()
|
||||
}
|
||||
pub fn uv(self) -> egui::Rect {
|
||||
let v = self.normalized();
|
||||
egui::Rect::from_center_size(
|
||||
egui::pos2(v.center[0], v.center[1]),
|
||||
egui::Vec2::splat(1. / v.scale),
|
||||
)
|
||||
}
|
||||
}
|
||||
/// Presenter epochs override output gestures. Output serials order local gestures
|
||||
/// within an epoch, allowing bounded channels to coalesce and retry latest state.
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Serialize, Deserialize)]
|
||||
pub struct Sync {
|
||||
pub enabled: bool,
|
||||
#[serde(default)]
|
||||
pub keep_fitted_area: bool,
|
||||
pub view: View,
|
||||
pub epoch: u64,
|
||||
pub serial: u64,
|
||||
}
|
||||
impl Sync {
|
||||
pub fn normalized(mut self) -> Self {
|
||||
self.view = if self.enabled {
|
||||
self.view.normalized()
|
||||
} else {
|
||||
View::default()
|
||||
};
|
||||
self
|
||||
}
|
||||
pub fn set(&mut self, enabled: bool, view: View) {
|
||||
self.enabled = enabled;
|
||||
self.view = view;
|
||||
self.epoch = self.epoch.wrapping_add(1);
|
||||
self.serial = 0;
|
||||
*self = self.normalized();
|
||||
}
|
||||
pub fn gesture(&mut self, view: View) {
|
||||
if self.enabled {
|
||||
self.view = view.normalized();
|
||||
self.serial = self.serial.wrapping_add(1);
|
||||
}
|
||||
}
|
||||
pub fn accept_output(&mut self, other: Self) -> bool {
|
||||
if !self.enabled
|
||||
|| !other.enabled
|
||||
|| other.epoch != self.epoch
|
||||
|| other.serial <= self.serial
|
||||
{
|
||||
return false;
|
||||
}
|
||||
*self = other.normalized();
|
||||
true
|
||||
}
|
||||
pub fn accept_presenter(&mut self, other: Self) {
|
||||
if (other.epoch, other.serial) >= (self.epoch, self.serial) {
|
||||
*self = other.normalized();
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Default)]
|
||||
pub struct PerformanceWatch {
|
||||
slow: u8,
|
||||
}
|
||||
impl PerformanceWatch {
|
||||
/// Three consecutive zoomed frames above a 30 Hz frame budget trigger notice.
|
||||
pub fn observe(&mut self, active: bool, elapsed: std::time::Duration) -> bool {
|
||||
self.slow = if active && elapsed > std::time::Duration::from_millis(33) {
|
||||
self.slow.saturating_add(1)
|
||||
} else {
|
||||
0
|
||||
};
|
||||
self.slow >= 3
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,71 @@
|
|||
mod common;
|
||||
use deckstride::{
|
||||
blank,
|
||||
studio::{Action, Studio},
|
||||
};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
#[test]
|
||||
fn managed_picture_is_bounded_durable_and_checked() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let source = dir.path().join("source.png");
|
||||
let target = dir.path().join("blank-picture.rgba");
|
||||
image::RgbaImage::from_pixel(3000, 1500, image::Rgba([10u8, 20, 30, 128]))
|
||||
.save(&source)
|
||||
.unwrap();
|
||||
let original = std::fs::read(&source).unwrap();
|
||||
let frame = blank::prepare(Some(&source), &target).unwrap();
|
||||
assert_eq!((frame.info.width, frame.info.height), (2048, 1024));
|
||||
assert_eq!(original, std::fs::read(&source).unwrap());
|
||||
std::fs::remove_file(&source).unwrap();
|
||||
assert_eq!(blank::prepare(None, &target).unwrap().rgba, frame.rgba);
|
||||
assert!(blank::prepare(Some(&source), &target).is_err());
|
||||
assert_eq!(
|
||||
blank::prepare(None, &target).unwrap().info.sha256,
|
||||
frame.info.sha256
|
||||
);
|
||||
let mut data = std::fs::read(&target).unwrap();
|
||||
data[8] ^= 1;
|
||||
std::fs::write(&target, data).unwrap();
|
||||
assert!(
|
||||
blank::prepare(None, &target)
|
||||
.err()
|
||||
.unwrap()
|
||||
.contains("checksum")
|
||||
);
|
||||
std::fs::write(&target, b"bad").unwrap();
|
||||
assert!(blank::prepare(None, &target).is_err());
|
||||
}
|
||||
|
||||
fn until(s: &mut Studio, done: impl Fn(&Studio) -> bool) {
|
||||
let deadline = Instant::now() + Duration::from_secs(10);
|
||||
while !done(s) {
|
||||
assert!(Instant::now() < deadline, "{}", s.status);
|
||||
s.poll();
|
||||
std::thread::sleep(Duration::from_millis(5));
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn worker_import_failure_and_clear_preserve_blank_state() {
|
||||
let dir = tempfile::tempdir().unwrap();
|
||||
let source = dir.path().join("picture.png");
|
||||
common::image(&source, [20, 50, 90, 255]);
|
||||
let mut s = Studio::with_program(true, None, env!("CARGO_BIN_EXE_deckstride").into());
|
||||
until(&mut s, |s| s.initialized);
|
||||
s.blanked = true;
|
||||
s.execute(Action::SetBlankPicture(source.clone()));
|
||||
until(&mut s, |s| !s.blank_busy);
|
||||
assert!(s.settings.blank_picture && s.blanked);
|
||||
let hash = s.blank_picture.as_ref().unwrap().info.sha256.clone();
|
||||
std::fs::remove_file(source.clone()).unwrap();
|
||||
s.execute(Action::SetBlankPicture(source));
|
||||
until(&mut s, |s| !s.blank_busy);
|
||||
assert_eq!(s.blank_picture.as_ref().unwrap().info.sha256, hash);
|
||||
assert!(s.blanked);
|
||||
let encoded = toml::to_string(&s.settings).unwrap();
|
||||
let decoded: deckstride::settings::Settings = toml::from_str(&encoded).unwrap();
|
||||
assert!(decoded.blank_picture);
|
||||
s.execute(Action::ClearBlankPicture);
|
||||
assert!(s.blanked && s.blank_picture.is_none() && !s.settings.blank_picture);
|
||||
assert!(!deckstride::settings::Settings::default().blank_picture);
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#[test]
|
||||
fn executable_identifies_its_actual_status() {
|
||||
let output = std::process::Command::new(env!("CARGO_BIN_EXE_pdf-presenter"))
|
||||
let output = std::process::Command::new(env!("CARGO_BIN_EXE_deckstride"))
|
||||
.arg("--help")
|
||||
.output()
|
||||
.unwrap();
|
||||
|
|
@ -0,0 +1,245 @@
|
|||
mod common;
|
||||
use deckstride::{
|
||||
cache::{self, Policy},
|
||||
document::Document,
|
||||
settings,
|
||||
studio::Studio,
|
||||
};
|
||||
use std::{
|
||||
fs::{self, File, FileTimes},
|
||||
path::{Path, PathBuf},
|
||||
time::{Duration, Instant, SystemTime},
|
||||
};
|
||||
fn entry(root: &Path, project: u8, page: u8, bytes: u64, age_days: u64) -> PathBuf {
|
||||
let dir = root
|
||||
.join(format!("{project:064x}"))
|
||||
.join(format!("{:064x}", 1));
|
||||
fs::create_dir_all(&dir).unwrap();
|
||||
let path = dir.join(format!("{page}-512-hayro09.rgba"));
|
||||
let f = File::create(&path).unwrap();
|
||||
f.set_len(bytes).unwrap();
|
||||
f.set_times(
|
||||
FileTimes::new().set_modified(SystemTime::now() - Duration::from_secs(age_days * 86400)),
|
||||
)
|
||||
.unwrap();
|
||||
path
|
||||
}
|
||||
#[test]
|
||||
fn expiration_and_quota_remove_oldest_and_protect_active_projects() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let root = temp.path();
|
||||
let old = entry(root, 1, 0, 1024, 40);
|
||||
let older = entry(root, 1, 1, 40 * 1024 * 1024, 3);
|
||||
let newer = entry(root, 2, 0, 40 * 1024 * 1024, 2);
|
||||
let protected = entry(root, 3, 0, 10 * 1024 * 1024, 40);
|
||||
let locked = entry(root, 4, 0, 1024, 40);
|
||||
let lease = cache::lease(root, &format!("{:064x}", 4)).unwrap();
|
||||
let policy = Policy {
|
||||
max_mib: 64,
|
||||
max_days: 30,
|
||||
};
|
||||
let r = cache::clean(
|
||||
root,
|
||||
&policy,
|
||||
&[format!("{:064x}", 3)],
|
||||
false,
|
||||
SystemTime::now(),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(r.removed_files, 2);
|
||||
assert!(!old.exists() && !older.exists());
|
||||
assert!(newer.exists() && protected.exists() && locked.exists());
|
||||
assert_eq!(r.remaining_bytes, 50 * 1024 * 1024 + 1024);
|
||||
assert_eq!(r.skipped_files, 2);
|
||||
drop(lease);
|
||||
let r = cache::clean(root, &policy, &[], true, SystemTime::now()).unwrap();
|
||||
assert_eq!(r.removed_files, 3);
|
||||
assert_eq!(r.remaining_bytes, 0);
|
||||
}
|
||||
#[test]
|
||||
fn unknown_files_symlinks_missing_roots_and_invalid_policies_are_safe() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let root = temp.path().join("cache");
|
||||
assert_eq!(
|
||||
cache::clean(&root, &Policy::default(), &[], true, SystemTime::now())
|
||||
.unwrap()
|
||||
.removed_files,
|
||||
0
|
||||
);
|
||||
let file = entry(&root, 1, 0, 3, 50);
|
||||
let unknown = file.with_file_name("notes.json");
|
||||
fs::write(&unknown, "private notes").unwrap();
|
||||
#[cfg(unix)]
|
||||
{
|
||||
std::os::unix::fs::symlink(&unknown, file.with_file_name("1-512-hayro09.rgba")).unwrap();
|
||||
std::os::unix::fs::symlink(file.parent().unwrap(), root.join(format!("{:064x}", 2)))
|
||||
.unwrap();
|
||||
}
|
||||
cache::clean(&root, &Policy::default(), &[], true, SystemTime::now()).unwrap();
|
||||
assert!(unknown.exists());
|
||||
assert!(!file.exists());
|
||||
assert!(
|
||||
Policy {
|
||||
max_mib: 0,
|
||||
max_days: 30
|
||||
}
|
||||
.validate()
|
||||
.is_err()
|
||||
);
|
||||
assert!(
|
||||
Policy {
|
||||
max_mib: 64,
|
||||
max_days: 0
|
||||
}
|
||||
.validate()
|
||||
.is_err()
|
||||
);
|
||||
assert!(
|
||||
Policy {
|
||||
max_mib: 1048577,
|
||||
max_days: 30
|
||||
}
|
||||
.validate()
|
||||
.is_err()
|
||||
);
|
||||
assert!(
|
||||
Policy {
|
||||
max_mib: 64,
|
||||
max_days: 3651
|
||||
}
|
||||
.validate()
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
#[test]
|
||||
fn settings_migrate_validate_and_round_trip() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let path = temp.path().join("settings.toml");
|
||||
fs::write(&path, "version = 1").unwrap();
|
||||
let mut s = settings::read(&path).unwrap();
|
||||
assert_eq!(s.disk_cache.max_mib, 10240);
|
||||
assert_eq!(s.disk_cache.max_days, 30);
|
||||
s.disk_cache = Policy {
|
||||
max_mib: 256,
|
||||
max_days: 7,
|
||||
};
|
||||
settings::write(&path, &s).unwrap();
|
||||
let s = settings::read(&path).unwrap();
|
||||
assert_eq!(s.disk_cache.max_mib, 256);
|
||||
assert_eq!(s.disk_cache.max_days, 7);
|
||||
fs::write(&path, "version=1\n[disk_cache]\nmax_days=0").unwrap();
|
||||
assert!(settings::read(&path).is_err());
|
||||
let example = Path::new(env!("CARGO_MANIFEST_DIR"))
|
||||
.join("../../docs/interfaces/examples/settings-v1.toml");
|
||||
settings::read(&example).unwrap();
|
||||
}
|
||||
#[test]
|
||||
fn manual_worker_cleanup_preserves_live_document_and_regenerates_after_expunging() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let images = temp.path().join("images");
|
||||
fs::create_dir(&images).unwrap();
|
||||
common::image(&images.join("1.png"), [20, 40, 60, 255]);
|
||||
let root = temp.path().join("cache");
|
||||
let doc = Document::open(&images, root.clone()).unwrap();
|
||||
let frame = doc.render(0, 512).unwrap();
|
||||
let mut studio = Studio::with_program(true, None, env!("CARGO_BIN_EXE_deckstride").into());
|
||||
studio.cache_path = root.clone();
|
||||
studio.initialized = true;
|
||||
let clean = |s: &mut Studio| {
|
||||
s.clean_cache(true);
|
||||
assert!(s.cache_busy);
|
||||
let deadline = Instant::now() + Duration::from_secs(10);
|
||||
while s.cache_busy {
|
||||
s.poll();
|
||||
assert!(Instant::now() < deadline, "{}", s.cache_status);
|
||||
std::thread::sleep(Duration::from_millis(5));
|
||||
}
|
||||
assert!(
|
||||
s.cache_status.starts_with("Disk cache:"),
|
||||
"{}",
|
||||
s.cache_status
|
||||
);
|
||||
};
|
||||
clean(&mut studio);
|
||||
assert!(frame.info.path.exists());
|
||||
drop(doc);
|
||||
clean(&mut studio);
|
||||
assert!(!frame.info.path.exists());
|
||||
let doc = Document::open(&images, root).unwrap();
|
||||
assert_eq!(frame.rgba, doc.render(0, 512).unwrap().rgba);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn startup_cleanup_runs_once_and_manual_errors_are_reported() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let root = temp.path().join("cache");
|
||||
let expired = entry(&root, 1, 0, 30, 40);
|
||||
let fresh = entry(&root, 1, 1, 30, 0);
|
||||
let mut s = Studio::with_program(true, None, env!("CARGO_BIN_EXE_deckstride").into());
|
||||
s.cache_path = root;
|
||||
s.initialized = true;
|
||||
let deadline = Instant::now() + Duration::from_secs(10);
|
||||
while !s.cache_status.starts_with("Disk cache:") {
|
||||
s.poll();
|
||||
assert!(Instant::now() < deadline, "{}", s.cache_status);
|
||||
std::thread::sleep(Duration::from_millis(10));
|
||||
}
|
||||
assert!(!expired.exists());
|
||||
assert!(fresh.exists());
|
||||
// Neither changing policy nor subsequent polling rearms automatic cleanup.
|
||||
let later = entry(&s.cache_path, 1, 2, 30, 40);
|
||||
s.remember_cache_policy();
|
||||
for _ in 0..20 {
|
||||
s.poll();
|
||||
assert!(!s.cache_busy);
|
||||
}
|
||||
assert!(later.exists());
|
||||
s.cache_path = fresh;
|
||||
s.clean_cache(true);
|
||||
while s.cache_busy {
|
||||
s.poll();
|
||||
assert!(Instant::now() < deadline);
|
||||
std::thread::sleep(Duration::from_millis(10));
|
||||
}
|
||||
assert!(
|
||||
s.cache_status.contains("not a regular directory"),
|
||||
"{}",
|
||||
s.cache_status
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn startup_cleanup_waits_for_initial_deck_preparation() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let images = temp.path().join("images");
|
||||
fs::create_dir(&images).unwrap();
|
||||
for i in 0..8 {
|
||||
common::image(&images.join(format!("{i}.png")), [20, 40, 60, 255]);
|
||||
}
|
||||
let root = temp.path().join("cache");
|
||||
let expired = entry(&root, 1, 0, 30, 40);
|
||||
let mut s = Studio::with_program(true, Some(images), env!("CARGO_BIN_EXE_deckstride").into());
|
||||
s.cache_path = root;
|
||||
s.poll();
|
||||
assert!(!s.cache_busy, "Initial open must precede cleanup");
|
||||
assert!(expired.exists());
|
||||
let deadline = Instant::now() + Duration::from_secs(15);
|
||||
while !s.cache_status.starts_with("Disk cache:") {
|
||||
s.poll();
|
||||
if s.cache_busy {
|
||||
assert!(!s.loading && !s.notes_loading);
|
||||
assert_eq!(s.count(), 8);
|
||||
assert_eq!(s.prepared.len(), s.count());
|
||||
// No output acknowledgment is needed for disk preparation completion.
|
||||
assert_eq!(s.output_buffered, 0);
|
||||
}
|
||||
assert!(
|
||||
Instant::now() < deadline,
|
||||
"{} / {}",
|
||||
s.status,
|
||||
s.cache_status
|
||||
);
|
||||
std::thread::sleep(Duration::from_millis(5));
|
||||
}
|
||||
assert!(!expired.exists());
|
||||
}
|
||||
|
|
@ -1,11 +1,11 @@
|
|||
use pdf_presenter::{
|
||||
use deckstride::{
|
||||
studio::{Action, Studio},
|
||||
worker::{Completion, Job, Reply, Request, ResultPacket},
|
||||
};
|
||||
use std::sync::mpsc::{self, Receiver, SyncSender};
|
||||
|
||||
fn controlled_chooser() -> (Studio, Receiver<Job>, SyncSender<Completion>) {
|
||||
let mut studio = Studio::with_program(true, None, env!("CARGO_BIN_EXE_pdf-presenter").into());
|
||||
let mut studio = Studio::with_program(true, None, env!("CARGO_BIN_EXE_deckstride").into());
|
||||
let (requests, jobs) = mpsc::sync_channel(4);
|
||||
let (results, replies) = mpsc::sync_channel(4);
|
||||
// Replace only the chooser transport: no native dialog or renderer is opened.
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
mod common;
|
||||
use pdf_presenter::{
|
||||
use deckstride::{
|
||||
document::{Document, natural_cmp, read_frame, validate_frame},
|
||||
settings,
|
||||
};
|
||||
|
|
@ -5,8 +5,9 @@ use std::{
|
|||
};
|
||||
|
||||
fn run_native(args: &[&str]) -> Output {
|
||||
let mut child = Command::new(env!("CARGO_BIN_EXE_pdf-presenter"))
|
||||
let mut child = Command::new(env!("CARGO_BIN_EXE_deckstride"))
|
||||
.args(args)
|
||||
.stdin(Stdio::null())
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.spawn()
|
||||
|
|
@ -30,10 +31,8 @@ fn run_native(args: &[&str]) -> Output {
|
|||
|
||||
#[test]
|
||||
fn native_windows_smoke_when_requested() {
|
||||
if std::env::var_os("PDF_PRESENTER_GUI_TESTS").is_none() {
|
||||
eprintln!(
|
||||
"Native smoke not requested; set PDF_PRESENTER_GUI_TESTS=1 with a display server."
|
||||
);
|
||||
if std::env::var_os("DECKSTRIDE_GUI_TESTS").is_none() {
|
||||
eprintln!("Native smoke not requested; set DECKSTRIDE_GUI_TESTS=1 with a display server.");
|
||||
return;
|
||||
}
|
||||
let listed = run_native(&["--list-monitors"]);
|
||||
|
|
@ -64,7 +63,7 @@ fn native_windows_smoke_when_requested() {
|
|||
|
||||
#[test]
|
||||
fn invalid_cli_fails_cleanly() {
|
||||
let result = Command::new(env!("CARGO_BIN_EXE_pdf-presenter"))
|
||||
let result = Command::new(env!("CARGO_BIN_EXE_deckstride"))
|
||||
.arg("--bad-option")
|
||||
.output()
|
||||
.unwrap();
|
||||
|
|
@ -74,10 +73,10 @@ fn invalid_cli_fails_cleanly() {
|
|||
|
||||
#[test]
|
||||
fn independent_output_acknowledges_frames_and_blanking() {
|
||||
if std::env::var_os("PDF_PRESENTER_GUI_TESTS").is_none() {
|
||||
if std::env::var_os("DECKSTRIDE_GUI_TESTS").is_none() {
|
||||
return;
|
||||
}
|
||||
use pdf_presenter::{
|
||||
use deckstride::{
|
||||
document::Document,
|
||||
output::{Ack, HostState},
|
||||
worker::{read_json, write_json},
|
||||
|
|
@ -108,6 +107,11 @@ fn independent_output_acknowledges_frames_and_blanking() {
|
|||
}
|
||||
let doc = Document::open(temp.path(), temp.path().join("cache")).unwrap();
|
||||
let frames: Vec<_> = (0..8).map(|page| doc.render(page, 320).unwrap()).collect();
|
||||
let blank_picture = deckstride::blank::prepare(
|
||||
Some(&temp.path().join("slide0.png")),
|
||||
&temp.path().join("blank-picture.rgba"),
|
||||
)
|
||||
.unwrap();
|
||||
struct ChildGuard(std::process::Child);
|
||||
impl Drop for ChildGuard {
|
||||
fn drop(&mut self) {
|
||||
|
|
@ -116,7 +120,7 @@ fn independent_output_acknowledges_frames_and_blanking() {
|
|||
}
|
||||
}
|
||||
let mut child = ChildGuard(
|
||||
Command::new(env!("CARGO_BIN_EXE_pdf-presenter"))
|
||||
Command::new(env!("CARGO_BIN_EXE_deckstride"))
|
||||
.arg("--presentation-host")
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
|
|
@ -203,6 +207,16 @@ fn independent_output_acknowledges_frames_and_blanking() {
|
|||
write_json(
|
||||
&mut input,
|
||||
&HostState {
|
||||
zoom: deckstride::zoom::Sync {
|
||||
enabled: true,
|
||||
view: deckstride::zoom::View {
|
||||
scale: 2.,
|
||||
center: [0.5; 2],
|
||||
},
|
||||
epoch: sequence * 2,
|
||||
serial: 0,
|
||||
keep_fitted_area: false,
|
||||
},
|
||||
sequence,
|
||||
page,
|
||||
generation: 99,
|
||||
|
|
@ -212,6 +226,7 @@ fn independent_output_acknowledges_frames_and_blanking() {
|
|||
monitors: vec![monitor.clone()],
|
||||
fullscreen: false,
|
||||
blanked,
|
||||
blank_picture: Some(blank_picture.info.clone()),
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
|
|
@ -225,6 +240,42 @@ fn independent_output_acknowledges_frames_and_blanking() {
|
|||
break;
|
||||
}
|
||||
}
|
||||
// Zoom-only commands carry no frame, preload, routes or visibility fields.
|
||||
// They must retain every buffered frame after all source/cache files are gone.
|
||||
write_json(
|
||||
&mut input,
|
||||
&HostState {
|
||||
zoom_only: true,
|
||||
generation: 99,
|
||||
page,
|
||||
zoom: deckstride::zoom::Sync {
|
||||
enabled: true,
|
||||
view: deckstride::zoom::View {
|
||||
scale: 4.,
|
||||
center: [0.4, 0.6],
|
||||
},
|
||||
epoch: sequence * 2 + 1,
|
||||
serial: 0,
|
||||
keep_fitted_area: false,
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
)
|
||||
.unwrap();
|
||||
let deadline = Instant::now() + Duration::from_secs(5);
|
||||
loop {
|
||||
let ack = rx
|
||||
.recv_timeout(deadline.saturating_duration_since(Instant::now()))
|
||||
.expect("zoom retained buffer deadline");
|
||||
assert!(ack.status.is_empty(), "{}", ack.status);
|
||||
if ack.sequence == sequence
|
||||
&& ack.generation == 99
|
||||
&& ack.buffered == 8
|
||||
&& ack.page == (!blanked).then_some(page)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
write_json(
|
||||
&mut input,
|
||||
|
|
@ -244,10 +295,10 @@ fn independent_output_acknowledges_frames_and_blanking() {
|
|||
#[cfg(target_os = "linux")]
|
||||
#[test]
|
||||
fn orphaned_output_holds_until_closed_then_exits_on_close_or_escape() {
|
||||
if std::env::var_os("PDF_PRESENTER_GUI_TESTS").is_none() {
|
||||
if std::env::var_os("DECKSTRIDE_GUI_TESTS").is_none() {
|
||||
return;
|
||||
}
|
||||
use pdf_presenter::{output::HostState, worker::write_json};
|
||||
use deckstride::{output::HostState, worker::write_json};
|
||||
use x11_dl::xlib;
|
||||
let x = xlib::Xlib::open().unwrap();
|
||||
// A private X11 connection is used only by this test thread.
|
||||
|
|
@ -371,7 +422,7 @@ fn orphaned_output_holds_until_closed_then_exits_on_close_or_escape() {
|
|||
}
|
||||
}
|
||||
let mut child = ChildGuard(
|
||||
Command::new(env!("CARGO_BIN_EXE_pdf-presenter"))
|
||||
Command::new(env!("CARGO_BIN_EXE_deckstride"))
|
||||
.env("WINIT_UNIX_BACKEND", "x11")
|
||||
.arg("--presentation-host")
|
||||
.stdin(Stdio::piped())
|
||||
|
|
@ -482,13 +533,13 @@ fn orphaned_output_holds_until_closed_then_exits_on_close_or_escape() {
|
|||
#[cfg(target_os = "linux")]
|
||||
#[test]
|
||||
fn wayland_browser_parents_to_presenter_before_first_buffer() {
|
||||
if std::env::var_os("PDF_PRESENTER_GUI_TESTS").is_none()
|
||||
if std::env::var_os("DECKSTRIDE_GUI_TESTS").is_none()
|
||||
|| std::env::var_os("WAYLAND_DISPLAY").is_none()
|
||||
{
|
||||
return;
|
||||
}
|
||||
let trace = tempfile::NamedTempFile::new().unwrap();
|
||||
let mut child = Command::new(env!("CARGO_BIN_EXE_pdf-presenter"))
|
||||
let mut child = Command::new(env!("CARGO_BIN_EXE_deckstride"))
|
||||
.arg("--smoke-test")
|
||||
.env("WAYLAND_DEBUG", "client")
|
||||
.stdout(Stdio::null())
|
||||
|
|
@ -524,8 +575,8 @@ fn wayland_browser_parents_to_presenter_before_first_buffer() {
|
|||
.next()
|
||||
.unwrap()
|
||||
};
|
||||
let presenter = top("PDF Presenter — Presenter");
|
||||
let browser = top("PDF Presenter — All slides");
|
||||
let presenter = top("Deckstride — Presenter");
|
||||
let browser = top("Deckstride — All slides");
|
||||
assert_ne!(browser, presenter);
|
||||
let parent_at = log
|
||||
.find(&format!("{browser}.set_parent({presenter})"))
|
||||
|
|
@ -562,3 +613,22 @@ fn wayland_browser_parents_to_presenter_before_first_buffer() {
|
|||
"Only the browser is parented"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(not(any(target_os = "linux", target_os = "windows", target_os = "macos")))]
|
||||
fn unsupported_sleep_backend_reports_unavailable_and_exits_on_parent_eof() {
|
||||
let output = run_native(&["--keep-awake"]);
|
||||
assert!(output.status.success());
|
||||
let status: String = deckstride::worker::read_json(&mut output.stdout.as_slice()).unwrap();
|
||||
assert!(status.starts_with("Sleep protection unavailable:"));
|
||||
assert!(status.contains(std::env::consts::OS));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn keep_awake_status_uses_private_length_prefixed_json() {
|
||||
let mut framed = Vec::new();
|
||||
deckstride::worker::write_json(&mut framed, &"Sleep protection test").unwrap();
|
||||
assert!(serde_json::from_slice::<String>(&framed).is_err());
|
||||
let decoded: String = deckstride::worker::read_json(&mut framed.as_slice()).unwrap();
|
||||
assert_eq!(decoded, "Sleep protection test");
|
||||
}
|
||||
|
|
@ -0,0 +1,438 @@
|
|||
mod common;
|
||||
use deckstride::{
|
||||
document::Document,
|
||||
notes,
|
||||
studio::{Action, Studio},
|
||||
};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
#[test]
|
||||
fn pdf_sidecar_precedence_creation_all_pages_and_source_preservation() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let source = temp.path().join("presentation.X.pdf");
|
||||
let cache = temp.path().join("cache");
|
||||
common::pdf(&source);
|
||||
let original = std::fs::read(&source).unwrap();
|
||||
let doc = Document::open(&source, cache.clone()).unwrap();
|
||||
assert_eq!(doc.info.notes, vec!["Speaker note\n", ""]);
|
||||
let snapshot = notes::prepare(&source, cache.clone(), &doc.info.sha256).unwrap();
|
||||
assert_eq!(snapshot.path, temp.path().join("presentation.X.notes.toml"));
|
||||
let file: toml::Value =
|
||||
toml::from_str(&std::fs::read_to_string(&snapshot.path).unwrap()).unwrap();
|
||||
assert_eq!(file["version"].as_integer(), Some(1));
|
||||
assert_eq!(file["notes"]["1"].as_str(), Some("Speaker note\n"));
|
||||
assert_eq!(file["notes"]["2"].as_str(), Some(""));
|
||||
let saved = notes::save(
|
||||
&source,
|
||||
cache.clone(),
|
||||
&doc.info.sha256,
|
||||
&snapshot.revision,
|
||||
1,
|
||||
"Second\n\"quoted\" é漢字".into(),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(saved.notes[0], "Speaker note\n");
|
||||
let saved = notes::save(
|
||||
&source,
|
||||
cache.clone(),
|
||||
&doc.info.sha256,
|
||||
&saved.revision,
|
||||
0,
|
||||
String::new(),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
Document::open(&source, cache.clone()).unwrap().info.notes,
|
||||
saved.notes
|
||||
);
|
||||
assert_eq!(saved.notes[0], ""); // An explicit empty note hides the PDF annotation.
|
||||
std::fs::write(&snapshot.path, "version=1\n[notes]\n\"2\"='Override'").unwrap();
|
||||
let reopened = Document::open(&source, cache).unwrap();
|
||||
assert_eq!(reopened.info.notes, vec!["Speaker note\n", "Override"]);
|
||||
assert_eq!(original, std::fs::read(&source).unwrap());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn editor_refuses_conflicts_invalid_sidecars_and_changed_sources() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let source = temp.path().join("talk.pdf");
|
||||
let cache = temp.path().join("cache");
|
||||
common::pdf(&source);
|
||||
let sha = Document::open(&source, cache.clone()).unwrap().info.sha256;
|
||||
let snapshot = notes::prepare(&source, cache.clone(), &sha).unwrap();
|
||||
let external = "version=1\n[notes]\n\"1\"='External edit'\n\"99\"='Keep unknown page'";
|
||||
std::fs::write(&snapshot.path, external).unwrap();
|
||||
assert!(
|
||||
notes::save(
|
||||
&source,
|
||||
cache.clone(),
|
||||
&sha,
|
||||
&snapshot.revision,
|
||||
0,
|
||||
"Old edit".into()
|
||||
)
|
||||
.unwrap_err()
|
||||
.contains("changed on disk")
|
||||
);
|
||||
assert_eq!(std::fs::read_to_string(&snapshot.path).unwrap(), external);
|
||||
let fresh = notes::prepare(&source, cache.clone(), &sha).unwrap();
|
||||
notes::save(
|
||||
&source,
|
||||
cache.clone(),
|
||||
&sha,
|
||||
&fresh.revision,
|
||||
1,
|
||||
"New".into(),
|
||||
)
|
||||
.unwrap();
|
||||
assert!(
|
||||
std::fs::read_to_string(&snapshot.path)
|
||||
.unwrap()
|
||||
.contains("Keep unknown page")
|
||||
);
|
||||
for bad in [
|
||||
"not toml ]",
|
||||
"version=2\n[notes]",
|
||||
"version=1\nextra=true\n[notes]",
|
||||
] {
|
||||
std::fs::write(&snapshot.path, bad).unwrap();
|
||||
let doc = Document::open(&source, cache.clone()).unwrap();
|
||||
assert_eq!(doc.info.notes[0], "Speaker note\n");
|
||||
assert!(!doc.info.warnings.is_empty());
|
||||
assert!(notes::prepare(&source, cache.clone(), &sha).is_err());
|
||||
assert_eq!(std::fs::read_to_string(&snapshot.path).unwrap(), bad);
|
||||
}
|
||||
std::fs::remove_file(&snapshot.path).unwrap();
|
||||
assert!(
|
||||
notes::save(
|
||||
&source,
|
||||
cache.clone(),
|
||||
&sha,
|
||||
&fresh.revision,
|
||||
0,
|
||||
"No file".into()
|
||||
)
|
||||
.is_err()
|
||||
);
|
||||
assert!(notes::prepare(&source, cache.clone(), "wrong source SHA").is_err());
|
||||
let fresh = notes::prepare(&source, cache.clone(), &sha).unwrap();
|
||||
assert!(
|
||||
notes::save(
|
||||
&source,
|
||||
cache.clone(),
|
||||
&sha,
|
||||
&fresh.revision,
|
||||
7,
|
||||
"No slide".into()
|
||||
)
|
||||
.is_err()
|
||||
);
|
||||
assert!(
|
||||
notes::save(
|
||||
&source,
|
||||
cache,
|
||||
&sha,
|
||||
&fresh.revision,
|
||||
0,
|
||||
"x".repeat(notes::MAX_NOTE + 1)
|
||||
)
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn image_folder_sidecar_uses_filenames_and_keeps_original_notes() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let source = temp.path().join("Images");
|
||||
std::fs::create_dir(&source).unwrap();
|
||||
common::image(&source.join("slide2.png"), [0, 0, 0, 255]);
|
||||
common::image(&source.join("slide10.png"), [0, 0, 0, 255]);
|
||||
std::fs::write(source.join("slide2.txt"), "Original").unwrap();
|
||||
std::fs::write(source.join("notes.toml"), "\"slide10.png\"='Global'").unwrap();
|
||||
let cache = temp.path().join("cache");
|
||||
let sha = Document::open(&source, cache.clone()).unwrap().info.sha256;
|
||||
let snapshot = notes::prepare(&source, cache.clone(), &sha).unwrap();
|
||||
assert_eq!(snapshot.path, temp.path().join("Images.notes.toml"));
|
||||
let saved = notes::save(
|
||||
&source,
|
||||
cache.clone(),
|
||||
&sha,
|
||||
&snapshot.revision,
|
||||
0,
|
||||
"Edited".into(),
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(saved.notes, vec!["Edited", "Global"]);
|
||||
assert_eq!(
|
||||
Document::open(&source, cache).unwrap().info.notes,
|
||||
saved.notes
|
||||
);
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(source.join("slide2.txt")).unwrap(),
|
||||
"Original"
|
||||
);
|
||||
}
|
||||
|
||||
#[cfg(unix)]
|
||||
#[test]
|
||||
fn symlink_sidecars_are_never_overwritten() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let source = temp.path().join("talk.pdf");
|
||||
common::pdf(&source);
|
||||
let cache = temp.path().join("cache");
|
||||
let sha = Document::open(&source, cache.clone()).unwrap().info.sha256;
|
||||
let target = temp.path().join("external");
|
||||
std::fs::write(&target, "untouched").unwrap();
|
||||
std::os::unix::fs::symlink(&target, notes::sidecar_path(&source)).unwrap();
|
||||
assert!(notes::prepare(&source, cache, &sha).is_err());
|
||||
assert_eq!(std::fs::read_to_string(target).unwrap(), "untouched");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn editor_worker_saves_captured_page_and_keeps_draft_after_conflict() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let source = temp.path().join("talk.pdf");
|
||||
common::pdf(&source);
|
||||
let cache = temp.path().join("cache");
|
||||
let info = Document::open(&source, cache.clone()).unwrap().info;
|
||||
let mut s = Studio::with_program(true, None, env!("CARGO_BIN_EXE_deckstride").into());
|
||||
s.cache_path = cache;
|
||||
s.deck = Some(info);
|
||||
s.initialized = true;
|
||||
s.requested = 1;
|
||||
s.execute(Action::EditNotes);
|
||||
fn finish(s: &mut Studio) {
|
||||
let deadline = Instant::now() + Duration::from_secs(10);
|
||||
while s.notes_editor.as_ref().unwrap().busy {
|
||||
s.poll();
|
||||
assert!(Instant::now() < deadline, "notes editor stalled");
|
||||
std::thread::sleep(Duration::from_millis(2));
|
||||
}
|
||||
}
|
||||
finish(&mut s);
|
||||
assert!(s.notes_editor.as_ref().unwrap().error.is_none());
|
||||
s.notes_editor.as_mut().unwrap().text = "Edited second slide".into();
|
||||
s.execute(Action::EditNotes); // Double-click again must not discard drafts.
|
||||
assert_eq!(s.notes_editor.as_ref().unwrap().text, "Edited second slide");
|
||||
s.execute(Action::Open(source.clone()));
|
||||
assert!(s.status.contains("Close the notes editor"));
|
||||
s.requested = 0; // Editor remains bound to the slide captured when it opened.
|
||||
s.execute(Action::SaveNotes);
|
||||
finish(&mut s);
|
||||
assert_eq!(s.deck.as_ref().unwrap().notes[1], "Edited second slide");
|
||||
assert_eq!(s.deck.as_ref().unwrap().notes[0], "Speaker note\n");
|
||||
let file = s
|
||||
.notes_editor
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.snapshot
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.path
|
||||
.clone();
|
||||
std::fs::write(&file, "version=1\n[notes]\n\"2\"='External'").unwrap();
|
||||
s.notes_editor.as_mut().unwrap().text = "My unsaved draft".into();
|
||||
s.execute(Action::SaveNotes);
|
||||
finish(&mut s);
|
||||
assert!(s.notes_editor.as_ref().unwrap().error.is_some());
|
||||
assert_eq!(s.notes_editor.as_ref().unwrap().text, "My unsaved draft");
|
||||
s.execute(Action::ReloadNotes);
|
||||
finish(&mut s);
|
||||
assert_eq!(s.notes_editor.as_ref().unwrap().text, "External");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn partial_sidecar_cannot_exceed_combined_notes_limit_with_fallback_text() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let source = temp.path().join("Slides");
|
||||
std::fs::create_dir(&source).unwrap();
|
||||
let text = "x".repeat(notes::MAX_NOTE);
|
||||
for page in 1..=33 {
|
||||
common::image(&source.join(format!("slide{page}.png")), [0, 0, 0, 255]);
|
||||
if page <= 32 {
|
||||
std::fs::write(source.join(format!("slide{page}.txt")), &text).unwrap();
|
||||
}
|
||||
}
|
||||
let cache = temp.path().join("cache");
|
||||
let sha = Document::open(&source, cache.clone()).unwrap().info.sha256;
|
||||
let sidecar = notes::sidecar_path(&source);
|
||||
let empty = "version=1\n[notes]\n";
|
||||
std::fs::write(&sidecar, empty).unwrap();
|
||||
let snapshot = notes::prepare(&source, cache.clone(), &sha).unwrap();
|
||||
assert!(
|
||||
notes::save(
|
||||
&source,
|
||||
cache.clone(),
|
||||
&sha,
|
||||
&snapshot.revision,
|
||||
32,
|
||||
"x".into()
|
||||
)
|
||||
.unwrap_err()
|
||||
.contains("Combined notes")
|
||||
);
|
||||
assert_eq!(std::fs::read_to_string(&sidecar).unwrap(), empty);
|
||||
std::fs::write(&sidecar, "version=1\n[notes]\n\"slide33.png\"='x'").unwrap();
|
||||
assert!(
|
||||
notes::prepare(&source, cache, &sha)
|
||||
.unwrap_err()
|
||||
.contains("Combined notes")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn text_and_markdown_import_sections_and_limits() {
|
||||
assert_eq!(
|
||||
notes::parse_import("\u{feff}First\r\n ------- \r\nSecond\n--\n--\n", false).unwrap(),
|
||||
vec!["First", "Second", "", ""]
|
||||
);
|
||||
assert_eq!(
|
||||
notes::parse_import("one\n-\ninline -- text", false).unwrap(),
|
||||
vec!["one\n-\ninline -- text"]
|
||||
);
|
||||
assert_eq!(notes::parse_import("\n# Opening\nHello é漢字\n\n## Keep this heading\n```md\n# Not a slide\n```\n# Next\n~~~\n# Also code\n~~~\n# Empty\n", true).unwrap(), vec!["Hello é漢字\n\n## Keep this heading\n```md\n# Not a slide\n```", "~~~\n# Also code\n~~~", ""]);
|
||||
assert!(notes::parse_import("No headings", true).is_err());
|
||||
assert!(notes::parse_import("Lost preamble\n# Title\nNote", true).is_err());
|
||||
assert!(notes::parse_import(&"x".repeat(notes::MAX_NOTE + 1), false).is_err());
|
||||
assert!(notes::parse_import(&"x".repeat(8 * 1024 * 1024 + 1), false).is_err());
|
||||
assert!(notes::parse_import(&"--\n".repeat(10000), false).is_err());
|
||||
assert!(notes::is_import(std::path::Path::new("NOTES.MD")));
|
||||
assert!(!notes::is_import(std::path::Path::new("talk.pdf")));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn import_preview_is_read_only_and_apply_preserves_remaining_and_unknown_notes() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let source = temp.path().join("talk.pdf");
|
||||
common::pdf(&source);
|
||||
let original = std::fs::read(&source).unwrap();
|
||||
let cache = temp.path().join("cache");
|
||||
let sha = Document::open(&source, cache.clone()).unwrap().info.sha256;
|
||||
let input = temp.path().join("speaker.TXT");
|
||||
std::fs::write(&input, "Imported é\n-------\nSecond").unwrap();
|
||||
let preview = notes::preview_import(&source, cache.clone(), &sha, &input).unwrap();
|
||||
assert!(!preview.path.exists());
|
||||
let result = notes::apply_import(&source, cache.clone(), &sha, preview).unwrap();
|
||||
assert_eq!(result.notes, vec!["Imported é", "Second"]);
|
||||
std::fs::write(
|
||||
&result.path,
|
||||
"version=1\n[notes]\n'1'='Old'\n'2'='Keep'\n'99'='Unknown'",
|
||||
)
|
||||
.unwrap();
|
||||
std::fs::write(&input, "First only").unwrap();
|
||||
let preview = notes::preview_import(&source, cache.clone(), &sha, &input).unwrap();
|
||||
let saved = notes::apply_import(&source, cache.clone(), &sha, preview).unwrap();
|
||||
assert_eq!(saved.notes, vec!["First only", "Keep"]);
|
||||
assert!(
|
||||
std::fs::read_to_string(&result.path)
|
||||
.unwrap()
|
||||
.contains("Unknown")
|
||||
);
|
||||
assert_eq!(
|
||||
Document::open(&source, cache).unwrap().info.notes,
|
||||
saved.notes
|
||||
);
|
||||
assert_eq!(std::fs::read(source).unwrap(), original);
|
||||
assert_eq!(std::fs::read_to_string(input).unwrap(), "First only");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn import_errors_and_conflicts_leave_files_untouched() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let source = temp.path().join("talk.pdf");
|
||||
common::pdf(&source);
|
||||
let cache = temp.path().join("cache");
|
||||
let sha = Document::open(&source, cache.clone()).unwrap().info.sha256;
|
||||
let input = temp.path().join("notes.md");
|
||||
std::fs::write(&input, "# One\nFirst\n# Two\nSecond\n# Three\nExtra").unwrap();
|
||||
assert!(notes::preview_import(&source, cache.clone(), &sha, &input).is_err());
|
||||
assert!(!notes::sidecar_path(&source).exists());
|
||||
std::fs::write(&input, [0xff, 0xfe]).unwrap();
|
||||
assert!(notes::preview_import(&source, cache.clone(), &sha, &input).is_err());
|
||||
std::fs::write(&input, "# One\nFirst").unwrap();
|
||||
let preview = notes::preview_import(&source, cache.clone(), &sha, &input).unwrap();
|
||||
let external = "version=1\n[notes]\n'1'='External'";
|
||||
std::fs::write(&preview.path, external).unwrap();
|
||||
assert!(notes::apply_import(&source, cache.clone(), &sha, preview).is_err());
|
||||
let preview = notes::preview_import(&source, cache.clone(), &sha, &input).unwrap();
|
||||
std::fs::remove_file(&preview.path).unwrap();
|
||||
assert!(notes::apply_import(&source, cache.clone(), &sha, preview).is_err());
|
||||
assert!(!notes::sidecar_path(&source).exists());
|
||||
std::fs::write(notes::sidecar_path(&source), "invalid TOML").unwrap();
|
||||
assert!(notes::preview_import(&source, cache, &sha, &input).is_err());
|
||||
assert_eq!(
|
||||
std::fs::read_to_string(notes::sidecar_path(&source)).unwrap(),
|
||||
"invalid TOML"
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn folder_import_uses_natural_slide_order() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let source = temp.path().join("Slides");
|
||||
std::fs::create_dir(&source).unwrap();
|
||||
common::image(&source.join("slide10.png"), [0, 0, 0, 255]);
|
||||
common::image(&source.join("slide2.png"), [0, 0, 0, 255]);
|
||||
let cache = temp.path().join("cache");
|
||||
let sha = Document::open(&source, cache.clone()).unwrap().info.sha256;
|
||||
let input = temp.path().join("notes.md");
|
||||
std::fs::write(&input, "# Title is not a filename\nFirst\n# Slide\nSecond").unwrap();
|
||||
let preview = notes::preview_import(&source, cache.clone(), &sha, &input).unwrap();
|
||||
let saved = notes::apply_import(&source, cache, &sha, preview).unwrap();
|
||||
let file: toml::Value = toml::from_str(&std::fs::read_to_string(saved.path).unwrap()).unwrap();
|
||||
assert_eq!(file["notes"]["slide2.png"].as_str(), Some("First"));
|
||||
assert_eq!(file["notes"]["slide10.png"].as_str(), Some("Second"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn worker_import_review_save_and_failure_keep_presentation_running() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let source = temp.path().join("talk.pdf");
|
||||
common::pdf(&source);
|
||||
let cache = temp.path().join("cache");
|
||||
let info = Document::open(&source, cache.clone()).unwrap().info;
|
||||
let input = temp.path().join("notes.txt");
|
||||
std::fs::write(&input, "Imported").unwrap();
|
||||
let mut s = Studio::with_program(true, None, env!("CARGO_BIN_EXE_deckstride").into());
|
||||
s.cache_path = cache;
|
||||
s.initialized = true;
|
||||
s.execute(Action::ImportNotes(input.clone()));
|
||||
assert!(s.status.contains("Open a presentation"));
|
||||
s.deck = Some(info);
|
||||
s.blanked = false;
|
||||
s.execute(Action::ImportNotes(input.clone()));
|
||||
s.execute(Action::Exit);
|
||||
assert!(!s.close_requested);
|
||||
s.execute(Action::EditNotes);
|
||||
assert!(s.notes_editor.is_none());
|
||||
fn finish(s: &mut Studio) {
|
||||
let deadline = Instant::now() + Duration::from_secs(10);
|
||||
while s.notes_import.as_ref().is_some_and(|i| i.busy) {
|
||||
s.poll();
|
||||
assert!(Instant::now() < deadline, "notes import stalled");
|
||||
std::thread::sleep(Duration::from_millis(2));
|
||||
}
|
||||
}
|
||||
finish(&mut s);
|
||||
assert!(s.notes_import.as_ref().unwrap().error.is_none());
|
||||
assert!(!notes::sidecar_path(&source).exists());
|
||||
s.execute(Action::Open(source.clone()));
|
||||
assert!(!s.loading);
|
||||
s.execute(Action::ApplyNotesImport);
|
||||
finish(&mut s);
|
||||
assert!(s.notes_import.is_none());
|
||||
assert_eq!(s.deck.as_ref().unwrap().notes[0], "Imported");
|
||||
assert!(!s.blanked);
|
||||
s.execute(Action::ImportNotes(input));
|
||||
finish(&mut s);
|
||||
std::fs::write(
|
||||
notes::sidecar_path(&source),
|
||||
"version=1\n[notes]\n'1'='External'",
|
||||
)
|
||||
.unwrap();
|
||||
s.execute(Action::ApplyNotesImport);
|
||||
finish(&mut s);
|
||||
assert!(s.notes_import.as_ref().unwrap().error.is_some());
|
||||
assert_eq!(s.deck.as_ref().unwrap().notes[0], "Imported");
|
||||
assert!(!s.blanked);
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
use pdf_presenter::{
|
||||
use deckstride::{
|
||||
paint,
|
||||
poc::{Action, Display, Model, Options, SLIDES, window_rect},
|
||||
};
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
mod common;
|
||||
use pdf_presenter::studio::{Action, Monitor, Studio};
|
||||
use deckstride::studio::{Action, Monitor, Studio};
|
||||
use std::{
|
||||
path::{Path, PathBuf},
|
||||
time::{Duration, Instant},
|
||||
|
|
@ -8,7 +8,7 @@ fn studio(path: &Path, cache: &Path) -> Studio {
|
|||
let mut s = Studio::with_program(
|
||||
true,
|
||||
Some(path.to_owned()),
|
||||
env!("CARGO_BIN_EXE_pdf-presenter").into(),
|
||||
env!("CARGO_BIN_EXE_deckstride").into(),
|
||||
);
|
||||
s.cache_path = cache.to_owned();
|
||||
s.set_monitors(
|
||||
|
|
@ -273,11 +273,10 @@ fn rolling_buffer_finishes_processing_and_reloads_evicted_slides_without_churn()
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "manual stress test: set PDF_PRESENTER_STRESS_PDF to an authorized local PDF"]
|
||||
#[ignore = "manual stress test: set DECKSTRIDE_STRESS_PDF to an authorized local PDF"]
|
||||
fn real_pdf_exceeds_budget_and_keeps_navigating() {
|
||||
let path = PathBuf::from(
|
||||
std::env::var_os("PDF_PRESENTER_STRESS_PDF").expect("PDF_PRESENTER_STRESS_PDF"),
|
||||
);
|
||||
let path =
|
||||
PathBuf::from(std::env::var_os("DECKSTRIDE_STRESS_PDF").expect("DECKSTRIDE_STRESS_PDF"));
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let mut s = studio(&path, &temp.path().join("cache"));
|
||||
s.monitors[0].size = (1920, 1080);
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
use pdf_presenter::Presentation;
|
||||
use deckstride::Presentation;
|
||||
use std::num::NonZeroUsize;
|
||||
|
||||
#[test]
|
||||
|
|
@ -0,0 +1,432 @@
|
|||
use deckstride::settings::{self, Layout, Routes, Settings};
|
||||
|
||||
#[test]
|
||||
fn every_interface_language_round_trips_through_settings_v1() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
for language in deckstride::localization::Language::ALL {
|
||||
let path = temp.path().join(format!("{language:?}.toml"));
|
||||
let settings = Settings {
|
||||
language,
|
||||
..Default::default()
|
||||
};
|
||||
settings::write(&path, &settings).unwrap();
|
||||
assert_eq!(settings::read(&path).unwrap().language, language);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn settings_roundtrip_preserves_project_overrides_and_hidden_bars() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let path = temp.path().join("nested/settings.toml");
|
||||
assert_eq!(settings::read(&path).unwrap().version, 1);
|
||||
let mut settings = Settings::default();
|
||||
settings.layout.notes.size = 42.;
|
||||
settings.buffer_mib = 2048;
|
||||
settings.auto_show = false;
|
||||
settings.theme = deckstride::theme::Theme::CorporateLight;
|
||||
settings.theme_pack = Some("example-theme/night".into());
|
||||
settings.language = deckstride::localization::Language::Fr;
|
||||
settings.language_pack = Some("eo-example".into());
|
||||
let mut project = Layout::default();
|
||||
project.previous.show = true; // Explicit opt-in survives saving and loading.
|
||||
project.current.show = false;
|
||||
project.header = false;
|
||||
project.footer = false;
|
||||
project.elapsed_position = settings::TimerPosition::AboveSlides;
|
||||
project.clock_position = settings::TimerPosition::BelowNotes;
|
||||
project.slide_progress = true;
|
||||
settings.projects.insert("show".into(), project.clone());
|
||||
settings.routes = Routes {
|
||||
presenter: vec!["one".into(), "two".into()],
|
||||
presentation: vec!["three".into()],
|
||||
};
|
||||
settings::write(&path, &settings).unwrap();
|
||||
let loaded = settings::read(&path).unwrap();
|
||||
assert_eq!(loaded.for_project("show"), project);
|
||||
assert_eq!(loaded.for_project("other").notes.size, 42.);
|
||||
assert_eq!(loaded.routes, settings.routes);
|
||||
assert_eq!(loaded.buffer_mib, 2048);
|
||||
assert!(!loaded.auto_show);
|
||||
assert_eq!(loaded.theme, settings.theme);
|
||||
assert_eq!(loaded.theme_pack, settings.theme_pack);
|
||||
assert_eq!(loaded.language, settings.language);
|
||||
assert_eq!(loaded.language_pack, settings.language_pack);
|
||||
let bytes = std::fs::read(&path).unwrap();
|
||||
settings.version = 2;
|
||||
assert!(settings::write(&path, &settings).is_err());
|
||||
assert_eq!(std::fs::read(&path).unwrap(), bytes);
|
||||
}
|
||||
#[test]
|
||||
fn settings_reject_invalid_versions_ranges_and_duplicate_roles() {
|
||||
let mut s = Settings {
|
||||
version: 2,
|
||||
..Default::default()
|
||||
};
|
||||
assert!(s.validate().is_err());
|
||||
s.version = 1;
|
||||
s.buffer_mib = 63;
|
||||
assert!(s.validate().is_err());
|
||||
s.buffer_mib = 1024;
|
||||
s.layout.clock.size = f32::NAN;
|
||||
assert!(s.validate().is_err());
|
||||
s.layout = Default::default();
|
||||
s.routes.presenter = vec!["x".into(), "x".into()];
|
||||
assert!(s.validate().is_err());
|
||||
s.routes.presenter.pop();
|
||||
s.routes.presentation = vec!["x".into()];
|
||||
assert!(s.validate().is_err());
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let p = temp.path().join("bad.toml");
|
||||
std::fs::write(&p, "version = 99").unwrap();
|
||||
assert!(settings::read(&p).is_err());
|
||||
std::fs::write(&p, "invalid ]").unwrap();
|
||||
assert!(settings::read(&p).is_err());
|
||||
std::fs::write(&p, "version=1").unwrap();
|
||||
assert!(settings::read(&p).unwrap().layout.header);
|
||||
assert!(!settings::read(&p).unwrap().layout.previous.show);
|
||||
assert!(!Layout::default().previous.show);
|
||||
assert_eq!(
|
||||
settings::read(&p).unwrap().buffer_mib,
|
||||
Settings::default().buffer_mib
|
||||
);
|
||||
assert!(settings::read(&p).unwrap().auto_show);
|
||||
}
|
||||
#[test]
|
||||
fn monitor_recovery_preserves_survivors_and_distinct_groups() {
|
||||
let routes = Routes {
|
||||
presenter: vec!["a".into(), "b".into()],
|
||||
presentation: vec!["c".into()],
|
||||
};
|
||||
assert_eq!(
|
||||
routes.resolve(&["b".into(), "c".into()], 0),
|
||||
Routes {
|
||||
presenter: vec!["b".into()],
|
||||
presentation: vec!["c".into()]
|
||||
}
|
||||
);
|
||||
let one = routes.resolve(&["c".into()], 0);
|
||||
assert_eq!(one.presenter, vec!["c"]);
|
||||
assert!(one.presentation.is_empty());
|
||||
assert!(routes.resolve(&[], 0).presenter.is_empty());
|
||||
let fallback = Routes::default().resolve(&["a".into(), "b".into(), "c".into()], 1);
|
||||
assert_eq!(fallback.presenter, vec!["b"]);
|
||||
assert_eq!(fallback.presentation, vec!["a"]);
|
||||
let rehearsal = Routes {
|
||||
presenter: vec!["a".into()],
|
||||
presentation: vec![],
|
||||
};
|
||||
assert!(
|
||||
rehearsal
|
||||
.resolve(&["a".into(), "b".into()], 0)
|
||||
.presentation
|
||||
.is_empty()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn legacy_layouts_default_timer_positions_and_progress_is_opt_in() {
|
||||
let legacy: Settings = toml::from_str("version=1\n[layout]\nheader=false").unwrap();
|
||||
assert_eq!(
|
||||
legacy.layout.elapsed_position,
|
||||
settings::TimerPosition::Header
|
||||
);
|
||||
assert_eq!(
|
||||
legacy.layout.clock_position,
|
||||
settings::TimerPosition::Header
|
||||
);
|
||||
assert!(!legacy.layout.slide_progress);
|
||||
assert!(toml::from_str::<Settings>("[layout]\nclock_position='anywhere'").is_err());
|
||||
let example: Settings = toml::from_str(include_str!(
|
||||
"../../../docs/interfaces/examples/settings-v1.toml"
|
||||
))
|
||||
.unwrap();
|
||||
example.validate().unwrap();
|
||||
assert_eq!(
|
||||
example.layout,
|
||||
toml::from_str::<Settings>(&toml::to_string(&example).unwrap())
|
||||
.unwrap()
|
||||
.layout
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn slide_colors_migrate_roundtrip_and_reject_invalid_channels() {
|
||||
use settings::SlideColors;
|
||||
let old: Settings = toml::from_str("version = 1").unwrap();
|
||||
assert_eq!(old.slide_colors, SlideColors::default());
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let path = temp.path().join("settings.toml");
|
||||
let mut s = old;
|
||||
s.slide_colors = SlideColors {
|
||||
page_background: [10, 20, 30],
|
||||
fit_padding: [40, 50, 60],
|
||||
};
|
||||
settings::write(&path, &s).unwrap();
|
||||
assert_eq!(settings::read(&path).unwrap().slide_colors, s.slide_colors);
|
||||
let state = deckstride::output::HostState {
|
||||
slide_colors: s.slide_colors,
|
||||
..Default::default()
|
||||
};
|
||||
let restored: deckstride::output::HostState =
|
||||
serde_json::from_slice(&serde_json::to_vec(&state).unwrap()).unwrap();
|
||||
assert_eq!(restored.slide_colors, s.slide_colors);
|
||||
for value in [
|
||||
"[256, 0, 0]",
|
||||
"[-1, 0, 0]",
|
||||
"[0, 0]",
|
||||
"[0, 0, 0, 0]",
|
||||
"[0.5, 0, 0]",
|
||||
] {
|
||||
assert!(
|
||||
toml::from_str::<Settings>(&format!(
|
||||
"version=1\n[slide_colors]\npage_background={value}"
|
||||
))
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn automatic_buffer_budget_softens_floor_under_memory_pressure() {
|
||||
let budget = |mib: u64| settings::buffer_budget_mib(Some(mib * 1024 * 1024));
|
||||
assert_eq!(budget(8192), 1228); // 15% on a roomy system.
|
||||
assert_eq!(budget(3072), 512); // Soft floor, still below 20%.
|
||||
assert_eq!(budget(2048), 409); // Floor yields to memory pressure.
|
||||
assert_eq!(budget(1024), 204);
|
||||
assert_eq!(budget(256), 64);
|
||||
assert_eq!(budget(0), 64);
|
||||
assert_eq!(budget(1024 * 1024), 16384);
|
||||
assert_eq!(settings::buffer_budget_mib(None), 256);
|
||||
assert_eq!(settings::buffer_budget_mib(Some(u64::MAX)), 16384);
|
||||
let legacy: Settings = toml::from_str("version=1\nbuffer_mib=1024").unwrap();
|
||||
assert_eq!(legacy.buffer_mib, 1024); // Explicit saved budgets remain authoritative.
|
||||
for value in [64, 204, 512, 16384] {
|
||||
Settings {
|
||||
buffer_mib: value,
|
||||
..Default::default()
|
||||
}
|
||||
.validate()
|
||||
.unwrap();
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn side_timer_positions_and_large_sizes_roundtrip() {
|
||||
for position in settings::TimerPosition::ALL {
|
||||
let mut s = Settings::default();
|
||||
s.layout.elapsed_position = position;
|
||||
s.layout.clock_position = position;
|
||||
s.layout.elapsed.size = 320.;
|
||||
s.layout.clock.size = 320.;
|
||||
s.validate().unwrap();
|
||||
let restored: Settings = toml::from_str(&toml::to_string(&s).unwrap()).unwrap();
|
||||
assert_eq!(restored.layout, s.layout);
|
||||
s.layout.elapsed.size = 321.;
|
||||
assert!(s.validate().is_err());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn timer_and_progress_settings_migrate_validate_and_roundtrip() {
|
||||
let legacy: Settings = toml::from_str("version=1").unwrap();
|
||||
assert_eq!(legacy.layout.timer_mode, settings::TimerMode::Elapsed);
|
||||
assert_eq!(legacy.layout.countdown_seconds, 1200);
|
||||
assert!(legacy.layout.timer_autostart);
|
||||
assert_eq!(legacy.layout.slide_progress_height, 24.);
|
||||
let mut s = legacy;
|
||||
s.layout.timer_mode = settings::TimerMode::Countdown;
|
||||
s.layout.countdown_seconds = 90;
|
||||
s.layout.timer_autostart = false;
|
||||
s.layout.slide_progress_height = 120.;
|
||||
s.projects.insert("demo".into(), s.layout.clone());
|
||||
s.validate().unwrap();
|
||||
let loaded: Settings = toml::from_str(&toml::to_string(&s).unwrap()).unwrap();
|
||||
assert_eq!(s.layout, loaded.layout);
|
||||
assert_eq!(s.projects, loaded.projects);
|
||||
for duration in [0, 86401] {
|
||||
s.layout.countdown_seconds = duration;
|
||||
assert!(s.validate().is_err());
|
||||
}
|
||||
s.layout.countdown_seconds = 1;
|
||||
for height in [7., 121., f32::NAN] {
|
||||
s.layout.slide_progress_height = height;
|
||||
assert!(s.validate().is_err());
|
||||
}
|
||||
assert!(toml::from_str::<Settings>("[layout]\ntimer_mode='unknown'").is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn display_layout_profiles_roundtrip_migrate_and_validate() {
|
||||
use settings::DisplayLayouts;
|
||||
let mut s: Settings =
|
||||
toml::from_str("version=1\n[layout.notes]\nshow=true\nsize=40.0").unwrap();
|
||||
assert!(s.display_layouts.is_empty());
|
||||
let mut legacy_project = s.layout.clone();
|
||||
legacy_project.notes.size = 55.;
|
||||
s.projects.insert("show".into(), legacy_project.clone());
|
||||
assert_eq!(s.for_display("main#1", "show"), legacy_project);
|
||||
let mut alternate = Layout::default();
|
||||
alternate.current.size = 180.;
|
||||
alternate.notes.show = false;
|
||||
alternate.header = false;
|
||||
alternate.clock_position = settings::TimerPosition::RightOfSlides;
|
||||
let mut project = alternate.clone();
|
||||
project.slide_progress = true;
|
||||
s.display_layouts.insert(
|
||||
"Side screen#1".into(),
|
||||
DisplayLayouts {
|
||||
layout: alternate.clone(),
|
||||
projects: [("show".into(), project.clone())].into(),
|
||||
},
|
||||
);
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let path = temp.path().join("settings.toml");
|
||||
settings::write(&path, &s).unwrap();
|
||||
let loaded = settings::read(&path).unwrap();
|
||||
assert_eq!(loaded.for_display("Side screen#1", "show"), project);
|
||||
assert_eq!(loaded.for_display("Side screen#1", "other"), alternate);
|
||||
assert_eq!(loaded.for_display("main#1", "show"), legacy_project);
|
||||
let mut bad = loaded.clone();
|
||||
bad.display_layouts
|
||||
.get_mut("Side screen#1")
|
||||
.unwrap()
|
||||
.layout
|
||||
.notes
|
||||
.size = f32::NAN;
|
||||
assert!(bad.validate().is_err());
|
||||
bad = loaded.clone();
|
||||
bad.display_layouts
|
||||
.get_mut("Side screen#1")
|
||||
.unwrap()
|
||||
.projects
|
||||
.get_mut("show")
|
||||
.unwrap()
|
||||
.current
|
||||
.size = 0.;
|
||||
assert!(bad.validate().is_err());
|
||||
bad = loaded.clone();
|
||||
bad.display_layouts.insert("".into(), Default::default());
|
||||
assert!(bad.validate().is_err());
|
||||
bad = loaded.clone();
|
||||
for i in 0..128 {
|
||||
bad.display_layouts
|
||||
.insert(format!("display-{i}"), Default::default());
|
||||
}
|
||||
assert!(bad.validate().is_err());
|
||||
bad = loaded;
|
||||
bad.display_layouts
|
||||
.get_mut("Side screen#1")
|
||||
.unwrap()
|
||||
.projects = (0..4097)
|
||||
.map(|i| (format!("project-{i}"), Layout::default()))
|
||||
.collect();
|
||||
assert!(bad.validate().is_err());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn screen_modes_migrate_validate_and_roundtrip() {
|
||||
use settings::ScreenMode::{AlwaysFullscreen, AlwaysWindowed, FollowGlobal};
|
||||
let old: Settings = toml::from_str("version = 1").unwrap();
|
||||
assert!(old.screen_modes.is_empty());
|
||||
for global in [false, true] {
|
||||
assert_eq!(FollowGlobal.fullscreen(global), global);
|
||||
assert!(AlwaysFullscreen.fullscreen(global));
|
||||
assert!(!AlwaysWindowed.fullscreen(global));
|
||||
}
|
||||
let mut s = old;
|
||||
s.screen_modes = [
|
||||
("one".into(), AlwaysFullscreen),
|
||||
("two".into(), AlwaysWindowed),
|
||||
("three".into(), FollowGlobal),
|
||||
]
|
||||
.into();
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let path = temp.path().join("settings.toml");
|
||||
settings::write(&path, &s).unwrap();
|
||||
assert_eq!(settings::read(&path).unwrap().screen_modes, s.screen_modes);
|
||||
assert!(toml::from_str::<Settings>("[screen_modes]\none = 'invalid'").is_err());
|
||||
for id in [String::new(), "a".repeat(1025)] {
|
||||
s.screen_modes.insert(id.clone(), AlwaysWindowed);
|
||||
assert!(s.validate().is_err());
|
||||
s.screen_modes.remove(&id);
|
||||
}
|
||||
s.screen_modes = (0..129)
|
||||
.map(|i| (i.to_string(), AlwaysFullscreen))
|
||||
.collect();
|
||||
assert!(s.validate().is_err());
|
||||
s.screen_modes.remove("128");
|
||||
assert!(s.validate().is_ok());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn autoplay_settings_migrate_validate_and_round_trip() {
|
||||
let legacy: Settings = toml::from_str("version = 1").unwrap();
|
||||
assert!(!legacy.autoplay_enabled);
|
||||
assert_eq!(legacy.autoplay_seconds, 5.0);
|
||||
assert!(!legacy.autoplay_loop);
|
||||
|
||||
let mut settings = legacy;
|
||||
settings.autoplay_enabled = true;
|
||||
settings.autoplay_seconds = 12.5;
|
||||
settings.autoplay_loop = true;
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let path = temp.path().join("settings.toml");
|
||||
settings::write(&path, &settings).unwrap();
|
||||
let loaded = settings::read(&path).unwrap();
|
||||
assert!(loaded.autoplay_enabled);
|
||||
assert_eq!(loaded.autoplay_seconds, 12.5);
|
||||
assert!(loaded.autoplay_loop);
|
||||
|
||||
for invalid in [0.0, 0.24, 3600.01, f32::INFINITY, f32::NAN] {
|
||||
let mut invalid_settings = loaded.clone();
|
||||
invalid_settings.autoplay_seconds = invalid;
|
||||
assert!(invalid_settings.validate().is_err());
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn output_screen_modes_roundtrip_and_fall_back_to_global() {
|
||||
use deckstride::output::HostState;
|
||||
let state = HostState {
|
||||
fullscreen: true,
|
||||
screen_fullscreen: [("one".into(), false), ("two".into(), true)].into(),
|
||||
..Default::default()
|
||||
};
|
||||
let loaded: HostState = serde_json::from_slice(&serde_json::to_vec(&state).unwrap()).unwrap();
|
||||
assert!(!loaded.fullscreen_on("one"));
|
||||
assert!(loaded.fullscreen_on("two"));
|
||||
assert!(loaded.fullscreen_on("unknown"));
|
||||
let mut legacy = serde_json::to_value(state).unwrap();
|
||||
legacy.as_object_mut().unwrap().remove("screen_fullscreen");
|
||||
assert!(
|
||||
serde_json::from_value::<HostState>(legacy)
|
||||
.unwrap()
|
||||
.fullscreen_on("one")
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn single_screen_preferences_are_additive_bounded_and_roundtrip() {
|
||||
let old: Settings = toml::from_str("version = 1").unwrap();
|
||||
assert!(old.single_screens.is_empty());
|
||||
let mut s = old;
|
||||
s.single_screens = vec!["one".into(), "disconnected#1".into()];
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let path = temp.path().join("settings.toml");
|
||||
settings::write(&path, &s).unwrap();
|
||||
assert_eq!(
|
||||
settings::read(&path).unwrap().single_screens,
|
||||
s.single_screens
|
||||
);
|
||||
for ids in [
|
||||
vec!["".into()],
|
||||
vec!["a".repeat(1025)],
|
||||
vec!["one".into(), "one".into()],
|
||||
(0..33).map(|i| i.to_string()).collect(),
|
||||
] {
|
||||
s.single_screens = ids;
|
||||
assert!(s.validate().is_err());
|
||||
}
|
||||
s.single_screens = (0..32).map(|i| i.to_string()).collect();
|
||||
assert!(s.validate().is_ok());
|
||||
}
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
mod common;
|
||||
use deckstride::{document::Document, presenter_ui::paint_slide, settings::SlideColors};
|
||||
use egui::{Context, Pos2, RawInput, Rect, TextureOptions, Vec2};
|
||||
use egui_software_backend::{BufferMutRef, ColorFieldOrder, EguiSoftwareRender};
|
||||
use pdf_presenter::{document::Document, presenter_ui::paint_slide, settings::SlideColors};
|
||||
|
||||
#[test]
|
||||
fn transparent_pdf_composites_on_white_or_custom_page_with_independent_padding() {
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
use deckstride::timer::Timer;
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
#[test]
|
||||
fn elapsed_action_start_pause_resume_and_reset_use_monotonic_time() {
|
||||
let now = Instant::now();
|
||||
let mut timer = Timer::default();
|
||||
assert_eq!(timer.seconds(now + Duration::from_secs(50), None), 0);
|
||||
timer.presentation_action(now, true);
|
||||
assert!(timer.running(now, None));
|
||||
timer.presentation_action(now + Duration::from_secs(4), true);
|
||||
assert_eq!(timer.seconds(now + Duration::from_secs(5), None), 5);
|
||||
timer.toggle(now + Duration::from_secs(5), None);
|
||||
assert!(!timer.running(now + Duration::from_secs(20), None));
|
||||
timer.presentation_action(now + Duration::from_secs(10), true);
|
||||
assert_eq!(timer.seconds(now + Duration::from_secs(20), None), 5);
|
||||
timer.toggle(now + Duration::from_secs(20), None);
|
||||
assert_eq!(timer.seconds(now + Duration::from_secs(23), None), 8);
|
||||
timer.reset();
|
||||
assert_eq!(timer.seconds(now + Duration::from_secs(25), None), 0);
|
||||
assert!(!timer.running(now + Duration::from_secs(25), None));
|
||||
timer.presentation_action(now + Duration::from_secs(25), true);
|
||||
assert!(timer.running(now + Duration::from_secs(25), None));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn countdown_manual_start_preserves_fractional_seconds_and_stops_at_zero() {
|
||||
let now = Instant::now();
|
||||
let limit = Some(Duration::from_secs(90));
|
||||
let mut timer = Timer::default();
|
||||
timer.presentation_action(now, false);
|
||||
assert!(!timer.running(now, limit));
|
||||
assert_eq!(timer.seconds(now + Duration::from_secs(5), limit), 90);
|
||||
timer.toggle(now, limit);
|
||||
assert_eq!(timer.seconds(now + Duration::from_millis(100), limit), 90);
|
||||
timer.toggle(now + Duration::from_millis(1500), limit);
|
||||
assert_eq!(timer.seconds(now + Duration::from_secs(20), limit), 89);
|
||||
timer.toggle(now + Duration::from_secs(20), limit);
|
||||
assert_eq!(timer.seconds(now + Duration::from_millis(20500), limit), 88);
|
||||
assert_eq!(timer.seconds(now + Duration::from_secs(200), limit), 0);
|
||||
assert!(!timer.running(now + Duration::from_secs(200), limit));
|
||||
timer.toggle(now + Duration::from_secs(200), limit);
|
||||
assert_eq!(timer.seconds(now + Duration::from_secs(200), limit), 90);
|
||||
assert!(timer.running(now + Duration::from_secs(200), limit));
|
||||
}
|
||||
|
|
@ -0,0 +1,102 @@
|
|||
use deckstride::{
|
||||
output::{HostState, coalesce},
|
||||
tools::{MAX_MARKS, Mark, MarkKind, Overlay, Toolbox, screen_to_page},
|
||||
};
|
||||
use egui::{Pos2, Rect, Vec2};
|
||||
|
||||
#[test]
|
||||
fn overlay_input_is_bounded_and_normalized() {
|
||||
let marks = (0..MAX_MARKS + 10)
|
||||
.map(|_| Mark {
|
||||
kind: MarkKind::Arrow,
|
||||
from: [-1., 0.25],
|
||||
to: [2., 0.75],
|
||||
color: [255, 0, 0],
|
||||
width: 500.,
|
||||
})
|
||||
.collect();
|
||||
let overlay = Overlay {
|
||||
pointer: Some([f32::NAN, 0.]),
|
||||
pointer_size: f32::INFINITY,
|
||||
marks,
|
||||
..Default::default()
|
||||
}
|
||||
.normalized();
|
||||
assert_eq!(overlay.marks.len(), MAX_MARKS);
|
||||
assert_eq!(overlay.marks[0].from, [0., 0.25]);
|
||||
assert_eq!(overlay.marks[0].to, [1., 0.75]);
|
||||
assert_eq!(overlay.marks[0].width, 48.);
|
||||
assert_eq!(overlay.pointer, None);
|
||||
assert_eq!(overlay.pointer_size, 12.);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn toolbox_discards_oldest_mark_and_maps_visible_crop() {
|
||||
let mut tools = Toolbox::default();
|
||||
tools.select(deckstride::tools::Tool::Arrow);
|
||||
for index in 0..MAX_MARKS + 1 {
|
||||
assert!(tools.begin_mark([index as f32 / 100., 0.5]));
|
||||
tools.end_mark();
|
||||
}
|
||||
assert_eq!(tools.overlay.marks.len(), MAX_MARKS);
|
||||
assert_eq!(tools.overlay.marks[0].from[0], 0.01);
|
||||
|
||||
let target = Rect::from_min_size(Pos2::new(10., 20.), Vec2::new(200., 100.));
|
||||
let uv = Rect::from_min_max(Pos2::new(0.25, 0.25), Pos2::new(0.75, 0.75));
|
||||
assert_eq!(screen_to_page(target, uv, target.center()), [0.5, 0.5]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn overlay_update_coalesces_without_losing_full_output_state() {
|
||||
let mut pending = Some(HostState {
|
||||
generation: 9,
|
||||
page: 3,
|
||||
sequence: 22,
|
||||
monitors: vec!["projector".into()],
|
||||
..Default::default()
|
||||
});
|
||||
let overlay = Overlay {
|
||||
pointer: Some([0.2, 0.7]),
|
||||
pointer_size: 14.,
|
||||
..Default::default()
|
||||
};
|
||||
coalesce(
|
||||
&mut pending,
|
||||
HostState {
|
||||
generation: 9,
|
||||
page: 3,
|
||||
overlay_only: true,
|
||||
overlay: overlay.clone(),
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
let pending = pending.unwrap();
|
||||
assert_eq!(pending.sequence, 22);
|
||||
assert_eq!(pending.monitors, vec!["projector"]);
|
||||
assert!(!pending.overlay_only);
|
||||
assert_eq!(pending.overlay, overlay.clone().normalized());
|
||||
|
||||
let mut lightweight = Some(HostState {
|
||||
generation: 9,
|
||||
page: 3,
|
||||
overlay_only: true,
|
||||
overlay: overlay.clone(),
|
||||
..Default::default()
|
||||
});
|
||||
coalesce(
|
||||
&mut lightweight,
|
||||
HostState {
|
||||
generation: 9,
|
||||
page: 3,
|
||||
zoom_only: true,
|
||||
zoom: deckstride::zoom::Sync {
|
||||
enabled: true,
|
||||
..Default::default()
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
let lightweight = lightweight.unwrap();
|
||||
assert!(lightweight.overlay_only && lightweight.zoom_only);
|
||||
assert_eq!(lightweight.overlay, overlay.normalized());
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
mod common;
|
||||
use pdf_presenter::worker::{Reply, Request, read_json, write_json};
|
||||
use deckstride::worker::{Reply, Request, read_json, write_json};
|
||||
use std::{
|
||||
io::Read,
|
||||
process::{Command, Stdio},
|
||||
|
|
@ -10,7 +10,7 @@ fn worker_protocol_loads_renders_and_keeps_previous_document_after_failure() {
|
|||
let path = temp.path().join("sample.pdf");
|
||||
common::pdf(&path);
|
||||
let cache = temp.path().join("cache");
|
||||
let mut child = Command::new(env!("CARGO_BIN_EXE_pdf-presenter"))
|
||||
let mut child = Command::new(env!("CARGO_BIN_EXE_deckstride"))
|
||||
.arg("--worker")
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
|
|
@ -79,9 +79,9 @@ fn protocol_rejects_oversized_and_malformed_messages() {
|
|||
#[test]
|
||||
fn supervisor_kills_a_stuck_worker_and_recovers() {
|
||||
use std::time::{Duration, Instant};
|
||||
let bridge = pdf_presenter::worker::Bridge::with_program(
|
||||
let bridge = deckstride::worker::Bridge::with_program(
|
||||
Duration::from_millis(300),
|
||||
env!("CARGO_BIN_EXE_pdf-presenter").into(),
|
||||
env!("CARGO_BIN_EXE_deckstride").into(),
|
||||
);
|
||||
let start = Instant::now();
|
||||
assert!(bridge.submit(7, 1, Request::SleepTest(5000)));
|
||||
|
|
@ -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 deckstride::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);
|
||||
}
|
||||
|
|
@ -0,0 +1,682 @@
|
|||
use deckstride::{
|
||||
output::{HostState, coalesce},
|
||||
settings::Settings,
|
||||
zoom::{PerformanceWatch, Sync, View},
|
||||
};
|
||||
use egui::{Context, Pos2, RawInput, Rect, TextureOptions, Vec2};
|
||||
use egui_software_backend::{BufferMutRef, ColorFieldOrder, EguiSoftwareRender};
|
||||
use std::time::{Duration, Instant};
|
||||
#[test]
|
||||
fn crop_anchor_pan_and_limits() {
|
||||
let start = View::default();
|
||||
let zoom = start.zoom_at(2., [0.25, 0.75]);
|
||||
assert_eq!(zoom.center, [0.375, 0.625]);
|
||||
assert_eq!(zoom.uv().size(), Vec2::splat(0.5));
|
||||
let panned = zoom.pan([0.1, -0.1]);
|
||||
assert!((panned.center[0] - 0.325).abs() < 0.00001);
|
||||
let edge = panned.pan([100., -100.]);
|
||||
assert_eq!(edge.center, [0.25, 0.75]);
|
||||
assert_eq!(edge.zoom_at(1., [0., 0.]), start);
|
||||
assert_eq!(start.zoom_at(100., [0.5; 2]).scale, 8.);
|
||||
assert_eq!(
|
||||
View {
|
||||
scale: f32::NAN,
|
||||
center: [f32::INFINITY, 0.]
|
||||
}
|
||||
.normalized(),
|
||||
start
|
||||
);
|
||||
assert_eq!(start.pan([f32::NAN, f32::INFINITY]), start);
|
||||
}
|
||||
#[test]
|
||||
fn synchronization_rejects_stale_gestures_and_coalesces_without_losing_frames() {
|
||||
let mut presenter = Sync::default();
|
||||
presenter.set(true, View::default());
|
||||
let mut host = presenter;
|
||||
host.gesture(host.view.zoom_at(3., [0.5; 2]));
|
||||
let old = host;
|
||||
host.gesture(host.view.pan([0.1, 0.]));
|
||||
assert!(presenter.accept_output(host));
|
||||
assert!(!presenter.accept_output(old));
|
||||
host.accept_presenter(old);
|
||||
assert_eq!(host, presenter);
|
||||
presenter.set(true, View::default());
|
||||
assert!(!presenter.accept_output(host));
|
||||
host.accept_presenter(presenter);
|
||||
assert_eq!(host.view, View::default());
|
||||
presenter.set(false, host.view.zoom_at(4., [0.5; 2]));
|
||||
assert_eq!(presenter.view, View::default());
|
||||
let mut pending = Some(HostState {
|
||||
generation: 4,
|
||||
page: 2,
|
||||
sequence: 12,
|
||||
monitors: vec!["screen".into()],
|
||||
zoom: host,
|
||||
..Default::default()
|
||||
});
|
||||
host.gesture(host.view.zoom_at(4., [0.5; 2]));
|
||||
coalesce(
|
||||
&mut pending,
|
||||
HostState {
|
||||
zoom_only: true,
|
||||
zoom: host,
|
||||
generation: 4,
|
||||
page: 2,
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
let state = pending.as_ref().unwrap();
|
||||
assert_eq!(state.monitors, vec!["screen"]);
|
||||
assert_eq!(state.sequence, 12);
|
||||
assert!(!state.zoom_only);
|
||||
assert_eq!(state.zoom, host);
|
||||
coalesce(
|
||||
&mut pending,
|
||||
HostState {
|
||||
zoom_only: true,
|
||||
generation: 3,
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
assert_eq!(pending.as_ref().unwrap().zoom, host);
|
||||
coalesce(
|
||||
&mut pending,
|
||||
HostState {
|
||||
quit: true,
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
assert!(pending.unwrap().quit);
|
||||
}
|
||||
#[test]
|
||||
fn settings_default_opt_out_roundtrip_and_warning_threshold() {
|
||||
assert!(!Settings::default().zoom_enabled);
|
||||
let old: Settings = toml::from_str("version=1").unwrap();
|
||||
assert!(!old.zoom_enabled);
|
||||
assert!(!old.zoom_keep_fitted_area);
|
||||
assert!(!Settings::default().zoom_keep_fitted_area);
|
||||
let enabled = Settings {
|
||||
zoom_enabled: true,
|
||||
zoom_keep_fitted_area: true,
|
||||
..Default::default()
|
||||
};
|
||||
let restored: Settings = toml::from_str(&toml::to_string(&enabled).unwrap()).unwrap();
|
||||
assert!(restored.zoom_enabled);
|
||||
assert!(restored.zoom_keep_fitted_area);
|
||||
let mut watch = PerformanceWatch::default();
|
||||
assert!(!watch.observe(false, Duration::from_secs(1)));
|
||||
assert!(!watch.observe(true, Duration::from_millis(40)));
|
||||
assert!(!watch.observe(true, Duration::from_millis(40)));
|
||||
assert!(watch.observe(true, Duration::from_millis(40)));
|
||||
assert!(!watch.observe(true, Duration::from_millis(20)));
|
||||
assert!(!watch.observe(true, Duration::from_millis(40)));
|
||||
}
|
||||
#[test]
|
||||
fn zoom_paints_existing_texture_crop_with_constant_geometry_and_no_new_uploads() {
|
||||
let ctx = Context::default();
|
||||
let mut rgba = vec![0; 64 * 32 * 4];
|
||||
for y in 0..32 {
|
||||
for x in 0..64 {
|
||||
let color = if x < 32 {
|
||||
[255, 0, 0, 255]
|
||||
} else {
|
||||
[0, 0, 255, 255]
|
||||
};
|
||||
rgba[(y * 64 + x) * 4..(y * 64 + x + 1) * 4].copy_from_slice(&color);
|
||||
}
|
||||
}
|
||||
let texture = ctx.load_texture(
|
||||
"slide",
|
||||
egui::ColorImage::from_rgba_unmultiplied([64, 32], &rgba),
|
||||
TextureOptions::NEAREST,
|
||||
);
|
||||
let mut renderer = EguiSoftwareRender::new(ColorFieldOrder::Bgra);
|
||||
let rect = Rect::from_min_size(Pos2::ZERO, Vec2::splat(200.));
|
||||
let mut pixels = vec![0u32; 200 * 200];
|
||||
for (index, view) in [
|
||||
View::default(),
|
||||
View {
|
||||
scale: 2.,
|
||||
center: [0.25, 0.5],
|
||||
},
|
||||
View {
|
||||
scale: 2.,
|
||||
center: [0.75, 0.5],
|
||||
},
|
||||
]
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
{
|
||||
let output = ctx.run_ui(
|
||||
RawInput {
|
||||
screen_rect: Some(rect),
|
||||
..Default::default()
|
||||
},
|
||||
|ui| {
|
||||
deckstride::presenter_ui::paint_slide_zoomed(
|
||||
ui.painter(),
|
||||
rect,
|
||||
texture.id(),
|
||||
[64, 32],
|
||||
Default::default(),
|
||||
view,
|
||||
);
|
||||
},
|
||||
);
|
||||
if index > 0 {
|
||||
assert!(
|
||||
output.textures_delta.set.is_empty(),
|
||||
"zoom uploaded another image"
|
||||
);
|
||||
}
|
||||
let primitives = ctx.tessellate(output.shapes, output.pixels_per_point);
|
||||
for primitive in &primitives {
|
||||
if let egui::epaint::Primitive::Mesh(mesh) = &primitive.primitive
|
||||
&& mesh.texture_id == texture.id()
|
||||
{
|
||||
assert!(
|
||||
mesh.vertices.iter().all(|v| rect.contains(v.pos)),
|
||||
"zoom enlarged draw geometry"
|
||||
);
|
||||
}
|
||||
}
|
||||
renderer.render(
|
||||
&mut BufferMutRef::new(bytemuck::cast_slice_mut(&mut pixels), 200, 200),
|
||||
&primitives,
|
||||
&output.textures_delta,
|
||||
output.pixels_per_point,
|
||||
);
|
||||
assert_eq!(pixels[5 * 200 + 5] & 0xffffff, 0); // Padding unchanged.
|
||||
if index > 0 {
|
||||
let expected = if index == 1 { 0xff0000 } else { 0x0000ff };
|
||||
assert_eq!(pixels[100 * 200 + 30] & 0xffffff, expected);
|
||||
assert_eq!(pixels[100 * 200 + 170] & 0xffffff, expected);
|
||||
}
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
#[ignore = "Manual Linux software drawing measurement; not a timing-sensitive CI assertion"]
|
||||
fn buffered_zoom_drawing_measurement() {
|
||||
for [width, height] in [[1920usize, 1080usize], [3840, 2160]] {
|
||||
let ctx = Context::default();
|
||||
let rgba: Vec<u8> = (0..1920 * 1080)
|
||||
.flat_map(|p| [(p % 256) as u8, ((p / 1920) % 256) as u8, 128, 255])
|
||||
.collect();
|
||||
let texture = ctx.load_texture(
|
||||
"benchmark",
|
||||
egui::ColorImage::from_rgba_unmultiplied([1920, 1080], &rgba),
|
||||
TextureOptions::LINEAR,
|
||||
);
|
||||
let mut renderer = EguiSoftwareRender::new(ColorFieldOrder::Bgra);
|
||||
let mut pixels = vec![0u32; width * height];
|
||||
let rect = Rect::from_min_size(Pos2::ZERO, Vec2::new(width as f32, height as f32));
|
||||
for scale in [1., 4., 8.] {
|
||||
let mut times = Vec::new();
|
||||
for i in 0..12 {
|
||||
let start = Instant::now();
|
||||
let view = View {
|
||||
scale,
|
||||
center: [0.4 + i as f32 * 0.01, 0.5],
|
||||
}
|
||||
.normalized();
|
||||
let output = ctx.run_ui(
|
||||
RawInput {
|
||||
screen_rect: Some(rect),
|
||||
..Default::default()
|
||||
},
|
||||
|ui| {
|
||||
deckstride::presenter_ui::paint_slide_adapted(
|
||||
ui.painter(),
|
||||
rect,
|
||||
texture.id(),
|
||||
[210, 297],
|
||||
Default::default(),
|
||||
Sync {
|
||||
enabled: true,
|
||||
view,
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
let primitives = ctx.tessellate(output.shapes, output.pixels_per_point);
|
||||
renderer.render(
|
||||
&mut BufferMutRef::new(bytemuck::cast_slice_mut(&mut pixels), width, height),
|
||||
&primitives,
|
||||
&output.textures_delta,
|
||||
output.pixels_per_point,
|
||||
);
|
||||
if i > 1 {
|
||||
times.push(start.elapsed().as_secs_f64() * 1000.);
|
||||
}
|
||||
}
|
||||
times.sort_by(f64::total_cmp);
|
||||
println!(
|
||||
"{width}x{height} {scale}x: median {:.2} ms, max {:.2} ms",
|
||||
times[times.len() / 2],
|
||||
times.last().unwrap()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn wheel_drag_and_double_click_operate_in_slide_coordinates() {
|
||||
let ctx = Context::default();
|
||||
let target = Rect::from_min_max(Pos2::new(40., 40.), Pos2::new(440., 240.));
|
||||
let mut view = View::default();
|
||||
let mut time = 0.;
|
||||
let mut render = |events: Vec<egui::Event>| {
|
||||
time += 0.04;
|
||||
let _ = ctx.run_ui(
|
||||
RawInput {
|
||||
screen_rect: Some(Rect::from_min_size(Pos2::ZERO, Vec2::new(500., 300.))),
|
||||
events,
|
||||
time: Some(time),
|
||||
..Default::default()
|
||||
},
|
||||
|ui| {
|
||||
view = deckstride::presenter_ui::zoom_gestures(ui, target, view).0;
|
||||
},
|
||||
);
|
||||
view
|
||||
};
|
||||
let center = target.center();
|
||||
render(vec![egui::Event::PointerMoved(center)]);
|
||||
render(vec![egui::Event::MouseWheel {
|
||||
unit: egui::MouseWheelUnit::Point,
|
||||
phase: egui::TouchPhase::Move,
|
||||
delta: Vec2::new(0., 300.),
|
||||
modifiers: egui::Modifiers::NONE,
|
||||
}]);
|
||||
let mut zoom = View::default();
|
||||
for _ in 0..30 {
|
||||
zoom = render(vec![]);
|
||||
}
|
||||
assert!(zoom.scale > 1.2);
|
||||
let click = |pos, pressed| egui::Event::PointerButton {
|
||||
pos,
|
||||
button: egui::PointerButton::Primary,
|
||||
pressed,
|
||||
modifiers: egui::Modifiers::NONE,
|
||||
};
|
||||
render(vec![click(center, true)]);
|
||||
let moved = center + Vec2::new(40., 10.);
|
||||
let panned = render(vec![egui::Event::PointerMoved(moved)]);
|
||||
assert!(panned.center[0] < zoom.center[0]);
|
||||
render(vec![click(moved, false)]);
|
||||
for _ in 0..20 {
|
||||
render(vec![]);
|
||||
}
|
||||
for _ in 0..2 {
|
||||
render(vec![click(moved, true)]);
|
||||
zoom = render(vec![click(moved, false)]);
|
||||
}
|
||||
assert_eq!(zoom, View::default());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn optimized_crop_matches_general_renderer_with_alpha_clipping_and_dpi() {
|
||||
for dpi in [1., 2.] {
|
||||
let ctx = Context::default();
|
||||
ctx.set_pixels_per_point(dpi);
|
||||
let rgba: Vec<u8> = (0..64 * 32)
|
||||
.flat_map(|p| {
|
||||
[
|
||||
(p % 64 * 4) as u8,
|
||||
(p / 64 * 8) as u8,
|
||||
80,
|
||||
(40 + p % 64 * 3) as u8,
|
||||
]
|
||||
})
|
||||
.collect();
|
||||
let texture = ctx.load_texture(
|
||||
"alpha",
|
||||
egui::ColorImage::from_rgba_unmultiplied([64, 32], &rgba),
|
||||
TextureOptions::LINEAR,
|
||||
);
|
||||
let mut fast = EguiSoftwareRender::new(ColorFieldOrder::Bgra);
|
||||
let mut reference =
|
||||
EguiSoftwareRender::new(ColorFieldOrder::Bgra).with_allow_raster_opt(false);
|
||||
let rect = Rect::from_min_size(Pos2::ZERO, Vec2::new(320., 240.));
|
||||
let mut actual = vec![0u32; (320. * dpi) as usize * (240. * dpi) as usize];
|
||||
let mut expected = actual.clone();
|
||||
for view in [
|
||||
View {
|
||||
scale: 2.,
|
||||
center: [0.25, 0.25],
|
||||
},
|
||||
View {
|
||||
scale: 3.1,
|
||||
center: [0.7, 0.4],
|
||||
},
|
||||
] {
|
||||
let output = ctx.run_ui(
|
||||
RawInput {
|
||||
screen_rect: Some(rect),
|
||||
..Default::default()
|
||||
},
|
||||
|ui| {
|
||||
let painter = ui.painter().with_clip_rect(rect.shrink(20.));
|
||||
deckstride::presenter_ui::paint_slide_zoomed(
|
||||
&painter,
|
||||
rect,
|
||||
texture.id(),
|
||||
[64, 32],
|
||||
Default::default(),
|
||||
view,
|
||||
);
|
||||
},
|
||||
);
|
||||
let primitives = ctx.tessellate(output.shapes, output.pixels_per_point);
|
||||
let width = (320. * output.pixels_per_point) as usize;
|
||||
let height = (240. * output.pixels_per_point) as usize;
|
||||
// egui applies a requested DPI change on a subsequent frame.
|
||||
actual.resize(width * height, 0);
|
||||
expected.resize(width * height, 0);
|
||||
actual.fill(0);
|
||||
expected.fill(0);
|
||||
fast.render(
|
||||
&mut BufferMutRef::new(bytemuck::cast_slice_mut(&mut actual), width, height),
|
||||
&primitives,
|
||||
&output.textures_delta,
|
||||
output.pixels_per_point,
|
||||
);
|
||||
reference.render(
|
||||
&mut BufferMutRef::new(bytemuck::cast_slice_mut(&mut expected), width, height),
|
||||
&primitives,
|
||||
&output.textures_delta,
|
||||
output.pixels_per_point,
|
||||
);
|
||||
for (a, b) in actual.iter().zip(&expected) {
|
||||
for (a, b) in a.to_le_bytes().iter().zip(b.to_le_bytes()) {
|
||||
assert!(
|
||||
a.abs_diff(b) <= 2,
|
||||
"crop pixel mismatch: {a} vs {b} at DPI {dpi}"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn parallel_crop_bands_have_no_seams_at_fractional_boundaries() {
|
||||
let ctx = Context::default();
|
||||
let texture = ctx.load_texture(
|
||||
"solid",
|
||||
egui::ColorImage::from_rgba_unmultiplied([64, 32], &[255, 180, 60, 255].repeat(64 * 32)),
|
||||
TextureOptions::LINEAR,
|
||||
);
|
||||
let rect = Rect::from_min_size(Pos2::ZERO, Vec2::new(1931., 1087.));
|
||||
let output = ctx.run_ui(
|
||||
RawInput {
|
||||
screen_rect: Some(rect),
|
||||
..Default::default()
|
||||
},
|
||||
|ui| {
|
||||
deckstride::presenter_ui::paint_slide_zoomed(
|
||||
ui.painter(),
|
||||
rect,
|
||||
texture.id(),
|
||||
[64, 32],
|
||||
Default::default(),
|
||||
View {
|
||||
scale: 3.7,
|
||||
center: [0.4, 0.6],
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
let primitives = ctx.tessellate(output.shapes, output.pixels_per_point);
|
||||
assert_eq!(primitives.iter().filter(|p| matches!(&p.primitive, egui::epaint::Primitive::Mesh(m) if m.texture_id == texture.id())).count(),4);
|
||||
let mut pixels = vec![0u32; 1931 * 1087];
|
||||
EguiSoftwareRender::new(ColorFieldOrder::Bgra).render(
|
||||
&mut BufferMutRef::new(bytemuck::cast_slice_mut(&mut pixels), 1931, 1087),
|
||||
&primitives,
|
||||
&output.textures_delta,
|
||||
output.pixels_per_point,
|
||||
);
|
||||
for y in 62..1025 {
|
||||
for x in [50, 965, 1880] {
|
||||
assert_eq!(
|
||||
pixels[y * 1931 + x] & 0xffffff,
|
||||
0xffb43c,
|
||||
"band seam at {x},{y}"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn portrait_zoom_fills_screen_without_stretching_or_out_of_bounds_pixels() {
|
||||
use deckstride::presenter_ui::zoom_geometry;
|
||||
for size in [
|
||||
Vec2::new(1920., 1080.),
|
||||
Vec2::new(1080., 1920.),
|
||||
Vec2::new(640., 480.),
|
||||
] {
|
||||
let rect = Rect::from_min_size(Pos2::new(12., 18.), size);
|
||||
for dimensions in [[210, 297], [297, 210]] {
|
||||
let (fitted, _) = zoom_geometry(rect, dimensions, View::default(), false);
|
||||
for scale in [1., 1.5, 3., 8.] {
|
||||
for center in [[0.5; 2], [0.; 2], [1.; 2]] {
|
||||
let view = View { scale, center };
|
||||
let (target, uv) = zoom_geometry(rect, dimensions, view, false);
|
||||
assert!(rect.contains_rect(target));
|
||||
assert!(Rect::from_min_max(Pos2::ZERO, Pos2::new(1., 1.)).contains_rect(uv));
|
||||
let x_scale = target.width() / (uv.width() * dimensions[0] as f32);
|
||||
let y_scale = target.height() / (uv.height() * dimensions[1] as f32);
|
||||
assert!((x_scale - y_scale).abs() < 0.001, "page was stretched");
|
||||
if scale >= 3. {
|
||||
assert_eq!(target, rect);
|
||||
}
|
||||
assert_eq!(zoom_geometry(rect, dimensions, view, true).0, fitted);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn adapted_portrait_pixels_fill_padding_without_uploading_another_texture() {
|
||||
let ctx = Context::default();
|
||||
let texture = ctx.load_texture(
|
||||
"portrait",
|
||||
egui::ColorImage::filled([21, 30], egui::Color32::RED),
|
||||
TextureOptions::LINEAR,
|
||||
);
|
||||
let rect = Rect::from_min_size(Pos2::ZERO, Vec2::new(320., 180.));
|
||||
let mut renderer = EguiSoftwareRender::new(ColorFieldOrder::Bgra);
|
||||
let mut pixels = vec![0u32; 320 * 180];
|
||||
for (index, (scale, keep_fitted_area)) in [(1., false), (3., false), (3., true)]
|
||||
.into_iter()
|
||||
.enumerate()
|
||||
{
|
||||
let output = ctx.run_ui(
|
||||
RawInput {
|
||||
screen_rect: Some(rect),
|
||||
..Default::default()
|
||||
},
|
||||
|ui| {
|
||||
deckstride::presenter_ui::paint_slide_adapted(
|
||||
ui.painter(),
|
||||
rect,
|
||||
texture.id(),
|
||||
[21, 30],
|
||||
Default::default(),
|
||||
Sync {
|
||||
enabled: true,
|
||||
keep_fitted_area,
|
||||
view: View {
|
||||
scale,
|
||||
center: [0.5; 2],
|
||||
},
|
||||
..Default::default()
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
if index > 0 {
|
||||
assert!(output.textures_delta.set.is_empty());
|
||||
}
|
||||
let primitives = ctx.tessellate(output.shapes, output.pixels_per_point);
|
||||
renderer.render(
|
||||
&mut BufferMutRef::new(bytemuck::cast_slice_mut(&mut pixels), 320, 180),
|
||||
&primitives,
|
||||
&output.textures_delta,
|
||||
output.pixels_per_point,
|
||||
);
|
||||
let edge = pixels[90 * 320 + 4] & 0xffffff;
|
||||
let center = pixels[90 * 320 + 160] & 0xffffff;
|
||||
if index == 1 {
|
||||
assert_eq!(edge, center);
|
||||
} else {
|
||||
assert_ne!(edge, center);
|
||||
}
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn portrait_screen_adapting_gestures_pan_visible_area_and_reset() {
|
||||
let ctx = Context::default();
|
||||
let target = Rect::from_min_max(Pos2::new(40., 40.), Pos2::new(440., 240.));
|
||||
let mut view = View::default();
|
||||
let mut time = 0.;
|
||||
let mut render = |events: Vec<egui::Event>| {
|
||||
time += 0.04;
|
||||
let _ = ctx.run_ui(
|
||||
RawInput {
|
||||
screen_rect: Some(Rect::from_min_size(Pos2::ZERO, Vec2::new(500., 300.))),
|
||||
events,
|
||||
time: Some(time),
|
||||
..Default::default()
|
||||
},
|
||||
|ui| {
|
||||
view =
|
||||
deckstride::presenter_ui::zoom_gestures_in(ui, target, [210, 297], view, false)
|
||||
.0;
|
||||
},
|
||||
);
|
||||
view
|
||||
};
|
||||
let center = target.center();
|
||||
render(vec![egui::Event::PointerMoved(center)]);
|
||||
render(vec![egui::Event::MouseWheel {
|
||||
unit: egui::MouseWheelUnit::Point,
|
||||
phase: egui::TouchPhase::Move,
|
||||
delta: Vec2::new(0., 300.),
|
||||
modifiers: egui::Modifiers::NONE,
|
||||
}]);
|
||||
let mut zoom = View::default();
|
||||
for _ in 0..30 {
|
||||
zoom = render(vec![]);
|
||||
}
|
||||
assert!(zoom.scale > 1.2);
|
||||
let click = |pos, pressed| egui::Event::PointerButton {
|
||||
pos,
|
||||
button: egui::PointerButton::Primary,
|
||||
pressed,
|
||||
modifiers: egui::Modifiers::NONE,
|
||||
};
|
||||
render(vec![click(center, true)]);
|
||||
let moved = center + Vec2::new(40., 10.);
|
||||
let panned = render(vec![egui::Event::PointerMoved(moved)]);
|
||||
assert!(panned.center[1] < zoom.center[1]);
|
||||
assert_eq!(
|
||||
panned.center[0], 0.5,
|
||||
"page width still fits; horizontal panning should stop"
|
||||
);
|
||||
render(vec![click(moved, false)]);
|
||||
for _ in 0..20 {
|
||||
render(vec![]);
|
||||
}
|
||||
for _ in 0..2 {
|
||||
render(vec![click(moved, true)]);
|
||||
zoom = render(vec![click(moved, false)]);
|
||||
}
|
||||
assert_eq!(zoom, View::default());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn double_click_fits_width_near_target_then_resets_without_stretching() {
|
||||
use deckstride::presenter_ui::{zoom_geometry, zoom_gestures_in};
|
||||
for (dimensions, expected) in [([210, 297], 2.8285716), ([400, 100], 1.), ([10, 1000], 8.)] {
|
||||
let ctx = Context::default();
|
||||
let target = Rect::from_min_size(Pos2::new(40., 40.), Vec2::new(400., 200.));
|
||||
let page = deckstride::presenter_ui::fitted_slide(target, dimensions);
|
||||
let click_position = Pos2::new(page.center().x, page.top() + page.height() * 0.95);
|
||||
let mut view = View::default();
|
||||
let mut time = 0.;
|
||||
let mut render = |events| {
|
||||
time += 0.04;
|
||||
let _ = ctx.run_ui(
|
||||
RawInput {
|
||||
screen_rect: Some(Rect::from_min_size(Pos2::ZERO, Vec2::new(500., 300.))),
|
||||
events,
|
||||
time: Some(time),
|
||||
..Default::default()
|
||||
},
|
||||
|ui| {
|
||||
view = zoom_gestures_in(ui, target, dimensions, view, false).0;
|
||||
},
|
||||
);
|
||||
view
|
||||
};
|
||||
render(vec![egui::Event::PointerMoved(click_position)]);
|
||||
for (index, expected_scale) in [expected, 1.].into_iter().enumerate() {
|
||||
for _ in 0..20 {
|
||||
render(vec![]);
|
||||
}
|
||||
let mut actual = View::default();
|
||||
for _ in 0..2 {
|
||||
for pressed in [true, false] {
|
||||
actual = render(vec![egui::Event::PointerButton {
|
||||
pos: click_position,
|
||||
button: egui::PointerButton::Primary,
|
||||
pressed,
|
||||
modifiers: Default::default(),
|
||||
}]);
|
||||
}
|
||||
}
|
||||
assert!((actual.scale - expected_scale).abs() < 0.0001);
|
||||
if index == 0 && expected_scale > 1. {
|
||||
let (_, uv) = zoom_geometry(target, dimensions, actual, false);
|
||||
let expected_y = 0.95_f32.min(1. - uv.height() * 0.5);
|
||||
assert!((actual.center[1] - expected_y).abs() < 0.0001);
|
||||
assert_eq!(actual.center[0], 0.5);
|
||||
} else {
|
||||
assert_eq!(actual.center, [0.5; 2]);
|
||||
}
|
||||
if actual.scale > 1. && actual.scale < 8. {
|
||||
let (draw, uv) = zoom_geometry(target, dimensions, actual, false);
|
||||
assert!((draw.width() - target.width()).abs() < 0.001);
|
||||
assert!(
|
||||
(uv.width() - 1.).abs() < 0.001,
|
||||
"fit width must show the entire page width"
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fit_width_uses_output_shape_even_with_a_narrow_presenter_pane() {
|
||||
use deckstride::presenter_ui::{fitted_slide, zoom_geometry};
|
||||
let output = Rect::from_min_size(Pos2::ZERO, Vec2::new(1920., 1080.));
|
||||
let pane = Rect::from_min_size(Pos2::ZERO, Vec2::new(300., 600.));
|
||||
let preview = fitted_slide(pane, [1920, 1080]);
|
||||
let scale = preview.width() / fitted_slide(preview, [210, 297]).width();
|
||||
let view = View {
|
||||
scale,
|
||||
center: [0.5; 2],
|
||||
};
|
||||
let (preview_draw, preview_uv) = zoom_geometry(preview, [210, 297], view, false);
|
||||
let (output_draw, output_uv) = zoom_geometry(output, [210, 297], view, false);
|
||||
assert!((preview_draw.width() - preview.width()).abs() < 0.001);
|
||||
assert!(
|
||||
(output_draw.width() - output.width()).abs() < 0.001,
|
||||
"output retained side borders"
|
||||
);
|
||||
assert!((preview_uv.min - output_uv.min).length() < 0.0001);
|
||||
assert!((preview_uv.max - output_uv.max).length() < 0.0001);
|
||||
}
|
||||
|
|
@ -1,148 +0,0 @@
|
|||
//! Interface catalog; diagnostic messages from workers remain in their original language.
|
||||
use serde::{Deserialize, Serialize};
|
||||
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum Language {
|
||||
#[default]
|
||||
System,
|
||||
En,
|
||||
Fr,
|
||||
}
|
||||
impl Language {
|
||||
pub const ALL: [Self; 3] = [Self::System, Self::En, Self::Fr];
|
||||
pub fn name(self) -> &'static str {
|
||||
match self {
|
||||
Self::System => "System / Système",
|
||||
Self::En => "English",
|
||||
Self::Fr => "Français",
|
||||
}
|
||||
}
|
||||
pub fn french(self) -> bool {
|
||||
match self {
|
||||
Self::Fr => true,
|
||||
Self::En => false,
|
||||
Self::System => system_french(),
|
||||
}
|
||||
}
|
||||
}
|
||||
fn system_french() -> bool {
|
||||
static FRENCH: std::sync::OnceLock<bool> = std::sync::OnceLock::new();
|
||||
*FRENCH.get_or_init(|| {
|
||||
sys_locale::get_locale().is_some_and(|s| s.to_ascii_lowercase().starts_with("fr"))
|
||||
})
|
||||
}
|
||||
pub fn apply(ctx: &egui::Context, language: &Language) {
|
||||
ctx.data_mut(|d| d.insert_temp(egui::Id::new("french"), language.french()));
|
||||
}
|
||||
pub fn tr<'a>(ctx: &egui::Context, text: &'a str) -> &'a str {
|
||||
if !ctx.data(|d| d.get_temp::<bool>(egui::Id::new("french")).unwrap_or(false)) {
|
||||
return text;
|
||||
}
|
||||
match text {
|
||||
"File chooser already open" => "Sélecteur de fichiers déjà ouvert",
|
||||
"Page background" => "Fond de page",
|
||||
"Fit padding color" => "Couleur des marges",
|
||||
"Page background fills transparency; fit padding fills space around the slide." => {
|
||||
"Le fond de page remplit les zones transparentes ; les marges remplissent l’espace autour de la diapositive."
|
||||
}
|
||||
"Appearance" => "Apparence",
|
||||
"Preferences" => "Préférences",
|
||||
"Storage locations" => "Emplacements de stockage",
|
||||
"Preparing slide…" => "Préparation de la diapositive…",
|
||||
"No slide" => "Aucune diapositive",
|
||||
"End of slides" => "Fin des diapositives",
|
||||
"Size" => "Taille",
|
||||
"Keep header visible" => "Garder l’en-tête visible",
|
||||
"Keep footer visible" => "Garder le pied de page visible",
|
||||
"Show both" => "Afficher les deux",
|
||||
"Layout…" => "Disposition…",
|
||||
"PREVIOUS" => "PRÉCÉDENTE",
|
||||
"CURRENT" => "ACTUELLE",
|
||||
"NEXT" => "SUIVANTE",
|
||||
"PRESENTER NOTES · AUTO-FIT" => "NOTES · TAILLE AUTOMATIQUE",
|
||||
"No notes for this slide" => "Aucune note pour cette diapositive",
|
||||
"Header" => "En-tête",
|
||||
"Above slides" => "Au-dessus des diapositives",
|
||||
"Below notes" => "Sous les notes",
|
||||
"Elapsed time position" => "Position du temps écoulé",
|
||||
"Clock position" => "Position de l’horloge",
|
||||
"Slide progress bar" => "Barre de progression des diapositives",
|
||||
"Slide" => "Diapositive",
|
||||
"Hide" => "Masquer",
|
||||
"Pin" => "Épingler",
|
||||
"Menu" => "Menu",
|
||||
"Displays" => "Écrans",
|
||||
"All slides" => "Toutes les diapositives",
|
||||
"Layout" => "Disposition",
|
||||
"Show presentation" => "Afficher la présentation",
|
||||
"Blank presentation" => "Masquer la présentation",
|
||||
"Previous" => "Précédente",
|
||||
"Next" => "Suivante",
|
||||
"NO OUTPUT DISPLAYED" => "AUCUNE SORTIE AFFICHÉE",
|
||||
"PRESENTING" => "EN DIFFUSION",
|
||||
"PREPARING OUTPUT" => "PRÉPARATION DE LA SORTIE",
|
||||
"Your presenter view" => "Votre vue présentateur",
|
||||
"Balanced" => "Équilibrée",
|
||||
"Slide focus" => "Diapositive seule",
|
||||
"Notes first" => "Priorité aux notes",
|
||||
"Hidden bars reveal near edges. Right-click to restore." => {
|
||||
"Approchez des bords pour voir les barres. Clic droit pour les rétablir."
|
||||
}
|
||||
"Previous slide" => "Diapositive précédente",
|
||||
"Current slide" => "Diapositive actuelle",
|
||||
"Next slide" => "Diapositive suivante",
|
||||
"Notes" => "Notes",
|
||||
"Elapsed time" => "Temps écoulé",
|
||||
"Time · HH:MM" => "Heure · HH:MM",
|
||||
"Save layout · This project" => "Enregistrer · Ce projet",
|
||||
"Save layout · All projects" => "Enregistrer · Tous les projets",
|
||||
"Use all-projects default" => "Utiliser la disposition globale",
|
||||
"Project layouts override the default." => {
|
||||
"La disposition du projet prime sur la disposition globale."
|
||||
}
|
||||
"Each screen has one role; repeat a role to mirror it." => {
|
||||
"Un rôle par écran. Répétez un rôle pour le dupliquer."
|
||||
}
|
||||
"Unused" => "Inutilisé",
|
||||
"Presenter" => "Présentateur",
|
||||
"Presentation" => "Présentation",
|
||||
"Swap groups" => "Inverser les groupes",
|
||||
"Window positioning can be unreliable in windowed mode, especially on Linux. Switch back to fullscreen if you experience positioning issues." => {
|
||||
"Le positionnement des fenêtres peut être peu fiable en mode fenêtré, surtout sous Linux. Revenez au plein écran si vous rencontrez des problèmes de positionnement."
|
||||
}
|
||||
"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."
|
||||
}
|
||||
"Open a PDF or picture folder to browse slides." => {
|
||||
"Ouvrez un PDF ou un dossier d’images pour parcourir les diapositives."
|
||||
}
|
||||
"Close" => "Fermer",
|
||||
"Preview size" => "Taille des aperçus",
|
||||
"Change on click" => "Diffuser au clic",
|
||||
"Presenter screen" => "Écran du présentateur",
|
||||
"Show selected" => "Diffuser la sélection",
|
||||
"Click changes presentation" => "Le clic change la présentation",
|
||||
"Click only selects — browse safely" => "Le clic sélectionne sans diffuser",
|
||||
" · CURRENT" => " · ACTUELLE",
|
||||
"Open PDF…" => "Ouvrir un PDF…",
|
||||
"Open picture folder…" => "Ouvrir un dossier d’images…",
|
||||
"Reset timer" => "Réinitialiser le chronomètre",
|
||||
"Leave fullscreen / safe blank" => "Quitter le plein écran et masquer la sortie",
|
||||
"RAM budget per process (presenter + output each use this allowance):" => {
|
||||
"Budget RAM par processus (présentateur et sortie disposent chacun de ce budget) :"
|
||||
}
|
||||
"Raise only within available RAM; OS paging can cause delays. Screen rendering is capped at 4096 px." => {
|
||||
"Restez dans la RAM disponible : la mémoire virtuelle peut ralentir l’affichage. Rendu limité à 4096 px."
|
||||
}
|
||||
"Show presentation automatically when opening a document" => {
|
||||
"Afficher automatiquement la présentation à l’ouverture d’un document"
|
||||
}
|
||||
"Quit" => "Quitter",
|
||||
"Theme" => "Thème",
|
||||
"Language" => "Langue",
|
||||
_ => text,
|
||||
}
|
||||
}
|
||||
|
|
@ -1,293 +0,0 @@
|
|||
//! Versioned per-user settings and deterministic monitor/layout recovery.
|
||||
use serde::{Deserialize, Serialize};
|
||||
use sha2::{Digest, Sha256};
|
||||
use std::{
|
||||
collections::BTreeMap,
|
||||
path::{Path, PathBuf},
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
pub struct Widget {
|
||||
pub show: bool,
|
||||
pub size: f32,
|
||||
}
|
||||
/// Fixed presenter-only timer locations; body rows remain visible with hidden bars.
|
||||
#[derive(Clone, Copy, Debug, Default, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
pub enum TimerPosition {
|
||||
#[default]
|
||||
Header,
|
||||
AboveSlides,
|
||||
BelowNotes,
|
||||
}
|
||||
impl TimerPosition {
|
||||
pub const ALL: [Self; 3] = [Self::Header, Self::AboveSlides, Self::BelowNotes];
|
||||
pub fn label(self) -> &'static str {
|
||||
match self {
|
||||
Self::Header => "Header",
|
||||
Self::AboveSlides => "Above slides",
|
||||
Self::BelowNotes => "Below notes",
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(default)]
|
||||
pub struct Layout {
|
||||
pub previous: Widget,
|
||||
pub current: Widget,
|
||||
pub next: Widget,
|
||||
pub notes: Widget,
|
||||
pub elapsed: Widget,
|
||||
pub clock: Widget,
|
||||
pub elapsed_position: TimerPosition,
|
||||
pub clock_position: TimerPosition,
|
||||
pub slide_progress: bool,
|
||||
pub header: bool,
|
||||
pub footer: bool,
|
||||
}
|
||||
impl Default for Layout {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
previous: Widget {
|
||||
show: true,
|
||||
size: 60.,
|
||||
},
|
||||
current: Widget {
|
||||
show: true,
|
||||
size: 130.,
|
||||
},
|
||||
next: Widget {
|
||||
show: true,
|
||||
size: 75.,
|
||||
},
|
||||
notes: Widget {
|
||||
show: true,
|
||||
size: 28.,
|
||||
},
|
||||
elapsed: Widget {
|
||||
show: true,
|
||||
size: 28.,
|
||||
},
|
||||
clock: Widget {
|
||||
show: true,
|
||||
size: 28.,
|
||||
},
|
||||
elapsed_position: TimerPosition::Header,
|
||||
clock_position: TimerPosition::Header,
|
||||
slide_progress: false,
|
||||
header: true,
|
||||
footer: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
impl Layout {
|
||||
pub fn validate(&self) -> Result<(), String> {
|
||||
for (w, min, max) in [
|
||||
(&self.previous, 30., 160.),
|
||||
(&self.current, 60., 200.),
|
||||
(&self.next, 30., 160.),
|
||||
(&self.notes, 12., 65.),
|
||||
(&self.elapsed, 16., 72.),
|
||||
(&self.clock, 16., 72.),
|
||||
] {
|
||||
if !w.size.is_finite() || w.size < min || w.size > max {
|
||||
return Err("Invalid layout size".into());
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, PartialEq)]
|
||||
#[serde(default)]
|
||||
pub struct Routes {
|
||||
pub presenter: Vec<String>,
|
||||
pub presentation: Vec<String>,
|
||||
}
|
||||
impl Routes {
|
||||
pub fn resolve(&self, available: &[String], primary: usize) -> Self {
|
||||
if available.is_empty() {
|
||||
return Self::default();
|
||||
}
|
||||
let mut presenter: Vec<_> = self
|
||||
.presenter
|
||||
.iter()
|
||||
.filter(|id| available.contains(id))
|
||||
.cloned()
|
||||
.collect();
|
||||
if presenter.is_empty() {
|
||||
presenter.push(available[primary.min(available.len() - 1)].clone());
|
||||
}
|
||||
let mut presentation: Vec<_> = self
|
||||
.presentation
|
||||
.iter()
|
||||
.filter(|id| available.contains(id) && !presenter.contains(id))
|
||||
.cloned()
|
||||
.collect();
|
||||
if presentation.is_empty()
|
||||
&& (!self.presentation.is_empty() || self.presenter.is_empty())
|
||||
&& let Some(id) = available.iter().find(|id| !presenter.contains(id))
|
||||
{
|
||||
presentation.push(id.clone());
|
||||
}
|
||||
Self {
|
||||
presenter,
|
||||
presentation,
|
||||
}
|
||||
}
|
||||
pub fn validate(&self) -> Result<(), String> {
|
||||
if self.presenter.len() + self.presentation.len() > 32
|
||||
|| self.presenter.iter().any(|p| self.presentation.contains(p))
|
||||
{
|
||||
return Err("Invalid screen roles".into());
|
||||
}
|
||||
for group in [&self.presenter, &self.presentation] {
|
||||
let mut unique = group.clone();
|
||||
unique.sort();
|
||||
unique.dedup();
|
||||
if unique.len() != group.len() {
|
||||
return Err("Duplicate screen assignment".into());
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
/// Opaque display colors; cached slide pixels retain their original transparency.
|
||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize, PartialEq, Eq)]
|
||||
#[serde(default)]
|
||||
pub struct SlideColors {
|
||||
#[serde(deserialize_with = "read_rgb")]
|
||||
pub page_background: [u8; 3],
|
||||
#[serde(deserialize_with = "read_rgb")]
|
||||
pub fit_padding: [u8; 3],
|
||||
}
|
||||
fn read_rgb<'de, D: serde::Deserializer<'de>>(deserializer: D) -> Result<[u8; 3], D::Error> {
|
||||
let channels = Vec::<u8>::deserialize(deserializer)?;
|
||||
channels
|
||||
.try_into()
|
||||
.map_err(|_| serde::de::Error::custom("RGB colors require exactly three channels"))
|
||||
}
|
||||
impl Default for SlideColors {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
page_background: [255; 3],
|
||||
fit_padding: [0; 3],
|
||||
}
|
||||
}
|
||||
}
|
||||
#[derive(Clone, Debug, Serialize, Deserialize)]
|
||||
#[serde(default)]
|
||||
pub struct Settings {
|
||||
pub version: u32,
|
||||
pub slide_colors: SlideColors,
|
||||
pub layout: Layout,
|
||||
pub projects: BTreeMap<String, Layout>,
|
||||
pub routes: Routes,
|
||||
pub presenter_fullscreen: bool,
|
||||
pub presentation_fullscreen: bool,
|
||||
pub browser_monitor: Option<String>,
|
||||
pub thumbnail_size: f32,
|
||||
pub buffer_mib: u32,
|
||||
pub auto_show: bool,
|
||||
pub theme: crate::theme::Theme,
|
||||
pub language: crate::localization::Language,
|
||||
}
|
||||
impl Default for Settings {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
version: 1,
|
||||
slide_colors: SlideColors::default(),
|
||||
layout: Layout::default(),
|
||||
projects: BTreeMap::new(),
|
||||
routes: Routes::default(),
|
||||
presenter_fullscreen: true,
|
||||
presentation_fullscreen: true,
|
||||
browser_monitor: None,
|
||||
thumbnail_size: 220.,
|
||||
buffer_mib: 1024,
|
||||
auto_show: true,
|
||||
theme: Default::default(),
|
||||
language: Default::default(),
|
||||
}
|
||||
}
|
||||
}
|
||||
impl Settings {
|
||||
pub fn validate(&self) -> Result<(), String> {
|
||||
if self.version != 1 {
|
||||
return Err(format!("Unsupported settings version {}", self.version));
|
||||
}
|
||||
if !(256..=16384).contains(&self.buffer_mib) {
|
||||
return Err("RAM buffer must be 256–16384 MiB per process".into());
|
||||
}
|
||||
if self.projects.len() > 4096 || !(100. ..=400.).contains(&self.thumbnail_size) {
|
||||
return Err("Invalid settings limits".into());
|
||||
}
|
||||
self.routes.validate()?;
|
||||
self.layout.validate()?;
|
||||
for layout in self.projects.values() {
|
||||
layout.validate()?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
pub fn for_project(&self, key: &str) -> Layout {
|
||||
self.projects.get(key).unwrap_or(&self.layout).clone()
|
||||
}
|
||||
}
|
||||
pub fn paths() -> Result<(PathBuf, PathBuf), String> {
|
||||
let dirs = directories::ProjectDirs::from("com", "Beffroi", "PdfPresenter")
|
||||
.ok_or("No user configuration directory")?;
|
||||
#[cfg(target_os = "linux")]
|
||||
let config = directories::BaseDirs::new()
|
||||
.ok_or("No user configuration directory")?
|
||||
.config_dir()
|
||||
.join("pdf-presenter");
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
let config = dirs.config_dir().to_path_buf();
|
||||
Ok((
|
||||
config.join("settings.toml"),
|
||||
dirs.cache_dir().join("slides-v1"),
|
||||
))
|
||||
}
|
||||
pub fn read(path: &Path) -> Result<Settings, String> {
|
||||
match std::fs::File::open(path) {
|
||||
Ok(file) => {
|
||||
use std::io::Read;
|
||||
let mut bytes = Vec::new();
|
||||
file.take(4 * 1024 * 1024 + 1)
|
||||
.read_to_end(&mut bytes)
|
||||
.map_err(|e| e.to_string())?;
|
||||
if bytes.len() > 4 * 1024 * 1024 {
|
||||
return Err("Settings exceed 4 MiB".into());
|
||||
}
|
||||
let value: Settings =
|
||||
toml::from_str(std::str::from_utf8(&bytes).map_err(|e| e.to_string())?)
|
||||
.map_err(|e| e.to_string())?;
|
||||
value.validate()?;
|
||||
Ok(value)
|
||||
}
|
||||
Err(e) if e.kind() == std::io::ErrorKind::NotFound => Ok(Settings::default()),
|
||||
Err(e) => Err(e.to_string()),
|
||||
}
|
||||
}
|
||||
pub fn write(path: &Path, settings: &Settings) -> Result<(), String> {
|
||||
settings.validate()?;
|
||||
atomic_write(
|
||||
path,
|
||||
toml::to_string_pretty(settings)
|
||||
.map_err(|e| e.to_string())?
|
||||
.as_bytes(),
|
||||
)
|
||||
}
|
||||
pub fn atomic_write(path: &Path, bytes: &[u8]) -> Result<(), String> {
|
||||
use std::io::Write;
|
||||
let dir = path.parent().ok_or("No parent directory")?;
|
||||
std::fs::create_dir_all(dir).map_err(|e| e.to_string())?;
|
||||
let mut file = tempfile::NamedTempFile::new_in(dir).map_err(|e| e.to_string())?;
|
||||
file.write_all(bytes)
|
||||
.and_then(|_| file.as_file().sync_all())
|
||||
.map_err(|e| e.to_string())?;
|
||||
file.persist(path).map_err(|e| e.to_string())?;
|
||||
Ok(())
|
||||
}
|
||||
pub fn project_key(path: &Path) -> String {
|
||||
format!("{:x}", Sha256::digest(path.as_os_str().as_encoded_bytes()))
|
||||
}
|
||||
|
|
@ -1,659 +0,0 @@
|
|||
use egui::{Context, Pos2, RawInput, Rect, Vec2};
|
||||
use pdf_presenter::{
|
||||
document::{DeckInfo, Frame, FrameInfo},
|
||||
presenter_ui::{self, UiState},
|
||||
studio::{Action, Monitor, Studio},
|
||||
};
|
||||
use std::{collections::HashMap, sync::Arc};
|
||||
fn studio() -> Studio {
|
||||
let mut s = Studio::new(true, None);
|
||||
s.initialized = true;
|
||||
s.deck = Some(DeckInfo {
|
||||
path: "demo.pdf".into(),
|
||||
key: "demo".into(),
|
||||
title: "Demo".into(),
|
||||
names: (1..=30).map(|i| format!("Slide {i}")).collect(),
|
||||
notes: vec!["A long note with unbrokenwordsandUnicodeé漢字. ".repeat(80); 30],
|
||||
warnings: vec![],
|
||||
sha256: "test".into(),
|
||||
});
|
||||
s.monitors = vec![
|
||||
Monitor {
|
||||
id: "one".into(),
|
||||
name: "Primary".into(),
|
||||
origin: (0, 0),
|
||||
size: (1920, 1080),
|
||||
},
|
||||
Monitor {
|
||||
id: "two".into(),
|
||||
name: "Secondary".into(),
|
||||
origin: (1920, 0),
|
||||
size: (1920, 1080),
|
||||
},
|
||||
];
|
||||
s.routes.presenter = vec!["one".into()];
|
||||
s.routes.presentation = vec!["two".into()];
|
||||
s.draft_routes = s.routes.clone();
|
||||
s.frames = HashMap::from([(
|
||||
(0, 1280),
|
||||
Arc::new(Frame {
|
||||
info: FrameInfo {
|
||||
page: 0,
|
||||
width: 64,
|
||||
height: 36,
|
||||
path: "cached.rgba".into(),
|
||||
sha256: "test".into(),
|
||||
},
|
||||
rgba: vec![255; 64 * 36 * 4],
|
||||
}),
|
||||
)]);
|
||||
s
|
||||
}
|
||||
fn input(size: Vec2) -> RawInput {
|
||||
RawInput {
|
||||
screen_rect: Some(Rect::from_min_size(Pos2::ZERO, size)),
|
||||
..Default::default()
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn native_ui_renders_real_previews_notes_and_all_control_panels() {
|
||||
let ctx = Context::default();
|
||||
presenter_ui::theme(&ctx);
|
||||
let mut s = studio();
|
||||
let mut ui = UiState::default();
|
||||
for size in [Vec2::new(1280., 900.), Vec2::new(800., 600.)] {
|
||||
for panel in 0..4 {
|
||||
s.menu_open = panel == 1;
|
||||
s.layout_open = panel == 2;
|
||||
s.displays_open = panel == 3;
|
||||
s.jump = "12".into();
|
||||
let output = ctx.run_ui(input(size), |root| {
|
||||
presenter_ui::presenter(root, &mut s, &mut ui)
|
||||
});
|
||||
assert!(!output.shapes.is_empty());
|
||||
assert!(
|
||||
!ctx.tessellate(output.shapes, output.pixels_per_point)
|
||||
.is_empty()
|
||||
);
|
||||
}
|
||||
}
|
||||
s.menu_open = false;
|
||||
s.layout_open = false;
|
||||
s.displays_open = false;
|
||||
s.layout.previous.show = false;
|
||||
s.layout.current.show = false;
|
||||
s.layout.next.show = false;
|
||||
s.layout.header = false;
|
||||
s.layout.footer = false;
|
||||
let output = ctx.run_ui(input(Vec2::new(1000., 700.)), |root| {
|
||||
presenter_ui::presenter(root, &mut s, &mut ui)
|
||||
});
|
||||
assert!(!output.shapes.is_empty());
|
||||
s.layout.notes.show = false;
|
||||
let output = ctx.run_ui(input(Vec2::new(1000., 700.)), |root| {
|
||||
presenter_ui::presenter(root, &mut s, &mut ui)
|
||||
});
|
||||
assert!(!output.shapes.is_empty());
|
||||
}
|
||||
#[test]
|
||||
fn browser_virtualizes_thumbnails_without_changing_presented_slide() {
|
||||
let ctx = Context::default();
|
||||
let mut s = studio();
|
||||
let mut ui = UiState::default();
|
||||
s.requested = 3;
|
||||
s.browser_selected = 8;
|
||||
s.deck.as_mut().unwrap().names = (0..1000).map(|i| format!("Slide {i}")).collect();
|
||||
for size in [100., 220., 400.] {
|
||||
s.settings.thumbnail_size = size;
|
||||
let output = ctx.run_ui(input(Vec2::new(900., 650.)), |root| {
|
||||
presenter_ui::browser(root, &mut s, &mut ui)
|
||||
});
|
||||
assert!(!output.shapes.is_empty());
|
||||
assert!(!s.visible_thumbs.is_empty());
|
||||
assert!(s.visible_thumbs.len() < 100);
|
||||
assert_eq!(s.requested, 3);
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn shared_actions_preserve_blanking_and_save_scope() {
|
||||
let mut s = studio();
|
||||
s.blanked = true;
|
||||
s.execute(Action::Go(5));
|
||||
assert_eq!(s.requested, 5);
|
||||
assert!(s.blanked);
|
||||
s.execute(Action::Go(99));
|
||||
assert_eq!(s.requested, 5);
|
||||
s.execute(Action::Blank);
|
||||
assert!(!s.blanked);
|
||||
s.layout.current.show = false;
|
||||
s.execute(Action::SaveProject);
|
||||
assert!(!s.settings.projects["demo"].current.show);
|
||||
s.execute(Action::SaveGlobal);
|
||||
assert!(!s.settings.layout.current.show);
|
||||
s.execute(Action::UseGlobal);
|
||||
assert!(!s.settings.projects.contains_key("demo"));
|
||||
s.execute(Action::OpenBrowser);
|
||||
assert_eq!(s.browser_selected, 5);
|
||||
assert!(!s.change_on_click);
|
||||
s.execute(Action::CloseBrowser);
|
||||
assert!(!s.browser_open);
|
||||
s.execute(Action::Windowed);
|
||||
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);
|
||||
s.execute(Action::Refresh);
|
||||
assert!(s.dirty_routes);
|
||||
s.execute(Action::Exit);
|
||||
assert!(s.close_requested);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn lost_operator_screen_never_becomes_notes_on_previous_public_output() {
|
||||
let mut s = studio();
|
||||
s.settings.routes = s.routes.clone();
|
||||
s.set_monitors(vec![s.monitors[1].clone()], 0);
|
||||
assert!(s.routes.presenter.is_empty());
|
||||
assert!(s.privacy_hold);
|
||||
assert!(s.blanked);
|
||||
let monitors = studio().monitors;
|
||||
s.set_monitors(monitors, 0);
|
||||
assert!(!s.privacy_hold);
|
||||
assert_eq!(s.routes.presenter, vec!["one"]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn palettes_and_languages_apply_to_presenter_browser_and_popups() {
|
||||
use pdf_presenter::{
|
||||
localization::{Language, apply, tr},
|
||||
theme::Theme,
|
||||
};
|
||||
let ctx = Context::default();
|
||||
let mut s = studio();
|
||||
let mut ui = UiState::default();
|
||||
for theme in Theme::ALL {
|
||||
theme.apply(&ctx);
|
||||
assert_eq!(
|
||||
ctx.global_style().visuals.text_color(),
|
||||
theme.palette().text
|
||||
);
|
||||
for language in Language::ALL {
|
||||
apply(&ctx, &language);
|
||||
if language == Language::Fr {
|
||||
assert_eq!(tr(&ctx, "Displays"), "Écrans");
|
||||
}
|
||||
s.menu_open = true;
|
||||
s.displays_open = true;
|
||||
s.layout_open = true;
|
||||
let output = ctx.run_ui(input(Vec2::new(1400., 1000.)), |root| {
|
||||
presenter_ui::presenter(root, &mut s, &mut ui)
|
||||
});
|
||||
assert!(!output.shapes.is_empty());
|
||||
let output = ctx.run_ui(input(Vec2::new(1000., 700.)), |root| {
|
||||
presenter_ui::browser(root, &mut s, &mut ui)
|
||||
});
|
||||
assert!(!output.shapes.is_empty());
|
||||
}
|
||||
}
|
||||
}
|
||||
#[test]
|
||||
fn startup_output_is_enabled_but_disconnect_still_blanks() {
|
||||
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);
|
||||
let mut opt_out = Studio::new(true, None);
|
||||
opt_out.settings.auto_show = false;
|
||||
opt_out.set_monitors(monitors, 0);
|
||||
assert!(opt_out.blanked);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn header_click_opens_slide_browser_and_menu_dropdown() {
|
||||
fn text_position(shapes: &[egui::epaint::ClippedShape], label: &str) -> Pos2 {
|
||||
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,
|
||||
}
|
||||
}
|
||||
shapes.iter().find_map(|s| find(&s.shape, label)).unwrap()
|
||||
}
|
||||
let ctx = Context::default();
|
||||
let mut s = studio();
|
||||
let mut native = UiState::default();
|
||||
let size = Vec2::new(1920., 1080.);
|
||||
for label in ["All slides", "Menu"] {
|
||||
let mut output = ctx.run_ui(input(size), |ui| {
|
||||
presenter_ui::presenter(ui, &mut s, &mut native)
|
||||
});
|
||||
for _ in 0..2 {
|
||||
output = ctx.run_ui(input(size), |ui| {
|
||||
presenter_ui::presenter(ui, &mut s, &mut native)
|
||||
});
|
||||
}
|
||||
let pos = text_position(&output.shapes, label);
|
||||
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, &mut native));
|
||||
}
|
||||
if label == "All slides" {
|
||||
assert!(
|
||||
s.actions.iter().any(|a| matches!(a, Action::OpenBrowser)),
|
||||
"All slides click at {pos:?} must dispatch an action"
|
||||
);
|
||||
} else {
|
||||
assert!(s.menu_open, "Menu click must open the anchored dropdown");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn display_changes_require_confirmation_and_timeout_restores_previous_setup() {
|
||||
let mut s = studio();
|
||||
s.settings.routes = s.routes.clone();
|
||||
let original = s.routes.clone();
|
||||
s.begin_display_edit();
|
||||
s.draft_presenter_fullscreen = false;
|
||||
s.draft_presentation_fullscreen = false;
|
||||
std::mem::swap(
|
||||
&mut s.draft_routes.presenter,
|
||||
&mut s.draft_routes.presentation,
|
||||
);
|
||||
s.execute(Action::ApplyRoutes);
|
||||
assert_ne!(s.routes, original);
|
||||
assert_eq!(s.settings.routes, original);
|
||||
assert!(s.settings.presenter_fullscreen);
|
||||
assert!(!s.presenter_fullscreen());
|
||||
assert!(s.blanked);
|
||||
s.execute(Action::Blank);
|
||||
s.execute(Action::Go(5));
|
||||
assert!(s.blanked);
|
||||
assert_eq!(s.requested, 0);
|
||||
// Render the modal even with the ordinary bars hidden.
|
||||
s.layout.header = false;
|
||||
s.layout.footer = false;
|
||||
let ctx = Context::default();
|
||||
let _ = ctx.run_ui(input(Vec2::new(1280., 720.)), |ui| {
|
||||
presenter_ui::presenter(ui, &mut s, &mut UiState::default())
|
||||
});
|
||||
s.route_trial.as_mut().unwrap().deadline = std::time::Instant::now();
|
||||
s.poll();
|
||||
assert!(s.route_trial.is_none());
|
||||
assert_eq!(s.routes, original);
|
||||
assert_eq!(s.settings.routes, original);
|
||||
assert!(s.presenter_fullscreen());
|
||||
assert!(s.blanked);
|
||||
s.execute(Action::RevertRoutes); // Idempotent recovery.
|
||||
assert_eq!(s.routes, original);
|
||||
s.begin_display_edit();
|
||||
s.draft_presenter_fullscreen = false;
|
||||
s.draft_presentation_fullscreen = false;
|
||||
s.execute(Action::ApplyRoutes);
|
||||
s.execute(Action::KeepRoutes);
|
||||
assert!(!s.settings.presenter_fullscreen);
|
||||
assert!(!s.settings.presentation_fullscreen);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn recovery_commands_are_scoped_to_the_current_trial_and_startup() {
|
||||
use pdf_presenter::output::DisplayAction;
|
||||
let mut s = studio();
|
||||
s.settings.routes = s.routes.clone();
|
||||
let original = s.routes.clone();
|
||||
s.display_control(DisplayAction::Swap, None);
|
||||
let old_id = s.route_trial.as_ref().unwrap().id;
|
||||
s.display_control(DisplayAction::Keep, Some(old_id + 1));
|
||||
assert!(s.route_trial.is_some());
|
||||
assert_eq!(s.settings.routes, original);
|
||||
s.display_control(DisplayAction::Revert, Some(old_id));
|
||||
assert_eq!(s.routes, original);
|
||||
s.display_control(DisplayAction::Swap, None);
|
||||
let new_id = s.route_trial.as_ref().unwrap().id;
|
||||
assert_ne!(new_id, old_id);
|
||||
s.display_control(DisplayAction::Keep, Some(old_id));
|
||||
assert!(s.route_trial.is_some());
|
||||
s.display_control(DisplayAction::Keep, Some(new_id));
|
||||
assert!(s.route_trial.is_none());
|
||||
assert_eq!(s.settings.routes, s.routes);
|
||||
assert_ne!(s.routes, original);
|
||||
s.execute(Action::Go(0));
|
||||
let confirmed = s.routes.clone();
|
||||
s.display_control(DisplayAction::Swap, None);
|
||||
assert!(s.route_trial.is_none());
|
||||
assert_eq!(s.routes, confirmed);
|
||||
// Explicit display editing remains available after startup.
|
||||
s.begin_display_edit();
|
||||
s.draft_routes = original;
|
||||
s.execute(Action::ApplyRoutes);
|
||||
s.route_trial.as_mut().unwrap().deadline = std::time::Instant::now();
|
||||
s.execute(Action::KeepRoutes); // A late click must revert, never save.
|
||||
assert!(s.route_trial.is_none());
|
||||
assert_eq!(s.settings.routes, confirmed);
|
||||
assert_eq!(s.routes, confirmed);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hotplug_cancels_a_display_trial_without_saving_the_proposal() {
|
||||
let mut s = studio();
|
||||
s.settings.routes = s.routes.clone();
|
||||
let saved = s.settings.routes.clone();
|
||||
s.execute(Action::SwapRoutes);
|
||||
assert!(s.route_trial.is_some());
|
||||
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.routes.presentation.contains(&"two".to_owned()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn output_recovery_buttons_dispatch_without_presenter_data() {
|
||||
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 (label, trial) in [
|
||||
("Keep changes", true),
|
||||
("Revert now", true),
|
||||
("Swap presenter and presentation displays…", false),
|
||||
] {
|
||||
let ctx = Context::default();
|
||||
let size = Vec2::new(1280., 720.);
|
||||
let mut action = None;
|
||||
let mut output = ctx.run_ui(input(size), |ui| {
|
||||
action = presenter_ui::output_display_recovery(ui, true, trial);
|
||||
});
|
||||
if !trial {
|
||||
for pressed in [true, false] {
|
||||
let pos = Pos2::new(300., 300.);
|
||||
let mut raw = input(size);
|
||||
raw.events = vec![
|
||||
egui::Event::PointerMoved(pos),
|
||||
egui::Event::PointerButton {
|
||||
pos,
|
||||
button: egui::PointerButton::Secondary,
|
||||
pressed,
|
||||
modifiers: Default::default(),
|
||||
},
|
||||
];
|
||||
output = ctx.run_ui(raw, |ui| {
|
||||
action = presenter_ui::output_display_recovery(ui, true, false);
|
||||
});
|
||||
}
|
||||
}
|
||||
for _ in 0..3 {
|
||||
output = ctx.run_ui(input(size), |ui| {
|
||||
action = presenter_ui::output_display_recovery(ui, true, trial);
|
||||
});
|
||||
}
|
||||
let pos = output
|
||||
.shapes
|
||||
.iter()
|
||||
.find_map(|s| find(&s.shape, label))
|
||||
.expect(label);
|
||||
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| {
|
||||
action = presenter_ui::output_display_recovery(ui, true, trial);
|
||||
});
|
||||
}
|
||||
use pdf_presenter::output::DisplayAction;
|
||||
assert!(matches!(
|
||||
(label, action),
|
||||
("Keep changes", Some(DisplayAction::Keep))
|
||||
| ("Revert now", Some(DisplayAction::Revert))
|
||||
| (
|
||||
"Swap presenter and presentation displays…",
|
||||
Some(DisplayAction::Swap)
|
||||
)
|
||||
));
|
||||
let output = ctx.run_ui(input(size), |ui| {
|
||||
action = presenter_ui::output_display_recovery(ui, false, false);
|
||||
});
|
||||
assert!(action.is_none());
|
||||
assert!(
|
||||
output
|
||||
.shapes
|
||||
.iter()
|
||||
.all(|s| find(&s.shape, label).is_none())
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn nested_settings_remain_interactive_and_menu_still_dismisses() {
|
||||
fn position(shapes: &[egui::epaint::ClippedShape], label: &str) -> Pos2 {
|
||||
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,
|
||||
}
|
||||
}
|
||||
shapes
|
||||
.iter()
|
||||
.find_map(|s| find(&s.shape, label))
|
||||
.unwrap_or_else(|| panic!("Missing menu entry: {label}"))
|
||||
}
|
||||
let ctx = Context::default();
|
||||
let mut s = studio();
|
||||
s.settings.language = pdf_presenter::localization::Language::En;
|
||||
let mut native = UiState::default();
|
||||
let mut frame = |s: &mut Studio, events| {
|
||||
let mut raw = input(Vec2::new(1920., 1080.));
|
||||
raw.events = events;
|
||||
ctx.run_ui(raw, |ui| presenter_ui::presenter(ui, s, &mut native))
|
||||
};
|
||||
let mut click = |s: &mut Studio, label: &str| {
|
||||
let mut output = frame(s, vec![]);
|
||||
for _ in 0..3 {
|
||||
output = frame(s, vec![]);
|
||||
}
|
||||
let pos = position(&output.shapes, label);
|
||||
for pressed in [true, false] {
|
||||
frame(
|
||||
s,
|
||||
vec![
|
||||
egui::Event::PointerMoved(pos),
|
||||
egui::Event::PointerButton {
|
||||
pos,
|
||||
button: egui::PointerButton::Primary,
|
||||
pressed,
|
||||
modifiers: Default::default(),
|
||||
},
|
||||
],
|
||||
);
|
||||
}
|
||||
};
|
||||
click(&mut s, "Menu");
|
||||
click(&mut s, "Appearance");
|
||||
click(&mut s, "Midra Dark");
|
||||
assert!(
|
||||
s.menu_open,
|
||||
"Opening a theme selector must keep its parents open"
|
||||
);
|
||||
click(&mut s, "High Contrast");
|
||||
assert_eq!(s.settings.theme, pdf_presenter::theme::Theme::HighContrast);
|
||||
assert!(s.menu_open);
|
||||
click(&mut s, "English");
|
||||
click(&mut s, "System / Système");
|
||||
assert_eq!(
|
||||
s.settings.language,
|
||||
pdf_presenter::localization::Language::System
|
||||
);
|
||||
assert!(s.menu_open);
|
||||
click(&mut s, "Preferences");
|
||||
let auto_show = s.settings.auto_show;
|
||||
click(
|
||||
&mut s,
|
||||
"Show presentation automatically when opening a document",
|
||||
);
|
||||
assert_eq!(s.settings.auto_show, !auto_show);
|
||||
assert!(s.menu_open);
|
||||
click(&mut s, "Storage locations");
|
||||
assert!(s.menu_open);
|
||||
click(&mut s, "Reset timer");
|
||||
assert!(!s.menu_open, "Commands should dismiss the dropdown");
|
||||
click(&mut s, "Menu");
|
||||
click(&mut s, "Demo");
|
||||
assert!(!s.menu_open, "Outside click should dismiss the dropdown");
|
||||
click(&mut s, "Menu");
|
||||
frame(
|
||||
&mut s,
|
||||
vec![egui::Event::Key {
|
||||
key: egui::Key::Escape,
|
||||
physical_key: None,
|
||||
pressed: true,
|
||||
repeat: false,
|
||||
modifiers: Default::default(),
|
||||
}],
|
||||
);
|
||||
assert!(!s.menu_open, "Escape should dismiss the dropdown");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn timer_presets_reserve_space_and_progress_tracks_navigation() {
|
||||
use pdf_presenter::settings::TimerPosition;
|
||||
fn text_rect(shapes: &[egui::epaint::ClippedShape], label: &str) -> Option<Rect> {
|
||||
fn find(shape: &egui::Shape, label: &str) -> Option<Rect> {
|
||||
match shape {
|
||||
egui::Shape::Text(t) if t.galley.text() == label => {
|
||||
Some(Rect::from_min_size(t.pos, t.galley.size()))
|
||||
}
|
||||
egui::Shape::Vec(shapes) => shapes.iter().find_map(|s| find(s, label)),
|
||||
_ => None,
|
||||
}
|
||||
}
|
||||
shapes.iter().find_map(|s| find(&s.shape, label))
|
||||
}
|
||||
let ctx = Context::default();
|
||||
let mut s = studio();
|
||||
let mut native = UiState::default();
|
||||
s.layout.header = false;
|
||||
s.layout.footer = false;
|
||||
s.layout.elapsed_position = TimerPosition::AboveSlides;
|
||||
s.layout.clock_position = TimerPosition::BelowNotes;
|
||||
s.layout.elapsed.size = 72.;
|
||||
s.layout.clock.size = 72.;
|
||||
let mut render = |s: &mut Studio| {
|
||||
let mut output = ctx.run_ui(input(Vec2::new(1280., 900.)), |ui| {
|
||||
presenter_ui::presenter(ui, s, &mut native)
|
||||
});
|
||||
for _ in 0..3 {
|
||||
output = ctx.run_ui(input(Vec2::new(1280., 900.)), |ui| {
|
||||
presenter_ui::presenter(ui, s, &mut native)
|
||||
});
|
||||
}
|
||||
output
|
||||
};
|
||||
let output = render(&mut s);
|
||||
let elapsed = text_rect(&output.shapes, "Elapsed time").unwrap();
|
||||
let clock = text_rect(&output.shapes, "Time · HH:MM").unwrap();
|
||||
let current = text_rect(&output.shapes, "CURRENT 1 / 30").unwrap();
|
||||
assert!(elapsed.bottom() < current.top());
|
||||
assert!(clock.top() > current.bottom());
|
||||
assert!(text_rect(&output.shapes, "Slide 1 / 30").is_none());
|
||||
s.layout.slide_progress = true;
|
||||
for page in [0, 14, 29] {
|
||||
s.requested = page;
|
||||
let output = render(&mut s);
|
||||
let progress = text_rect(&output.shapes, &format!("Slide {} / 30", page + 1)).unwrap();
|
||||
assert!(progress.top() > text_rect(&output.shapes, "Time · HH:MM").unwrap().bottom());
|
||||
}
|
||||
s.deck = None;
|
||||
assert!(text_rect(&render(&mut s).shapes, "Slide 0 / 0").is_some());
|
||||
s.layout.elapsed.show = false;
|
||||
s.layout.clock.show = false;
|
||||
let output = render(&mut s);
|
||||
assert!(text_rect(&output.shapes, "Elapsed time").is_none());
|
||||
assert!(text_rect(&output.shapes, "Time · HH:MM").is_none());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn end_of_slides_is_only_a_presenter_next_preview_not_a_page() {
|
||||
fn count_text(shape: &egui::Shape, label: &str) -> usize {
|
||||
match shape {
|
||||
egui::Shape::Text(t) => usize::from(t.galley.text() == label),
|
||||
egui::Shape::Vec(shapes) => shapes.iter().map(|s| count_text(s, label)).sum(),
|
||||
_ => 0,
|
||||
}
|
||||
}
|
||||
let ctx = Context::default();
|
||||
let mut s = studio();
|
||||
s.settings.language = pdf_presenter::localization::Language::En;
|
||||
let mut native = UiState::default();
|
||||
for (total, requested, next_visible, expected) in [
|
||||
(3, 0, true, 0),
|
||||
(3, 1, true, 0),
|
||||
(3, 2, true, 1),
|
||||
(3, 2, false, 0),
|
||||
(1, 0, true, 1),
|
||||
(0, 0, true, 0),
|
||||
] {
|
||||
s.deck.as_mut().unwrap().names = (0..total).map(|i| i.to_string()).collect();
|
||||
s.requested = requested;
|
||||
s.layout.next.show = next_visible;
|
||||
let output = ctx.run_ui(input(Vec2::new(1280., 900.)), |ui| {
|
||||
presenter_ui::presenter(ui, &mut s, &mut native);
|
||||
});
|
||||
assert_eq!(
|
||||
output
|
||||
.shapes
|
||||
.iter()
|
||||
.map(|s| count_text(&s.shape, "End of slides"))
|
||||
.sum::<usize>(),
|
||||
expected
|
||||
);
|
||||
assert_eq!(s.count(), total);
|
||||
s.execute(Action::Go(total));
|
||||
assert_eq!(
|
||||
s.requested, requested,
|
||||
"The placeholder cannot be navigated to"
|
||||
);
|
||||
let output = ctx.run_ui(input(Vec2::new(1280., 900.)), |ui| {
|
||||
presenter_ui::browser(ui, &mut s, &mut native);
|
||||
});
|
||||
assert_eq!(
|
||||
output
|
||||
.shapes
|
||||
.iter()
|
||||
.map(|s| count_text(&s.shape, "End of slides"))
|
||||
.sum::<usize>(),
|
||||
0
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,162 +0,0 @@
|
|||
use pdf_presenter::settings::{self, Layout, Routes, Settings};
|
||||
#[test]
|
||||
fn settings_roundtrip_preserves_project_overrides_and_hidden_bars() {
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let path = temp.path().join("nested/settings.toml");
|
||||
assert_eq!(settings::read(&path).unwrap().version, 1);
|
||||
let mut settings = Settings::default();
|
||||
settings.layout.notes.size = 42.;
|
||||
settings.buffer_mib = 2048;
|
||||
settings.auto_show = false;
|
||||
settings.theme = pdf_presenter::theme::Theme::CorporateLight;
|
||||
settings.language = pdf_presenter::localization::Language::Fr;
|
||||
let mut project = Layout::default();
|
||||
project.current.show = false;
|
||||
project.header = false;
|
||||
project.footer = false;
|
||||
project.elapsed_position = settings::TimerPosition::AboveSlides;
|
||||
project.clock_position = settings::TimerPosition::BelowNotes;
|
||||
project.slide_progress = true;
|
||||
settings.projects.insert("show".into(), project.clone());
|
||||
settings.routes = Routes {
|
||||
presenter: vec!["one".into(), "two".into()],
|
||||
presentation: vec!["three".into()],
|
||||
};
|
||||
settings::write(&path, &settings).unwrap();
|
||||
let loaded = settings::read(&path).unwrap();
|
||||
assert_eq!(loaded.for_project("show"), project);
|
||||
assert_eq!(loaded.for_project("other").notes.size, 42.);
|
||||
assert_eq!(loaded.routes, settings.routes);
|
||||
assert_eq!(loaded.buffer_mib, 2048);
|
||||
assert!(!loaded.auto_show);
|
||||
assert_eq!(loaded.theme, settings.theme);
|
||||
assert_eq!(loaded.language, settings.language);
|
||||
let bytes = std::fs::read(&path).unwrap();
|
||||
settings.version = 2;
|
||||
assert!(settings::write(&path, &settings).is_err());
|
||||
assert_eq!(std::fs::read(&path).unwrap(), bytes);
|
||||
}
|
||||
#[test]
|
||||
fn settings_reject_invalid_versions_ranges_and_duplicate_roles() {
|
||||
let mut s = Settings {
|
||||
version: 2,
|
||||
..Default::default()
|
||||
};
|
||||
assert!(s.validate().is_err());
|
||||
s.version = 1;
|
||||
s.buffer_mib = 128;
|
||||
assert!(s.validate().is_err());
|
||||
s.buffer_mib = 1024;
|
||||
s.layout.clock.size = f32::NAN;
|
||||
assert!(s.validate().is_err());
|
||||
s.layout = Default::default();
|
||||
s.routes.presenter = vec!["x".into(), "x".into()];
|
||||
assert!(s.validate().is_err());
|
||||
s.routes.presenter.pop();
|
||||
s.routes.presentation = vec!["x".into()];
|
||||
assert!(s.validate().is_err());
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let p = temp.path().join("bad.toml");
|
||||
std::fs::write(&p, "version = 99").unwrap();
|
||||
assert!(settings::read(&p).is_err());
|
||||
std::fs::write(&p, "invalid ]").unwrap();
|
||||
assert!(settings::read(&p).is_err());
|
||||
std::fs::write(&p, "version=1").unwrap();
|
||||
assert!(settings::read(&p).unwrap().layout.header);
|
||||
assert_eq!(settings::read(&p).unwrap().buffer_mib, 1024);
|
||||
assert!(settings::read(&p).unwrap().auto_show);
|
||||
}
|
||||
#[test]
|
||||
fn monitor_recovery_preserves_survivors_and_distinct_groups() {
|
||||
let routes = Routes {
|
||||
presenter: vec!["a".into(), "b".into()],
|
||||
presentation: vec!["c".into()],
|
||||
};
|
||||
assert_eq!(
|
||||
routes.resolve(&["b".into(), "c".into()], 0),
|
||||
Routes {
|
||||
presenter: vec!["b".into()],
|
||||
presentation: vec!["c".into()]
|
||||
}
|
||||
);
|
||||
let one = routes.resolve(&["c".into()], 0);
|
||||
assert_eq!(one.presenter, vec!["c"]);
|
||||
assert!(one.presentation.is_empty());
|
||||
assert!(routes.resolve(&[], 0).presenter.is_empty());
|
||||
let fallback = Routes::default().resolve(&["a".into(), "b".into(), "c".into()], 1);
|
||||
assert_eq!(fallback.presenter, vec!["b"]);
|
||||
assert_eq!(fallback.presentation, vec!["a"]);
|
||||
let rehearsal = Routes {
|
||||
presenter: vec!["a".into()],
|
||||
presentation: vec![],
|
||||
};
|
||||
assert!(
|
||||
rehearsal
|
||||
.resolve(&["a".into(), "b".into()], 0)
|
||||
.presentation
|
||||
.is_empty()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn legacy_layouts_default_timer_positions_and_progress_is_opt_in() {
|
||||
let legacy: Settings = toml::from_str("version=1\n[layout]\nheader=false").unwrap();
|
||||
assert_eq!(
|
||||
legacy.layout.elapsed_position,
|
||||
settings::TimerPosition::Header
|
||||
);
|
||||
assert_eq!(
|
||||
legacy.layout.clock_position,
|
||||
settings::TimerPosition::Header
|
||||
);
|
||||
assert!(!legacy.layout.slide_progress);
|
||||
assert!(toml::from_str::<Settings>("[layout]\nclock_position='anywhere'").is_err());
|
||||
let example: Settings = toml::from_str(include_str!(
|
||||
"../../../docs/interfaces/examples/settings-v1.toml"
|
||||
))
|
||||
.unwrap();
|
||||
example.validate().unwrap();
|
||||
assert_eq!(
|
||||
example.layout,
|
||||
toml::from_str::<Settings>(&toml::to_string(&example).unwrap())
|
||||
.unwrap()
|
||||
.layout
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn slide_colors_migrate_roundtrip_and_reject_invalid_channels() {
|
||||
use settings::SlideColors;
|
||||
let old: Settings = toml::from_str("version = 1").unwrap();
|
||||
assert_eq!(old.slide_colors, SlideColors::default());
|
||||
let temp = tempfile::tempdir().unwrap();
|
||||
let path = temp.path().join("settings.toml");
|
||||
let mut s = old;
|
||||
s.slide_colors = SlideColors {
|
||||
page_background: [10, 20, 30],
|
||||
fit_padding: [40, 50, 60],
|
||||
};
|
||||
settings::write(&path, &s).unwrap();
|
||||
assert_eq!(settings::read(&path).unwrap().slide_colors, s.slide_colors);
|
||||
let state = pdf_presenter::output::HostState {
|
||||
slide_colors: s.slide_colors,
|
||||
..Default::default()
|
||||
};
|
||||
let restored: pdf_presenter::output::HostState =
|
||||
serde_json::from_slice(&serde_json::to_vec(&state).unwrap()).unwrap();
|
||||
assert_eq!(restored.slide_colors, s.slide_colors);
|
||||
for value in [
|
||||
"[256, 0, 0]",
|
||||
"[-1, 0, 0]",
|
||||
"[0, 0]",
|
||||
"[0, 0, 0, 0]",
|
||||
"[0.5, 0, 0]",
|
||||
] {
|
||||
assert!(
|
||||
toml::from_str::<Settings>(&format!(
|
||||
"version=1\n[slide_colors]\npage_background={value}"
|
||||
))
|
||||
.is_err()
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,607 @@
|
|||
|
||||
## Unreleased
|
||||
|
||||
### 0.1.101
|
||||
|
||||
- Import bounded, data-only language and theme ZIP packs from Preferences. Packs use
|
||||
Canvas Pilot-compatible manifests, persist beside settings, load offline at startup
|
||||
and appear in the existing selectors without restarting.
|
||||
- Add editable example packs, ready-to-import ZIPs and pack-format documentation.
|
||||
- Publish the full five-target release with Linux x86_64, Linux ARM64, Windows x86_64,
|
||||
Apple Silicon macOS and Intel macOS portable and cargo-binstall archives; see the
|
||||
[release notes](development/release-notes/v0.1.101.md).
|
||||
|
||||
### 0.1.100
|
||||
|
||||
- Keep the Preferences window size stable while the pointer moves by removing a
|
||||
self-referential width constraint and reserving the full footer spacing.
|
||||
|
||||
### 0.1.99
|
||||
|
||||
- Organize Preferences into General, Performance and Storage tabs. Each tab has its
|
||||
own small-screen scroll position, and every Presenter remembers its selected tab.
|
||||
|
||||
### 0.1.98
|
||||
|
||||
- Shorten the Presenter menu by removing its duplicate All slides command and moving
|
||||
theme, language and slide colors into the Preferences window. Keep zoom, fitted
|
||||
zoom behavior, automatic Slides output and Autoplay available directly.
|
||||
- Keep the menu vertically scrollable on small screens while leaving Quit visible
|
||||
without scrolling at ordinary Presenter window sizes.
|
||||
|
||||
### 0.1.97
|
||||
|
||||
- Publish future release assets to both Gitea and GitHub from one reviewed build,
|
||||
using a separate named token for each service.
|
||||
|
||||
### 0.1.96
|
||||
|
||||
- Rename the application, crate, executable, repository links, desktop identity,
|
||||
CI publication paths and future packages to Deckstride. Existing releases remain
|
||||
unchanged; valid settings migrate to the new location and warm rendered-slide
|
||||
caches remain available after the rename.
|
||||
- Retain the established application icon for the Deckstride release.
|
||||
- Linux formatting, warnings-denied Clippy/rustdoc, workspace tests and 13 Python
|
||||
helper tests pass. Windows and macOS runtime acceptance remains native testing.
|
||||
|
||||
### 0.1.95
|
||||
|
||||
- Add an Autoplay menu with persistent Play automatically, per-slide timing and
|
||||
loop controls. Timing starts only once the requested slide is visible; transient
|
||||
dialogs and safety states pause playback, while manual interaction restarts the
|
||||
interval.
|
||||
- Linux formatting, warnings-denied Clippy/rustdoc, workspace tests, build and
|
||||
13 Python helper tests pass. Full GUI coverage is 83.94% against the 75% floor.
|
||||
|
||||
### 0.1.94
|
||||
|
||||
- Show the full, selectable path of the running portable executable under
|
||||
**Preferences → Storage and preparation**, with guidance for finding its folder
|
||||
when updating or removing the application.
|
||||
- Linux formatting, warnings-denied Clippy/rustdoc, workspace tests, build and
|
||||
13 Python helper tests pass. Full GUI coverage is 83.83% against the 75% floor.
|
||||
|
||||
### 0.1.93
|
||||
|
||||
- Move the open source name out of the Presenter header and into a dedicated bottom
|
||||
footer row with its full canonical path. Long paths truncate to the available
|
||||
width and remain available on hover; hiding the footer hides the source details.
|
||||
|
||||
### 0.1.92
|
||||
|
||||
- Extend the existing Canvas Pilot-inspired appearance menu with Spanish, Japanese,
|
||||
Simplified Chinese, German and Brazilian Portuguese alongside English and French;
|
||||
System follows supported native locales and safely falls back to English.
|
||||
- Embed the OFL-licensed Noto Sans CJK collection for standalone Japanese and Chinese
|
||||
interface rendering. Catalog lookup is compiled and allocation-free; CJK fonts are
|
||||
installed only when selected and never read from disk at runtime.
|
||||
- Stop rebuilding theme visuals and locale/font state on every frame. Both now update
|
||||
only when their selection changes, keeping slide preparation, navigation and output
|
||||
rendering paths unchanged.
|
||||
- Linux formatting, warnings-denied Clippy/rustdoc, workspace tests, optimized build,
|
||||
13 Python helper tests and the native-window smoke pass. Full GUI coverage is
|
||||
83.89% against the 75% floor.
|
||||
|
||||
### 0.1.91
|
||||
|
||||
- Promote releases from preview status and add recurring Linux ARM64, Apple Silicon
|
||||
macOS and Intel macOS artifacts alongside Linux x86_64 and Windows x86_64.
|
||||
- Pin the macOS 13 cross-build environment, package portable archives for every
|
||||
target, and document the expanded download and cargo-binstall choices.
|
||||
- Linux formatting, warnings-denied Clippy/rustdoc, workspace tests and 13 Python
|
||||
helper tests pass; full GUI coverage is 84.79% against the 75% floor.
|
||||
|
||||
### 0.1.90
|
||||
|
||||
- Correct CLI help for confirmed quitting and hold-S screen swapping. Release
|
||||
validation outside the sandbox passes full GUI coverage at 84.83% (75% floor).
|
||||
|
||||
- Refresh bundled dependency notices and include vendored dependencies when
|
||||
collecting licenses; only first-party workspace members are excluded.
|
||||
|
||||
- Prepare the Linux/Windows preview release containing the display controls,
|
||||
quit confirmation and single-screen view added since 0.1.83. See the
|
||||
[release notes](development/release-notes/v0.1.90.md).
|
||||
|
||||
### 0.1.89
|
||||
|
||||
- Add a Single screen role in Displays: full-window slides with top/bottom edge
|
||||
controls, using prepared frames and preserving the ordinary Presenter layout.
|
||||
Include a startup-only offer when exactly one screen is initially detected,
|
||||
explaining the intended separate Presenter/Slides setup. Disconnects never
|
||||
create an offer; confirmed choices persist through the existing display trial.
|
||||
- Keep audience-host rendering and privacy separate; group swaps leave Single
|
||||
screen assignments in place. Cover settings boundaries, startup/hotplug,
|
||||
manual selection, output visibility, slide geometry and texture reuse in tests.
|
||||
- Linux formatting, warnings-denied Clippy/rustdoc, workspace tests, build and
|
||||
13 Python helper tests pass. GUI coverage is blocked by `XOpenDisplayFailed`;
|
||||
physical edge-control, placement and latency testing remains pending.
|
||||
Windows/macOS builds were not run.
|
||||
|
||||
### 0.1.88
|
||||
|
||||
- Escape and Ctrl+Q request a shared quit-confirmation dialog, also used by Menu
|
||||
Quit and Presenter window close. Cancel/Escape resumes the show; explicit Quit
|
||||
closes it only when notes have no pending writes or unsaved edits. Audience
|
||||
shortcuts request operator confirmation without showing dialogs or blanking
|
||||
Slides. Escape still reverts active display trials first.
|
||||
- Linux formatting, warnings-denied Clippy/rustdoc, workspace tests, build and
|
||||
13 Python tests pass. GUI coverage remains blocked by `XOpenDisplayFailed` in
|
||||
this environment; native physical testing and Windows/macOS validation were
|
||||
not performed.
|
||||
|
||||
### 0.1.87
|
||||
|
||||
- Add per-screen Follow global / Always fullscreen / Always windowed choices in
|
||||
Displays. Overrides follow monitor identity through role swaps and hotplug,
|
||||
bypass global fullscreen commands, and use the existing Keep/Revert trial.
|
||||
Save bounded v1 settings and send resolved per-output modes to the independent
|
||||
host, including matching viewport acknowledgments for mixed-mode mirrors.
|
||||
- Linux formatting, warnings-denied Clippy/rustdoc, workspace tests, build and
|
||||
13 Python tests pass. GUI coverage cannot complete without an accessible display
|
||||
(`XOpenDisplayFailed`). Physical mixed-mode display testing remains pending;
|
||||
Windows/macOS builds were not run.
|
||||
|
||||
### 0.1.86
|
||||
|
||||
- Hold S for one second in Presenter or All slides to swap display role groups,
|
||||
including during a live show, using the existing timed Keep/Revert trial.
|
||||
Ignore repeats and text editing; cancel on release, focus/modifier changes,
|
||||
other keys or display topology changes. Preserve shown/blanked output.
|
||||
- Linux formatting, warnings-denied Clippy/rustdoc, workspace tests, build and
|
||||
13 Python tests pass. GUI coverage is unavailable because the native smoke test
|
||||
cannot open a display. Physical screen-swap testing remains pending;
|
||||
Windows/macOS builds were not run.
|
||||
|
||||
### 0.1.85
|
||||
|
||||
- Document installation through cargo-binstall using repository release archives,
|
||||
an explicit published version and the prebuilt-only strategy. Verify the Linux
|
||||
v0.1.83 download and binary resolution with a dry run.
|
||||
|
||||
### 0.1.84
|
||||
|
||||
- Rewrite the root README for presenters: lead with the tested multi-screen workflow,
|
||||
per-screen layouts, fast buffered navigation, monitor reconnection, zoom, live
|
||||
tools, safe slide browsing and portable release downloads.
|
||||
- Add real application screenshots made with the repository's fictional demo PDF,
|
||||
covering Presenter, display routing, All slides and the pointer toolbox.
|
||||
|
||||
### 0.1.83
|
||||
|
||||
- Scale pointers, highlights, arrow shafts and arrow heads against the visible slide
|
||||
height so they occupy a comparable share of Presenter previews, 1080p Slides and
|
||||
4K Slides, including mixed-DPI screens. Raise the selectable maximum from 32 to 48
|
||||
while preserving the lightweight vector overlay path.
|
||||
- Prepare the 0.1.83 Linux/Windows and one-off Apple Silicon macOS preview release; see the
|
||||
[release notes](development/release-notes/v0.1.83.md).
|
||||
- Pin the memory-budget probe to a Rust 1.93-compatible `sysinfo` release so the
|
||||
one-off macOS target builds with the release tool's pinned Apple toolchain.
|
||||
|
||||
### 0.1.82
|
||||
|
||||
- Disclose the project's MIT license, LLM-generated or LLM-assisted development,
|
||||
human review and professional use in the public README.
|
||||
- Replace the crowded Preferences submenu with a resizable, scrollable Preferences
|
||||
window for blank-output artwork, Windows PDF integration, RAM, disk cache, cleanup,
|
||||
preparation status and storage paths. Each Presenter owns its own window instance.
|
||||
- Keep page zoom, fitted-area zoom behavior and automatic Slides output as direct
|
||||
quick settings in Menu.
|
||||
- Linux formatting, Clippy, tests, build, rustdoc and Python helper checks pass.
|
||||
Headless line coverage is 68.51%, below the 75% floor; no application behavior
|
||||
changed, and physical-display validation was not run.
|
||||
|
||||
### 0.1.81
|
||||
|
||||
- Retry Presenter activation for a short bounded period during Windows startup,
|
||||
after the fullscreen Slides process has had time to map its windows. A Win32
|
||||
input-queue fallback improves the chance that arrow keys work immediately, and
|
||||
retries avoid disturbing an already-focused Presenter and stop after the startup
|
||||
window or when All slides is deliberately focused.
|
||||
- Host formatting, Clippy, workspace tests and Python helper tests pass, as does
|
||||
Windows-target Clippy. Foreground behavior still requires a physical Windows test.
|
||||
|
||||
### 0.1.80
|
||||
|
||||
- Put a visible **Set as default PDF app…** action directly in Preferences on
|
||||
Windows. It registers the portable executable and PDF icon for the current user,
|
||||
then opens Default Apps for Windows' required confirmation.
|
||||
- Formatting, Clippy, workspace tests, Python helper tests and a Windows-target type
|
||||
check pass. Selecting the association in Windows remains a physical acceptance check.
|
||||
|
||||
### 0.1.79
|
||||
|
||||
- Name the two display roles **Presenter** and **Slides** throughout the user-facing
|
||||
interface and guide, while preserving existing settings and command-line fields.
|
||||
- Add an **Edit layout for** selector to every Presenter layout window. Any Presenter
|
||||
can edit another connected Presenter screen live, and project/global save or reset
|
||||
actions remain scoped to the selected screen.
|
||||
- Validation: formatting, Clippy, workspace tests, build, rustdoc and Python helper
|
||||
tests pass. Headless line coverage is 68.66%; physical multi-screen behavior still
|
||||
requires desktop validation.
|
||||
|
||||
### 0.1.78
|
||||
|
||||
- Reuse one bounded base framebuffer per presentation window for pointer and
|
||||
annotation updates instead of scaling and rasterizing the full slide again.
|
||||
Slide, zoom, color, DPI, blanking and resize changes invalidate the cache;
|
||||
interactive display recovery bypasses it. The cache is capped at 64 MiB per
|
||||
output window.
|
||||
- Build the Windows release executable as a GUI application so it does not open a
|
||||
terminal, create presentation windows without activation, and explicitly focus
|
||||
the presenter when its initial placement becomes visible.
|
||||
- Add an optional per-user Windows PDF-app registration from Preferences. It points
|
||||
the document icon and open command at the portable executable, refreshes Explorer,
|
||||
and opens Default Apps for the user-controlled confirmation.
|
||||
- Linux all-feature tests, formatting, Clippy, rustdoc, Python tests and the
|
||||
optimized build pass; headless whole-application line coverage is 68.39%. Full
|
||||
GUI coverage could not run because Xvfb is unavailable, and the local Windows
|
||||
cross-check stops at the existing icon build step because MinGW windres is absent.
|
||||
Windows multi-monitor latency, initial focus and association behavior remain
|
||||
physical acceptance checks.
|
||||
|
||||
### 0.1.77
|
||||
|
||||
- Add an optional custom picture for Blank presentation in Preferences, shared by
|
||||
all audience displays, with a control to restore solid black.
|
||||
- Save a bounded managed copy independently of the slide cache; load and decode
|
||||
in supervised workers. Fit it against black without slide zoom or annotations.
|
||||
Failed imports retain the previous choice; unavailable saved pictures fall back
|
||||
to black without exposing slides.
|
||||
- Linux workspace/native tests, 13 Python tests, formatting, Clippy, rustdoc and
|
||||
optimized build pass; whole-application line coverage is 84.56%. Windows and
|
||||
physical-display acceptance remain pending for this change.
|
||||
|
||||
|
||||
### 0.1.76
|
||||
|
||||
- Give every presenter display its own complete visual layout, presets, local
|
||||
customization panel/menu and saved project/all-project profiles. Profiles follow
|
||||
monitor IDs through reconnects; existing settings remain the fallback.
|
||||
- Keep slide navigation, output confirmation and timer behavior shared, while
|
||||
widget visibility, sizing, placement and bars are independent. Scoped saves
|
||||
retain their originating display even when another presenter renders first.
|
||||
- Add bounded, backward-compatible v1 display layout profiles with examples,
|
||||
validation/round-trip tests and multi-presenter save/reconnect regression coverage.
|
||||
Linux workspace/native tests, 13 Python tests, formatting and warnings-denied
|
||||
Clippy/rustdoc pass; whole-application coverage is 84.78% (75% floor). The Linux
|
||||
release binary is rebuilt. Windows/macOS builds and physical display testing
|
||||
remain open; no release was published.
|
||||
|
||||
### 0.1.75
|
||||
|
||||
- Prepare the 0.1.75 preview release with Linux/Windows x86_64 packages and a
|
||||
three-display Windows test checklist; see
|
||||
[release notes](development/release-notes/v0.1.75.md).
|
||||
|
||||
- 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
|
||||
assigned monitor IDs and fullscreen flags remain the same. This repairs stale
|
||||
positions after the OS relocates windows during unplug/replug cycles.
|
||||
- Cover repeated third/middle monitor disconnects with presenter and presentation
|
||||
mirrors, preserving saved roles and show/blank state; verify topology changes
|
||||
invalidate placement for three native windows. Physical reconnect testing remains
|
||||
open, including Windows/macOS. Linux workspace/native and 13 Python tests pass,
|
||||
along with formatting and warnings-denied Clippy/rustdoc; whole-application
|
||||
coverage is 84.56% (75% floor). The Linux release binary is rebuilt.
|
||||
|
||||
### 0.1.73
|
||||
|
||||
- Stop self-perpetuating native repaint requests that can starve other selected
|
||||
displays until their windows receive a click. Honor each window's egui repaint
|
||||
deadline with a bounded animation rate, and include new mirrors in state redraws.
|
||||
Add a three-window regression exercising rendering without clicks and idle repaint
|
||||
limits. Linux workspace/native tests, 13 Python tests, formatting and warnings-
|
||||
denied Clippy/rustdoc pass; whole-application coverage is 84.57% (75% floor).
|
||||
The Linux release binary is rebuilt. Physical three-monitor and Windows/macOS
|
||||
verification remain open.
|
||||
|
||||
### 0.1.72
|
||||
|
||||
- Preserve the live show when Escape closes All slides, including focused controls
|
||||
and keyboard focus moving to the audience window. Escape still reverts display
|
||||
trials and closes orphan outputs; B remains the explicit blank shortcut.
|
||||
- Accelerate held next/previous buttons and navigation keys from single steps to
|
||||
bounded batches. Coalesce uncached destinations without render-job queues or
|
||||
repeated worker restarts; stop on release/focus loss and retain the last ready frame.
|
||||
Linux formatting, warnings-denied Clippy/rustdoc, workspace/native tests and 13
|
||||
Python tests pass; whole-application coverage is 84.71% (75% floor). The Linux
|
||||
release binary is rebuilt. Windows/macOS and physical-display retesting remain open.
|
||||
|
||||
### 0.1.71
|
||||
|
||||
- Prepare the 0.1.71 preview release with Linux/Windows x86_64 packages; see
|
||||
[release notes](development/release-notes/v0.1.71.md).
|
||||
|
||||
- Run automatic disk-cache cleanup once at startup, after initial document/notes
|
||||
loading and slide preparation finish, instead of every minute. Preferences edits
|
||||
no longer trigger scans; manual expunge remains available. Startup cleanup uses
|
||||
disk preparation completion so decks exceeding the RAM budget are supported.
|
||||
Linux validation passes, including native GUI tests and 84.46% whole-application
|
||||
coverage (75% floor). Windows/macOS checks were not run.
|
||||
|
||||
### 0.1.70
|
||||
|
||||
- Add configurable disk-cache size and lifetime limits (10 GiB / 30 days by
|
||||
default) and manual expunge under Preferences. A supervised background worker
|
||||
removes expired/oldest artifacts, protects active decks with process locks,
|
||||
reports reclaimed space and errors, and preserves source files and notes.
|
||||
Linux formatting, warnings-denied Clippy/rustdoc, workspace/native tests and
|
||||
13 Python tests pass; whole-application coverage is 84.39% (75% floor).
|
||||
Windows/macOS checks and physical-display acceptance were not run.
|
||||
|
||||
### 0.1.69
|
||||
|
||||
- Decode the unsupported-platform keep-awake child status with the private
|
||||
length-prefixed JSON protocol used by the application. This fixes the FreeBSD CI
|
||||
test that incorrectly treated the framed bytes as plain JSON; production sleep
|
||||
behavior is unchanged. Linux checks pass with 84.44% whole-application coverage;
|
||||
the release binary is rebuilt.
|
||||
|
||||
### 0.1.68
|
||||
|
||||
- Keep large arrows clean and proportional: shorten the shaft beneath a filled,
|
||||
length-bounded triangular head instead of overlapping three thick strokes. Use
|
||||
logical tool sizes directly so display DPI does not inflate arrows or highlights.
|
||||
Linux checks pass with 84.42% whole-application coverage; the release binary is
|
||||
rebuilt.
|
||||
|
||||
### 0.1.67
|
||||
|
||||
- Add a presenter toolbox with a low-latency pointer, straight arrows and
|
||||
translucent highlighter strokes. Send normalized vector overlays through a
|
||||
bounded, coalesced output update without rerendering slides or reading files;
|
||||
cap each slide view at 64 marks and provide size, color, undo and clear controls.
|
||||
Pointer/mark activity can start an armed presentation timer. Linux checks pass
|
||||
with 84.30% whole-application coverage; the release binary is rebuilt. Physical
|
||||
output latency and appearance remain separate acceptance checks.
|
||||
|
||||
### 0.1.66
|
||||
|
||||
- Run the optional Linux desktop-launcher installation test only on Linux workers;
|
||||
platform-neutral desktop-entry escaping tests still run everywhere. Include the
|
||||
installer’s stderr when a real Linux integration failure occurs. Linux checks pass
|
||||
with 86.50% whole-application coverage; the release binary is rebuilt.
|
||||
|
||||
### 0.1.65
|
||||
|
||||
- Hide routine rolling-buffer information when the presenter footer is hidden,
|
||||
including its auto-hidden state. Keep active opening and notes-reading feedback
|
||||
available without the footer. Linux checks pass with 86.50% whole-application
|
||||
coverage; the release binary is rebuilt.
|
||||
|
||||
### 0.1.64
|
||||
|
||||
- Keep previous/next shortcuts active in the presenter and All slides, even when a
|
||||
menu control consumed the key; notes editing and modified shortcuts keep priority.
|
||||
Restore an explicit, theme-independent scrollbar at the far right of All slides.
|
||||
Label absent browser frames by their actual RAM state: actively loading, cached on
|
||||
disk until nearby, waiting, or failed, instead of using the presenter’s generic
|
||||
preparation fallback. Linux checks pass with
|
||||
86.40% whole-application coverage; the release binary is rebuilt.
|
||||
|
||||
### 0.1.63
|
||||
|
||||
- Aim double-click fit-width zoom at the clicked page position instead of always
|
||||
centering the page. Clamp the crop at page edges as a best effort; a second
|
||||
double-click still resets to the whole page. Keep shared presenter/output zoom.
|
||||
Linux checks pass with 86.42% whole-application coverage; the release binary
|
||||
is rebuilt. Physical pointer/display acceptance remains separate.
|
||||
|
||||
### 0.1.62
|
||||
|
||||
- Keep the default timer at zero when a deck's initial slide is merely displayed.
|
||||
Start it on the first navigation, zoom or output visibility action. Rename Restart
|
||||
to Reset: it now returns to zero and rearms this action trigger, while explicit
|
||||
Start still begins immediately and Pause cannot be undone by later activity.
|
||||
Linux checks pass with 86.54% whole-application coverage; the release binary
|
||||
is rebuilt. Physical presentation timing remains a separate acceptance check.
|
||||
|
||||
### 0.1.61
|
||||
|
||||
- Keep Displays, Layout and fullscreen as header buttons and remove their Menu
|
||||
duplicates. Add direct Start/Pause and Restart timer header buttons; remove
|
||||
timer controls from Menu while retaining them in Layout's timer settings.
|
||||
Wrap controls on narrow windows and reserve a separate row for header clocks.
|
||||
|
||||
### 0.1.60
|
||||
|
||||
- Match the zoom-enabled current preview to the first connected presentation
|
||||
output's aspect ratio. Fit-width, wheel zoom and panning now show the same crop
|
||||
in that preview and output, rather than fitting independently to the preview pane.
|
||||
Report actual output-window dimensions for windowed/resized output; use monitor
|
||||
dimensions until reported. No image copies or PDF rendering are added.
|
||||
Linux checks pass with 86.35% coverage, including actual preview-mesh crop
|
||||
comparisons and portrait-page fit-width regression checks. Physical display
|
||||
acceptance remains separate.
|
||||
|
||||
### 0.1.59
|
||||
|
||||
- Increase the Menu dropdown height from 520 to 720 logical pixels so Quit stays
|
||||
accessible without scrolling on taller screens. Limit it to the space below
|
||||
its button and retain scrolling on smaller windows.
|
||||
|
||||
### 0.1.58
|
||||
|
||||
- Double-click an unzoomed current preview or presentation output to fit the page
|
||||
width to that viewport (within the existing 8× limit). Double-click while zoomed
|
||||
still resets to the whole page. Reuse the buffered texture and shared zoom state;
|
||||
update English/French gesture hints and the guide. Linux checks pass, including
|
||||
pointer-gesture regression tests and 86.22% whole-application coverage.
|
||||
|
||||
### 0.1.57
|
||||
|
||||
- Fix tiny clock/timer text in the header, above slides and below notes: use the
|
||||
reserved row height and account for labels/padding. Put large header timers,
|
||||
or timers in narrow windows, on a separate row below the menu controls.
|
||||
Regression checks verify rendered text size and separation from slides.
|
||||
Linux workspace tests, 13 Python tests, formatting and warnings-denied
|
||||
Clippy/rustdoc pass; release binary rebuilt. Coverage measurement failed twice
|
||||
on corrupt LLVM worker profiles after the tests passed.
|
||||
|
||||
### 0.1.56
|
||||
|
||||
- Move the presenter header fullscreen button after Menu, Displays, All slides
|
||||
and Layout, keeping the hide-header icon at the far left.
|
||||
|
||||
### 0.1.55
|
||||
|
||||
- Let zoom expand portrait/landscape pages into each screen without stretching,
|
||||
instead of trapping them inside the original fitted area. Save an opt-in
|
||||
“Keep fitted page area when zooming” preference. Keep buffered texture reuse,
|
||||
bounded drawing, pointer anchoring and shared zoom/center across outputs.
|
||||
Linux regression checks cover aspect ratio, screen fill, edges, settings and
|
||||
pixel output without new texture uploads. Physical multiscreen testing remains open.
|
||||
|
||||
### 0.1.54
|
||||
|
||||
- Add globally saved, default-off page zoom (1×–8×), wheel/pinch zoom, drag panning
|
||||
and double-click reset from the presenter/current preview or any output. Mirror
|
||||
the crop with lightweight ordered messages; reset on slide changes and preserve
|
||||
visibility. Reuse buffered textures without new rendering, file I/O or image
|
||||
allocations. Explain sharpness/CPU tradeoffs and warn on repeated slow frames.
|
||||
Bundle a licensed renderer patch for bounded scanline sampling and parallel crop
|
||||
bands (four threads maximum). Local software-drawing medians: ~5 ms at 1080p,
|
||||
~16 ms at 4K; physical multicreen/OS acceptance remains separate.
|
||||
Linux checks cover input, pixels, opt-in migration and disk-free output buffering.
|
||||
|
||||
### 0.1.53
|
||||
|
||||
- Import UTF-8 TXT notes separated by hyphen lines or Markdown notes separated by
|
||||
level-one headings, via Menu or presenter drag-and-drop. Review before converting
|
||||
to a complete presentation notes sidecar; preserve remaining notes/source files,
|
||||
detect external conflicts and keep processing off the presentation thread.
|
||||
Document examples and mapping in the README. Linux regression coverage includes
|
||||
parsers, worker flow, natural ordering, atomic saves and conflict handling.
|
||||
|
||||
### 0.1.52
|
||||
|
||||
- Load presentation-named notes sidecars before falling back to PDF/folder notes.
|
||||
Double-click notes to create a full-deck sidecar if absent and edit the captured
|
||||
slide in a resizable editor. Save atomically through an isolated worker, preserve
|
||||
source files and other notes, detect external conflicts and retain failed drafts.
|
||||
|
||||
### 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
|
||||
text to tooltips, remove nested settings cards and reduce padding/button heights;
|
||||
keep wrapping and separately scrolling controls for small windows.
|
||||
|
||||
### 0.1.49
|
||||
|
||||
- Add monotonic elapsed/countdown timing with Start/Pause, Restart, configurable
|
||||
duration and first-output autostart. Preserve pauses across slide changes; reset
|
||||
on successful source loads and stop countdown at zero. Save timer preferences
|
||||
with layouts, and add an 8–120 pixel slide progress bar height control.
|
||||
|
||||
### 0.1.48
|
||||
|
||||
- Add independent left/right of notes/slides timer positions and raise clock/elapsed
|
||||
text size to 320 logical pixels. Reserve side columns, stack shared-side timers,
|
||||
fit large timer text to its panel and refit notes in the remaining space.
|
||||
|
||||
### 0.1.47
|
||||
|
||||
- Escape in the presenter dismisses transient UI without leaving fullscreen or
|
||||
blanking output. Add explicit Enter/Exit fullscreen controls in the header and
|
||||
menu, using the existing reversible display trial. Apply `--windowed` only at startup.
|
||||
|
||||
### 0.1.46
|
||||
|
||||
- Choose unsaved RAM budgets from 15% of available memory, with a soft 512 MiB
|
||||
floor limited to 20% and a 64 MiB operational minimum for constrained systems.
|
||||
Preserve explicit saved budgets and apply the lower limit to both processes.
|
||||
|
||||
### 0.1.45
|
||||
|
||||
- Distinguish Theme and Language section headings with smaller, bold, muted text
|
||||
and separate their selectable submenus with spacing and a divider.
|
||||
|
||||
### 0.1.44
|
||||
|
||||
- Size Layout scrolling from its resized window rather than the desktop. Remove
|
||||
Displays’ forced content width, wrap roles/names, and constrain floating windows
|
||||
to the viewport. Bound the browser toolbar separately so short windows retain
|
||||
thumbnail space and the Close footer.
|
||||
|
||||
### 0.1.43
|
||||
|
||||
- Reorganize Layout into padded preset, slide/notes, timer/progress and bar sections.
|
||||
Pair timer positions with their controls, explain size units and keep save actions
|
||||
outside the settings scroll area. Disable project actions until a document is open.
|
||||
|
||||
### 0.1.42
|
||||
|
||||
- Remove the redundant All slides heading from the browser content and move Close
|
||||
into a fixed bottom-right footer, outside the scrolling thumbnail grid.
|
||||
|
||||
### 0.1.41
|
||||
|
||||
- Redesign All slides controls with labeled settings cards, a filled Compact/Large
|
||||
slider, readable monitor names and a prominent Show selected button. Stack cards
|
||||
in narrow windows and explain safe/live browsing alongside its controls.
|
||||
|
||||
### 0.1.40
|
||||
|
||||
- Draw header/footer visibility icons directly instead of relying on arrow glyphs.
|
||||
Use explicit Auto-hide header/footer tooltips and accessible names, switching to
|
||||
Keep header/footer visible when the bar is already auto-hidden.
|
||||
|
||||
### 0.1.39
|
||||
|
||||
- Rename the All slides screen selector to “Show on screen” (French: “Afficher
|
||||
sur l’écran”).
|
||||
|
||||
### 0.1.38
|
||||
|
||||
- Keep the All slides scrollbar at the right edge with a stable gutter. Fit
|
||||
thumbnail columns to the available window width, using Preview size as the
|
||||
preferred density while retaining slide aspect ratios and virtualized rows.
|
||||
|
||||
### 0.1.37
|
||||
|
||||
- Double-click a thumbnail in All slides to open a resizable preview without
|
||||
changing output. Change on click mode retains live navigation without previews.
|
||||
Escape dismisses the preview first; changing documents clears stale previews.
|
||||
|
||||
### 0.1.36
|
||||
|
||||
- Give All slides a padded toolbar with separate title, preview/display settings,
|
||||
and presentation-action rows. Enlarge control spacing and label the browser
|
||||
screen selector; rows still wrap in narrower windows.
|
||||
|
||||
### 0.1.35
|
||||
|
||||
- Hide the previous-slide preview by default; enable it in Layout. Preserve explicit
|
||||
visibility choices in saved layouts and verify default/opt-in persistence.
|
||||
|
||||
### 0.1.34
|
||||
|
||||
- Restrict keepawake to its supported Linux, Windows and macOS targets so the
|
||||
FreeBSD CI worker can compile. Other platforms explicitly report sleep protection
|
||||
as unavailable while retaining the helper status/parent-pipe lifecycle.
|
||||
- FreeBSD cross-target Clippy passes for all targets/features; native FreeBSD
|
||||
execution awaits Jenkins. Linux checks/native tests and 13 Python tests pass;
|
||||
whole-application line coverage is 86.40%.
|
||||
|
||||
### 0.1.33
|
||||
|
||||
- Prepare local Linux/Windows x86_64 preview artifacts with rust_realease; verify
|
||||
|
|
@ -318,7 +919,7 @@
|
|||
|
||||
### 0.1.0
|
||||
|
||||
- Prepared the standalone PDF Presenter repository with a tested navigation/blanking
|
||||
- Prepared the standalone Deckstride repository with a tested navigation/blanking
|
||||
core, an explicit bootstrap executable, agent guidance and implementation plan.
|
||||
- Added Jenkins validation, whole-workspace coverage and isolated three-badge
|
||||
publication, plus generated application/repository artwork. PDF rendering and
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ dual-screen, startup and responsiveness requirements.
|
|||
- [Persistent interfaces](../interfaces/README.md)
|
||||
- [Changelog](../changelog.md)
|
||||
|
||||
Run `cargo run --locked -p pdf-presenter` for the native mock-window test.
|
||||
Run `cargo run --locked -p deckstride` for the native mock-window test.
|
||||
See the [dual-screen proof guide](dual-screen-poc.md) for controls, limits and the
|
||||
physical acceptance still required. PDF loading and release bundles remain pending.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# CI and Jenkins setup
|
||||
|
||||
Create a Jenkins Multibranch Pipeline for `idle-org/pdf-presenter`, using the root
|
||||
Create a Jenkins Multibranch Pipeline for `idle-org/deckstride`, using the root
|
||||
`Jenkinsfile`, SCM credentials and the existing `rust_no_docker` worker. Repository
|
||||
upload does not create a Jenkins job. Configure branch discovery and a Gitea webhook
|
||||
in Jenkins/Gitea when connecting the job.
|
||||
|
|
@ -19,7 +19,7 @@ worker and other headless tests still run. The pipeline installs cargo-llvm-cov
|
|||
and the rustfmt, Clippy and llvm-tools-preview components.
|
||||
|
||||
The temporary Jenkins coverage floor is **60%**, selected explicitly by
|
||||
`PDF_PRESENTER_HEADLESS_CI=1` and `headless-line-floor` in `coverage.toml`. The normal
|
||||
`DECKSTRIDE_HEADLESS_CI=1` and `headless-line-floor` in `coverage.toml`. The normal
|
||||
local full-GUI floor remains **75%**. Both measure all production code, including
|
||||
GUI code; tool/test failures still fail the build and badges report the actual
|
||||
measurement. Restore full native testing and the 75% Jenkins floor when a display
|
||||
|
|
@ -33,7 +33,7 @@ cargo clippy --locked --workspace --all-targets --all-features -- -D warnings
|
|||
cargo test --locked --workspace --all-features
|
||||
cargo build --locked --workspace --all-features
|
||||
RUSTDOCFLAGS="-D warnings" cargo doc --locked --workspace --all-features --no-deps
|
||||
PDF_PRESENTER_GUI_TESTS=1 uv run --no-project --python ">=3.11" python scripts/ci.py coverage
|
||||
DECKSTRIDE_GUI_TESTS=1 uv run --no-project --python ">=3.11" python scripts/ci.py coverage
|
||||
```
|
||||
|
||||
Coverage measures the entire Rust workspace with the selected floor. Add all future
|
||||
|
|
@ -42,7 +42,7 @@ Canvas Pilot and have tests for invalid/stale reports and isolated publication.
|
|||
|
||||
Cleanup archives exactly `coverage/version.svg`, `coverage/test.svg` and
|
||||
`coverage/coverage.svg`. Only main builds without CHANGE_ID publish badges under
|
||||
`/mnt/assets/coverage/idle-org/pdf-presenter/main/`, including honest failed-test
|
||||
`/mnt/assets/coverage/idle-org/deckstride/main/`, including honest failed-test
|
||||
or unavailable-coverage status. No shared asset root is synchronized or deleted.
|
||||
There is no release job or binary upload in this pipeline.
|
||||
Separate local packaging uses [rust_realease](releases.md).
|
||||
|
|
@ -52,8 +52,13 @@ worker configuration or prove the remote pipeline has run.
|
|||
|
||||
The coverage command above needs a usable desktop session. On a headless POSIX host with Xvfb installed,
|
||||
run `uv run --no-project --python ">=3.11" python scripts/gui_ci.py python scripts/ci.py coverage` instead. To include
|
||||
native smoke in local workspace tests, set `PDF_PRESENTER_GUI_TESTS=1`. Without it,
|
||||
native smoke in local workspace tests, set `DECKSTRIDE_GUI_TESTS=1`. Without it,
|
||||
the ordinary tests remain headless and explicitly skip native-window smoke. CI uses
|
||||
neither the flag nor the virtual-display wrapper. Xvfb tests cannot
|
||||
validate actual monitor routing, compositor policy, macOS Spaces or Windows desktop
|
||||
behavior. The wrapper starts no network listener and alters no physical display.
|
||||
|
||||
The FreeBSD worker compiles without `keepawake`, whose native backends only support
|
||||
Linux, Windows and macOS. The helper reports sleep protection as unavailable on
|
||||
FreeBSD and waits for its parent pipe to close as usual. This does not establish
|
||||
FreeBSD sleep-inhibition support; supported desktop platforms retain their backends.
|
||||
|
|
|
|||
|
|
@ -7,20 +7,20 @@ explicitly activates mock output; the production document model still starts bla
|
|||
|
||||
## Run and test
|
||||
|
||||
Build with `cargo build --locked --release`, then run `target/release/pdf-presenter`
|
||||
(or `pdf-presenter.exe` on Windows). The executable contains the mock data and bitmap
|
||||
Build with `cargo build --locked --release`, then run `target/release/deckstride`
|
||||
(or `deckstride.exe` on Windows). The executable contains the mock data and bitmap
|
||||
font. It needs only normal OS desktop libraries; no PDF renderer, font download,
|
||||
configuration file or sibling repository is required. Each OS/architecture needs
|
||||
its own build; a Linux executable is not a Windows/macOS executable.
|
||||
|
||||
```sh
|
||||
cargo run --locked -p pdf-presenter
|
||||
cargo run --locked -p deckstride
|
||||
# Inspect display numbering without opening the two windows:
|
||||
cargo run --locked -p pdf-presenter -- --list-monitors
|
||||
cargo run --locked -p deckstride -- --list-monitors
|
||||
# Explicit selection (one-based display numbers from the listing):
|
||||
cargo run --locked -p pdf-presenter -- --presenter 1 --audience 2
|
||||
cargo run --locked -p deckstride -- --presenter 1 --audience 2
|
||||
# Keep both windows decorated for troubleshooting:
|
||||
cargo run --locked -p pdf-presenter -- --windowed
|
||||
cargo run --locked -p deckstride -- --windowed
|
||||
```
|
||||
|
||||
With one detected display, fullscreen views overlap. Use `--windowed` to open
|
||||
|
|
@ -79,7 +79,7 @@ The bitmap UI is test instrumentation, not the final presenter design. There is
|
|||
|
||||
Tests cover monitor assignment/invalid selection, navigation bounds, blanking,
|
||||
topology invalidation, negative-coordinate geometry, scaled pointer hit testing and
|
||||
software frames. `PDF_PRESENTER_GUI_TESTS=1 cargo test --locked --workspace` also opens
|
||||
software frames. `DECKSTRIDE_GUI_TESTS=1 cargo test --locked --workspace` also opens
|
||||
real native windows, exercises mock controls/fullscreen transitions and checks frames
|
||||
were presented to both surfaces. `--smoke-test` exposes that short automatic check.
|
||||
A virtual display proves native rendering/lifecycle only, not physical placement.
|
||||
|
|
|
|||
|
|
@ -2,8 +2,8 @@
|
|||
"tool": "built-in image_gen",
|
||||
"use_case": "logo-brand",
|
||||
"date": "2026-11-19",
|
||||
"asset": "crates/pdf-presenter/assets/app-icon.png",
|
||||
"prompt": "Use case: logo-brand\nAsset type: PDF Presenter desktop app icon and repository avatar, part of the beffroi-tools family.\nInput images: three reference icons showing the exact family style: dark charcoal rounded-square tile, softly beveled silver and bright turquoise objects, gentle 3D depth, subtle teal rim highlight. Use these as style references, not edit targets.\nPrimary request: Create a NEW matching family icon for a multiscreen PDF presenter. Inside the dark rounded-square tile, use a silver folded-corner document in front of a turquoise outlined presentation screen, and a simple bright turquoise play triangle on the document. Crisp bold uncluttered geometry, tactile satin metallic silver, very restrained dimensional shading. Distinct from the existing icons yet obviously in the same set.\nComposition: square, centered tile nearly fills frame, generous clear margins around the inner emblem, readable at 32px. Transparent exterior outside the tile, true alpha. No text, no letters, no watermark, no red, no blue, no photorealistic monitors, no elaborate background.",
|
||||
"asset": "crates/deckstride/assets/app-icon.png",
|
||||
"prompt": "Use case: logo-brand\nAsset type: Deckstride desktop app icon and repository avatar, part of the beffroi-tools family.\nInput images: three reference icons showing the exact family style: dark charcoal rounded-square tile, softly beveled silver and bright turquoise objects, gentle 3D depth, subtle teal rim highlight. Use these as style references, not edit targets.\nPrimary request: Create a NEW matching family icon for a multiscreen PDF presenter. Inside the dark rounded-square tile, use a silver folded-corner document in front of a turquoise outlined presentation screen, and a simple bright turquoise play triangle on the document. Crisp bold uncluttered geometry, tactile satin metallic silver, very restrained dimensional shading. Distinct from the existing icons yet obviously in the same set.\nComposition: square, centered tile nearly fills frame, generous clear margins around the inner emblem, readable at 32px. Transparent exterior outside the tile, true alpha. No text, no letters, no watermark, no red, no blue, no photorealistic monitors, no elaborate background.",
|
||||
"references": [
|
||||
"beffroi-tools/crates/pptx-reporter/assets/app-icon.png",
|
||||
"beffroi-tools/crates/rundown-converter/assets/app-icon.png",
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
@ -42,8 +42,10 @@ usage, approximate ETA and memory-pressure pause are explicit in the presenter.
|
|||
No application slide-file reads, decoding or rasterization occur on prepared navigation.
|
||||
OS paging can still occur; configuring enough available physical RAM remains necessary.
|
||||
|
||||
The default decoded budget is 1024 MiB per process, adjustable in Menu. Insufficient
|
||||
capacity pauses rather than evicts and never reports READY. Worker/texture memory is
|
||||
The default decoded budget is 15% of available RAM per process, with a soft
|
||||
512 MiB floor constrained to 20% of available RAM (64–16384 MiB operational bounds),
|
||||
adjustable in Menu. Insufficient capacity uses rolling eviction of non-active slides
|
||||
and never reports the entire deck as RAM-ready. Worker/texture memory is
|
||||
additional. See [cache](../interfaces/extraction-cache.md),
|
||||
[settings](../interfaces/settings.md) and [private IPC](../interfaces/process-protocol.md).
|
||||
|
||||
|
|
@ -88,6 +90,28 @@ This includes pipe transfer to the measurement process, not optical display late
|
|||
One sample under concurrent build load is diagnostic evidence, not a p95/worst-case
|
||||
benchmark or comparison against Pympress. The source PDF remains untracked and unchanged.
|
||||
|
||||
## 0.1.92 themes and interface languages
|
||||
|
||||
The existing 20 built-in Canvas Pilot-inspired palettes remain compile-time data.
|
||||
English, French, Spanish, Japanese, Simplified Chinese, German and Brazilian
|
||||
Portuguese are selectable, with supported native locales resolved once per process.
|
||||
Translations use static match tables: there is no catalog parsing, runtime file I/O
|
||||
or translation allocation. Detailed worker and operating-system diagnostics retain
|
||||
their original wording.
|
||||
|
||||
Theme application and locale/font setup now short-circuit when the selected value is
|
||||
already active. Japanese and Simplified Chinese share one embedded Noto Sans CJK
|
||||
collection; the appropriate face is installed once when a CJK language is selected
|
||||
and egui's default embedded fonts are restored when leaving it. This work does not
|
||||
change the independent output process, prepared-frame navigation, PDF workers or
|
||||
slide texture path.
|
||||
|
||||
Linux workspace/native tests, formatting, warnings-denied Clippy/rustdoc, optimized
|
||||
build and 13 Python helper tests pass. Whole-application GUI coverage is 83.89%
|
||||
against the 75% floor. CJK tests exercise both selected font faces and every theme/
|
||||
language combination renders the Presenter, browser and popups. This does not replace
|
||||
native Japanese/Chinese visual review or physical multi-display acceptance.
|
||||
|
||||
## Remaining acceptance and hardening
|
||||
|
||||
- User physical Windows/macOS/Linux X11/Wayland matrix: routing, swap, mixed DPI,
|
||||
|
|
@ -98,8 +122,8 @@ benchmark or comparison against Pympress. The source PDF remains untracked and u
|
|||
- Idle-timeout, AC/battery, blank-state and crash-release sleep checks on each OS.
|
||||
- Automatic reconnect to an orphan output host; Windows worker memory job limits;
|
||||
per-output process isolation where one display driver can stall a shared host.
|
||||
- Automatic disk cache quota/eviction and an unwritable-cache memory fallback.
|
||||
Current disk cache needs manual cleanup while closed; failures retain prior output.
|
||||
- Unwritable-cache memory fallback. Since 0.1.70 disk cache maintenance supports
|
||||
size/age limits and manual expunge, preserving active decks; failures retain output.
|
||||
- Explicit slide/notes-region cropping for notes-page PDFs, broader bundled CJK font
|
||||
coverage and pathological notes-layout latency. Current PDF notes are annotation
|
||||
Contents, not inferred speaker text embedded as page graphics.
|
||||
|
|
@ -133,7 +157,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.
|
||||
|
|
@ -226,7 +250,7 @@ memory remains additional. The source SHA-256 was unchanged after the test.
|
|||
Reproduce explicitly with an authorized local deck (never a CI/private fixture upload):
|
||||
|
||||
```sh
|
||||
PDF_PRESENTER_STRESS_PDF=/path/to/Ravenous.pdf cargo test --locked --release \
|
||||
DECKSTRIDE_STRESS_PDF=/path/to/Ravenous.pdf cargo test --locked --release \
|
||||
--test preparation real_pdf_exceeds_budget_and_keeps_navigating -- --ignored --nocapture
|
||||
```
|
||||
|
||||
|
|
@ -240,8 +264,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
|
||||
|
|
@ -290,3 +314,200 @@ formatting, warnings-denied Clippy/rustdoc and 13 Python tests pass; whole-app
|
|||
X11 coverage is 86.38%. Niri is unavailable here, so this verifies hint delivery,
|
||||
not Niri placement or physical multi-monitor acceptance. Windows/macOS were not
|
||||
built or runtime-tested for this Linux-only change.
|
||||
|
||||
|
||||
## Buffered page zoom — 0.1.54
|
||||
|
||||
Opt-in zoom crops UVs of the current cached texture, with bounded normalized panning
|
||||
and no oversized draw rectangle. All views share crop state via small coalesced IPC;
|
||||
page/epoch/serial checks prevent stale gestures from undoing navigation or reset.
|
||||
The output host updates its mirrors locally and retries the latest crop at 30 Hz
|
||||
until echoed. Full slide-buffer manifests are not resent for zoom-only updates.
|
||||
Tests cover anchor math, bounds, pointer gestures, settings migration, software
|
||||
pixels/unchanged texture uploads and host buffer preservation after deleting source
|
||||
and cache files. The manual software-drawing measurement is run with:
|
||||
|
||||
```sh
|
||||
cargo test --release --test zoom buffered_zoom_drawing_measurement -- --ignored --nocapture
|
||||
```
|
||||
|
||||
This synthetic measurement excludes OS presentation/compositor and physical mirror
|
||||
acceptance. Validate real pointer/trackpad input and simultaneous displays on each OS;
|
||||
only Linux development checks were run for this subject.
|
||||
|
||||
|
||||
The software renderer is bundled with a narrow cropped-quad optimization; see
|
||||
[`vendor/egui_software_backend/DECKSTRIDE-PATCH.md`](../../vendor/egui_software_backend/DECKSTRIDE-PATCH.md)
|
||||
for provenance and the precise changes. Fixed-point bilinear scanlines reuse two
|
||||
filtered rows and bounded coordinate tables. Large crops use four disjoint bands
|
||||
on a lazily initialized pool capped at four CPU threads per native process. This
|
||||
keeps image buffers shared, avoids PDF jobs and bounds additional scratch memory
|
||||
by viewport width. Font/tinted/general geometry keeps the original raster path.
|
||||
|
||||
|
||||
Local release-mode measurement (2026-11-20, Intel Core i5-8500, six logical CPUs,
|
||||
renderer pool capped at four): 1920×1080 source image, changing crop center every
|
||||
frame, two warm-up frames then ten timed frames per case. Median software drawing:
|
||||
|
||||
| Output size | Fitted/static 1× | Panning at 4× | Panning at 8× |
|
||||
| --- | ---: | ---: | ---: |
|
||||
| 1920×1080 | 0.79 ms | 4.83 ms | 4.29 ms |
|
||||
| 3840×2160 | 4.11 ms | 16.07 ms | 15.76 ms |
|
||||
|
||||
Maximum measured moving-frame time was 17.02 ms. The 1× case benefits from an
|
||||
unchanged cached primitive; moving crops deliberately invalidate that cache.
|
||||
These numbers include egui tessellation and software buffer drawing, exclude native
|
||||
surface/compositor/monitor latency, and are not a guaranteed display frame rate.
|
||||
The in-app watcher measures the actual native window draw/presentation call.
|
||||
|
||||
|
||||
## Screen-adapting zoom — 0.1.55
|
||||
|
||||
The default now grows the fitted page by the zoom factor into the entire viewport,
|
||||
then derives a clipped texture rectangle. Geometry never exceeds the viewport and
|
||||
UVs remain within the original image. No image resampling jobs, uploads or larger
|
||||
image buffers are added. The saved `zoom_keep_fitted_area` opt-in retains v0.1.54
|
||||
geometry. Each output computes its own aspect-correct crop from shared scale/center;
|
||||
input uses the actual visible UV span for anchoring and panning. Tests exercise
|
||||
portrait and landscape pages/screens, bounded edge panning and actual software pixels.
|
||||
The manual drawing benchmark now uses A4 page proportions on widescreen outputs.
|
||||
|
||||
Linux validation: formatting, warnings-denied Clippy/rustdoc, the full workspace
|
||||
coverage suite (including native window tests), and 13 Python helper tests pass.
|
||||
Whole-application line coverage is 86.25%. The release binary is rebuilt. On the
|
||||
same local i5-8500, the A4-proportioned crop benchmark reports moving-frame medians
|
||||
of 5.18/4.70 ms at 1080p (4×/8×) and 15.94/15.50 ms at 4K, maximum 16.87 ms.
|
||||
The synthetic texture remains 1920×1080; page metadata supplies A4 proportions to
|
||||
exercise viewport expansion. These are software-drawing measurements, not physical
|
||||
display latency. Windows/macOS were not built or runtime-tested for this change.
|
||||
|
||||
|
||||
## Escape and held navigation — 0.1.72
|
||||
|
||||
Browser Escape dismisses the preview/browser even when a control consumes keyboard
|
||||
input; it preserves audience visibility. Audience Escape can revert a display trial
|
||||
or close an orphan, but cannot blank a connected show. Synthetic focus-transfer key
|
||||
presses are ignored. B and explicit output Close retain their blanking behavior.
|
||||
|
||||
A constant-size monotonic hold state ignores OS repeat frequency. Native keys tick
|
||||
on the existing event loop; held mouse buttons redraw only when a repeat is due.
|
||||
Single steps start after 400 ms at 100 ms intervals, then batches of five/ten at
|
||||
160 ms intervals after two/five seconds (capped to 10% of the deck, minimum one).
|
||||
No missed ticks are replayed. Key release, focus loss or modifier changes cancel
|
||||
keyboard holds. Mouse release, leaving the button or hiding its controls cancels
|
||||
mouse holds. Skipped uncached destinations defer new rendering until input settles
|
||||
for 180 ms or ends; existing workers are not restarted on each repeat. Release can
|
||||
cancel one obsolete foreground job so the final destination gets priority. The
|
||||
last ready audience frame remains visible; RAM-ready destinations can show directly.
|
||||
|
||||
|
||||
## 0.1.73 multiwindow repaint scheduling
|
||||
|
||||
A native RedrawRequested event satisfies egui-winit's repaint response for that
|
||||
same event; it must not enqueue itself again. The old feedback loop continuously
|
||||
repainted idle windows and could starve later WM_PAINT delivery on Windows, where
|
||||
winit returns to its event loop after each paint. Each window now keeps one egui
|
||||
repaint deadline, consumed once when due; zero-delay animation requests are bounded
|
||||
to a 16 ms minimum. Input, slide changes and window transitions still request
|
||||
immediate redraws, regardless of focus. Window reconciliation precedes shared-state
|
||||
redraw requests so newly created mirrors participate too.
|
||||
|
||||
The Linux native regression opens three windows without clicking or explicitly
|
||||
focusing any of them, checks that each paints, and rejects continuous idle painting.
|
||||
This exercises the event path but does not prove physical three-monitor routing or
|
||||
Windows/macOS compositor behavior.
|
||||
|
||||
Restoring the old repaint feedback made the new regression fail with 1,520 idle
|
||||
paints in one second. The fixed version passes alongside the full Linux workspace
|
||||
and native tests, 13 Python helper tests, formatting, and warnings-denied Clippy
|
||||
and rustdoc. Whole-application coverage is 84.57% against the 75% floor. The Linux
|
||||
release binary is rebuilt; no Windows/macOS builds or publication were performed.
|
||||
|
||||
|
||||
## 0.1.74 reconnect placement
|
||||
|
||||
Topology changes now invalidate each native window's placement target and pending
|
||||
transition. Reconciliation reapplies its selected monitor and fullscreen mode even
|
||||
when the route ID is unchanged: an OS relocation during disconnect must not become
|
||||
permanent merely because the old ID/fullscreen tuple still matches. Missing windows
|
||||
are hidden before reconciliation; saved route choices and output visibility remain
|
||||
unchanged. Existing X11 staged placement is reused.
|
||||
|
||||
Regression coverage includes repeated disconnect/reconnect of the third and middle
|
||||
monitors, with the third assigned to either role and with output shown or blanked.
|
||||
The native three-window test also simulates a topology change while retaining route
|
||||
IDs and verifies all cached placements are discarded. These checks do not establish
|
||||
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.
|
||||
|
||||
|
||||
## 0.1.76 display-bound presenter layouts
|
||||
|
||||
Native presenter rendering takes a PresenterView by monitor ID from shared Studio
|
||||
session state. Each view owns its visual Layout and menu/layout-panel visibility;
|
||||
no temporary substitution of shared Studio layout state is used during rendering.
|
||||
The shared timer still reads the shared project/global timer configuration, and
|
||||
navigation/output/recovery state remain shared. Scoped save actions carry both
|
||||
monitor ID and a layout snapshot so another window rendering before dispatch cannot
|
||||
redirect a save. Settings persistence remains on the existing supervised worker.
|
||||
|
||||
The additive v1 display_layouts contract, bounds, fallback precedence and examples
|
||||
are documented in settings.md. Explicit saves persist per-display project/default
|
||||
profiles. Session edits survive ordinary hotplug; successful source/settings loads
|
||||
resolve profiles afresh. Per-window Escape dismisses only its local panels, while
|
||||
trial recovery retains priority. Native smoke exercises the actual display-scoped
|
||||
panels, and headless multi-context tests exercise save origin and isolation.
|
||||
|
||||
Validation: Linux workspace/native tests, 13 Python helper tests, formatting and
|
||||
warnings-denied Clippy/rustdoc pass. Whole-application coverage is 84.78% against
|
||||
the 75% floor. The Linux release binary is rebuilt. Windows/macOS builds and
|
||||
physical multi-presenter customization/reconnect acceptance remain open.
|
||||
|
||||
## Single-screen view — 0.1.89
|
||||
|
||||
Single screen is a saved display-view marker on an operator-owned presenter route.
|
||||
The independent audience host, its protocol and cached-base drawing path are
|
||||
unchanged. Native window identity, async chooser ownership, keyboard controls,
|
||||
supervised rendering and sleep leases reuse the existing presenter path. A distinct
|
||||
render branch replaces presenter notes/previews with a full-window slide; shared
|
||||
header/footer controls reveal as overlays. Presenter layouts remain untouched.
|
||||
Only already prepared full-slide frames are consumed. Each single-screen window
|
||||
retains at most one slide texture and one optional blank-picture texture; pending
|
||||
navigation retains the last ready slide, and a new document generation clears it.
|
||||
Idle repaint and edge reveals reuse texture uploads and fixed slide geometry.
|
||||
|
||||
A one-shot monitor-discovery latch, separate from hotplug routing and async settings
|
||||
completion, controls the startup offer. Zero or multiple initial monitors cannot
|
||||
later become eligible. A topology change withdraws a pending offer. Saved explicit
|
||||
single-screen choices and manual Displays edits use the existing timed display
|
||||
trial, with settings written only on confirmation. Display group swaps exclude
|
||||
Single screen monitors; ordinary Slides routes never gain reveal controls.
|
||||
|
||||
Regression tests cover startup decisions and disconnect/reconnect sequences,
|
||||
manual selection, reversible trials, role/privacy and blanking preservation,
|
||||
settings migration/validation, hidden notes/status, fixed slide geometry and
|
||||
texture reuse through pending navigation. Physical screen placement, edge input
|
||||
and display-mode transitions still require native testing on the target system.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,52 @@
|
|||
# Deckstride 0.1.101
|
||||
|
||||
This release adds installable language and theme packs while keeping Deckstride's
|
||||
fast, portable presentation workflow intact. Packs are ordinary data-only ZIP files:
|
||||
they work offline, are validated before installation, and appear in Preferences as
|
||||
soon as they are imported.
|
||||
|
||||
## Highlights since 0.1.96
|
||||
|
||||
- Import language packs and theme packs from **Preferences → General → Appearance**.
|
||||
Installed choices persist globally and load without network access.
|
||||
- Use the included documented example packs as templates for a new translation or
|
||||
visual theme. Pack sizes, paths, identifiers, revisions and expanded contents are
|
||||
bounded and validated before Deckstride accepts them.
|
||||
- Reorganize Preferences into clearer General, Presentation, Performance and Storage
|
||||
sections, while keeping the presentation controls that need quick access in the
|
||||
main menu.
|
||||
- Keep the Preferences window stable instead of resizing as the pointer moves.
|
||||
|
||||
Deckstride continues to provide independent Presenter and Slides windows, flexible
|
||||
multi-monitor routing and mirroring, per-screen layouts, buffered PDF rendering,
|
||||
notes, zoom, pointer and drawing tools, automatic playback, and display recovery.
|
||||
|
||||
## Downloads
|
||||
|
||||
Portable packages and cargo-binstall archives are provided for:
|
||||
|
||||
- Linux x86_64 GNU
|
||||
- Linux ARM64 musl
|
||||
- Windows x86_64 GNU
|
||||
- Apple Silicon macOS 13+
|
||||
- Intel macOS 13+
|
||||
|
||||
Windows and macOS packages are unsigned. On macOS, extract the archive and run:
|
||||
|
||||
```sh
|
||||
xattr -dr com.apple.quarantine /path/to/deckstride
|
||||
chmod +x /path/to/deckstride
|
||||
```
|
||||
|
||||
Rehearse Deckstride on the actual presentation computer, adapters and display
|
||||
arrangement before a live event.
|
||||
|
||||
## Validation
|
||||
|
||||
Linux formatting, warnings-denied Clippy and rustdoc, the Rust workspace tests,
|
||||
native GUI smoke and Python helper tests pass. The coverage runner completed its
|
||||
tests but could not satisfy the configured whole-application floor because LLVM
|
||||
profiles from intentionally terminated worker processes are incomplete. All five
|
||||
release targets are built and packaged from the tagged commit. Windows multi-screen
|
||||
behavior has been extensively tested in earlier releases; native runtime testing of
|
||||
each newly built archive remains appropriate before use in a live show.
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
# PDF Presenter 0.1.17 preview
|
||||
# Deckstride 0.1.17 preview
|
||||
|
||||
Portable PDF and image-folder presenter with fullscreen presenter/presentation
|
||||
views, monitor routing/mirroring, notes, slide browser, themes and English/French.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# PDF Presenter 0.1.24 preview
|
||||
# Deckstride 0.1.24 preview
|
||||
|
||||
Portable PDF and image-folder presenter for Linux and Windows x86_64, with separate
|
||||
fullscreen presenter/presentation views, monitor routing/mirroring, notes, slide
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
# PDF Presenter 0.1.33 preview
|
||||
# Deckstride 0.1.33 preview
|
||||
|
||||
Portable PDF and image-folder presenter for Linux and Windows x86_64. This preview
|
||||
includes the changes since 0.1.24:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,35 @@
|
|||
# Deckstride 0.1.68 preview
|
||||
|
||||
This preview adds live presentation tools while preserving the buffered rendering
|
||||
path. Open **Tools** in the presenter header for a low-latency pointer, straight
|
||||
arrows and translucent highlighting. Tool updates use bounded vector state over the
|
||||
existing slide texture; they do not rerender the PDF or read slide files. Large arrows
|
||||
now keep a clean, proportional filled head at every configured size.
|
||||
|
||||
## Highlights since 0.1.33
|
||||
|
||||
- Edit notes per slide in an asynchronous sidecar editor. Import TXT notes separated
|
||||
by dashed lines or Markdown notes split at headings, with review before saving.
|
||||
- Enable shared presenter/output page zoom when needed. Scroll to zoom, drag to pan,
|
||||
or double-click to fit the page width near the clicked position. Zoom reuses the
|
||||
buffered slide image.
|
||||
- Configure elapsed/countdown timing, start/pause/reset behavior, large timer text,
|
||||
six side positions and an optional sized slide-progress bar.
|
||||
- Use the redesigned resizable Layout and All slides windows. Browser thumbnails fit
|
||||
the available width, double-click opens a safe preview, and loading labels now
|
||||
distinguish RAM, disk cache, queued and active work.
|
||||
- Size the default decoded-slide buffer from available RAM. Rolling-buffer status and
|
||||
preparation feedback remain explicit without covering a hidden footer.
|
||||
- Keep display, layout, fullscreen and timer controls directly available in the
|
||||
presenter header. Presentation visibility survives fullscreen, routing and host
|
||||
recovery unless the operator explicitly blanks it.
|
||||
|
||||
## Packages
|
||||
|
||||
The release provides portable Linux x86_64 and Windows x86_64 bundles, standalone
|
||||
binaries, Cargo binstall archives and SHA-256 checksums. No Rust or PDF renderer is
|
||||
required at runtime. The Windows build is unsigned. macOS is not packaged in this
|
||||
preview.
|
||||
|
||||
Physical multi-monitor routing, sleep inhibition, pointer latency and appearance
|
||||
should still be rehearsed on the exact machines and displays used for a live event.
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
# Deckstride 0.1.71 preview
|
||||
|
||||
This preview adds disk-cache controls in **Menu → Preferences → Disk cache**.
|
||||
Set a maximum total size (default **10 GiB**) and lifetime (default **30 days since
|
||||
rendering**), or use **Expunge unused cache now** to reclaim space manually.
|
||||
|
||||
Automatic cleanup runs **once at startup, after initial document loading, notes
|
||||
loading and slide preparation finish**. There are no periodic scans during the
|
||||
session. Cleanup removes expired artifacts and then the oldest files to meet the
|
||||
size target. Active decks are protected and may temporarily exceed the limits;
|
||||
source documents and presenter notes are preserved. Changing limits applies at the
|
||||
next startup; manual expunge remains available immediately.
|
||||
|
||||
Since 0.1.68, the unsupported-platform keep-awake protocol test was also corrected.
|
||||
Linux formatting, warnings-denied Clippy/rustdoc, workspace and native-window tests,
|
||||
and Python helper tests pass. Whole-application line coverage is **84.46%** against
|
||||
the 75% floor.
|
||||
|
||||
## Packages and preview status
|
||||
|
||||
Portable Linux x86_64 and Windows x86_64 bundles, standalone binaries, Cargo binstall
|
||||
archives and SHA-256 checksums are provided. No Rust toolchain or separately installed
|
||||
PDF renderer is required at runtime. The Windows executable is unsigned; macOS is
|
||||
not packaged.
|
||||
|
||||
Windows runtime, clean-machine, physical multiscreen, sleep and performance
|
||||
acceptance remain open. Rehearse on the machines and displays intended for the show;
|
||||
a successful build or Linux smoke test does not establish those acceptance gates.
|
||||
|
|
@ -0,0 +1,43 @@
|
|||
# Deckstride 0.1.75 preview
|
||||
|
||||
This preview includes the monitor and navigation fixes since 0.1.71:
|
||||
|
||||
- Remove an idle repaint loop that could delay other selected monitors until their
|
||||
windows were clicked. Each window now follows its own bounded repaint deadlines.
|
||||
- Reapply window placement after unplug/replug and monitor-layout changes, even
|
||||
when the selected monitor IDs and fullscreen flags remain unchanged.
|
||||
- Refresh all presenters when a display trial changes. One **Keep changes** click
|
||||
on either presenter confirms the entire setup and dismisses both dialogs.
|
||||
- Closing **All slides** with Escape preserves the live show, including when focus
|
||||
moves to an audience window. **B** remains the explicit blank shortcut.
|
||||
- Hold Next/Previous or navigation keys to accelerate from individual slides to
|
||||
bounded batches. Rendering coalesces destinations and stops on release/focus loss.
|
||||
|
||||
The disk-cache size/lifetime controls and once-per-startup cleanup from 0.1.71
|
||||
remain included.
|
||||
|
||||
## Windows testing
|
||||
|
||||
Use the Windows x86_64 standalone executable or extract the portable ZIP and run
|
||||
**deckstride.exe**. No Rust toolchain or separately installed PDF backend is
|
||||
required. The executable is unsigned.
|
||||
|
||||
Please exercise three displays with two presenters and one audience output:
|
||||
confirm a display change once from either presenter; verify every selected presenter
|
||||
appears without clicking its window; unplug/replug the third and middle displays;
|
||||
and check that the live slide and blank state survive. Also test Escape in All
|
||||
slides and held navigation in both directions. These physical Windows behaviors
|
||||
remain acceptance checks, not claims established by the Linux tests.
|
||||
|
||||
## Validation and packages
|
||||
|
||||
Linux formatting, warnings-denied Clippy/rustdoc, workspace/native tests, and 13
|
||||
Python helper tests pass. Whole-application coverage is **84.56%** (75% floor).
|
||||
Regression tests cover three native windows without clicks, topology invalidation,
|
||||
repeated simulated third/middle-monitor reconnects, and one-click confirmation
|
||||
across two independent presenter contexts.
|
||||
|
||||
Linux x86_64 and Windows x86_64 standalone binaries, portable bundles, Cargo
|
||||
binstall archives and SHA-256 checksums are provided. macOS is not packaged.
|
||||
Windows runtime, physical multiscreen, clean-machine, sleep and performance
|
||||
acceptance remain open; this is a preview for testing.
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
# Deckstride 0.1.77 preview
|
||||
|
||||
This preview adds two features since 0.1.75:
|
||||
|
||||
- **Independent presenter layouts per display.** Customize each presenter's widgets,
|
||||
sizes, positions, bars and presets, with saved defaults and project overrides
|
||||
tied to its monitor. Timer behavior and start/pause/reset remain shared; each
|
||||
presenter chooses its own timer appearance.
|
||||
- **Custom blank picture.** Use **Preferences → Blank presentation → Choose
|
||||
picture…** to select the picture shown by the existing blank button/B shortcut.
|
||||
A bounded copy is saved across restarts and fitted on all audience outputs
|
||||
against black. **Use solid black** restores the default. Slide zoom and
|
||||
annotations do not affect the picture.
|
||||
|
||||
The monitor synchronization/reconnection, shared display confirmation and held
|
||||
navigation fixes from 0.1.75 remain included.
|
||||
|
||||
## Windows testing
|
||||
|
||||
Download the Windows x86_64 standalone executable, or extract the portable ZIP
|
||||
and run **deckstride.exe**. No Rust toolchain or separately installed PDF
|
||||
backend is required. The executable is unsigned.
|
||||
|
||||
With two presenters and an audience display, customize the presenters differently,
|
||||
save their layouts and restart/reconnect the monitors. Verify that the layouts
|
||||
follow their displays while timer controls remain shared. Choose a blank picture,
|
||||
blank/unblank, restart, and switch back to solid black. Also check the previous
|
||||
three-monitor synchronization, one-click confirmation and hotplug fixes.
|
||||
|
||||
## Validation and packages
|
||||
|
||||
Linux workspace/native tests, 13 Python helper tests, formatting, warnings-denied
|
||||
Clippy/rustdoc and the optimized build pass. Whole-application line coverage is
|
||||
**84.56%**, exceeding the 75% floor.
|
||||
|
||||
Linux x86_64 and Windows x86_64 standalone executables, portable bundles, Cargo
|
||||
binstall archives and SHA-256 checksums are provided. macOS is not packaged.
|
||||
Windows runtime, physical multiscreen, clean-machine, sleep and performance
|
||||
acceptance remain open; this is a preview for testing.
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
# Deckstride 0.1.78 preview
|
||||
|
||||
This preview focuses on Windows presentation responsiveness and desktop integration:
|
||||
|
||||
- **Faster audience overlays.** Each audience window keeps one bounded base
|
||||
framebuffer and reuses it for pointer and annotation updates. Moving the pointer
|
||||
no longer rescales and rasterizes the full slide every time. Slide, zoom, color,
|
||||
DPI, blanking and resize changes invalidate the cache; recovery controls bypass
|
||||
it. The additional cache is capped at 64 MiB per audience window.
|
||||
- **Cleaner Windows startup.** The release executable uses the Windows GUI subsystem,
|
||||
so opening it does not create a terminal window. Audience windows are created
|
||||
without activation and the presenter explicitly requests focus when first shown.
|
||||
- **PDF file icon and association.** Use **Menu → Preferences → Windows integration
|
||||
→ Choose as PDF app…**. Deckstride registers its executable, open command and
|
||||
embedded icon for the current user, refreshes Explorer and opens Default Apps.
|
||||
Windows requires you to confirm the default PDF application there. Keep the
|
||||
portable folder in a permanent location and repeat this action after moving it.
|
||||
|
||||
## Windows testing
|
||||
|
||||
Extract the Windows x86_64 portable ZIP and run **deckstride.exe**. Confirm that
|
||||
no terminal appears and that the presenter accepts keyboard input immediately while
|
||||
the audience window remains on the selected output. On a high-resolution audience
|
||||
display, compare pointer, arrow and highlighter tracking with 0.1.77, including zoom
|
||||
and mirrored audience outputs.
|
||||
|
||||
Register Deckstride in Preferences, select it for `.pdf` in Default Apps, then
|
||||
check that Explorer shows the Deckstride icon and double-clicking a PDF opens it.
|
||||
The executable is unsigned, and the association is per user without administrator
|
||||
rights.
|
||||
|
||||
## Validation and packages
|
||||
|
||||
Linux all-feature tests, 13 Python helper tests, formatting, warnings-denied
|
||||
Clippy/rustdoc and the optimized build pass. Headless whole-application line
|
||||
coverage is **68.39%**, exceeding its 60% CI floor. Full GUI coverage could not run
|
||||
locally because Xvfb is unavailable.
|
||||
|
||||
Linux x86_64 and Windows x86_64 standalone executables, portable bundles, Cargo
|
||||
binstall archives and SHA-256 checksums are provided. macOS is not packaged.
|
||||
Windows runtime, physical multiscreen, initial-focus, association, clean-machine,
|
||||
sleep and performance acceptance remain open; this is a preview for testing.
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
# Deckstride 0.1.81 preview
|
||||
|
||||
This preview makes multi-Presenter layouts clearer and improves Windows desktop
|
||||
integration.
|
||||
|
||||
- **Presenter and Slides.** The two screen roles now use these names throughout
|
||||
the interface and guide.
|
||||
- **Edit any Presenter layout.** Open Layout on any Presenter and use **Edit layout
|
||||
for** to customize another connected Presenter screen. Live edits and both save
|
||||
actions remain scoped to the selected screen, including per-project layouts.
|
||||
- **Default PDF application.** Windows Preferences now shows a visible **Set as
|
||||
default PDF app…** button. It registers the portable executable, open command and
|
||||
embedded PDF icon for the current user, then opens Default Apps for Windows'
|
||||
required confirmation.
|
||||
- **More reliable initial keyboard focus on Windows.** Presenter activation is
|
||||
retried for a short bounded period while fullscreen Slides windows finish mapping.
|
||||
A Win32 input-queue fallback aims to make Left/Right work immediately without a
|
||||
preliminary mouse click. The sequence ends after startup and does not keep
|
||||
stealing focus.
|
||||
|
||||
## Windows testing
|
||||
|
||||
Extract the Windows x86_64 portable ZIP and run **deckstride.exe**. Confirm that
|
||||
the Presenter accepts Left/Right immediately after launch, including with two or
|
||||
more fullscreen displays. Repeat from Explorer, a PDF file association and a pinned
|
||||
shortcut. Open All slides during startup and confirm that it retains focus.
|
||||
|
||||
In Preferences, choose **Set as default PDF app…**, select Deckstride for `.pdf`
|
||||
in Windows Default Apps, then verify that Explorer uses the Deckstride icon and
|
||||
double-clicking a PDF opens it. Registration is per user and requires no
|
||||
administrator rights. Keep the portable folder in a permanent location.
|
||||
|
||||
With two Presenter screens, edit each from the other's Layout window. Save one as a
|
||||
project layout and the other as an all-project layout, restart, and confirm their
|
||||
visual settings remain independent.
|
||||
|
||||
## Validation and packages
|
||||
|
||||
Formatting, warnings-denied host and Windows-target Clippy, the complete Rust test
|
||||
suite and all Python packaging tests pass. Headless whole-application line coverage
|
||||
for 0.1.79 was **68.66%**, above its 60% CI floor.
|
||||
|
||||
Linux x86_64 and Windows x86_64 standalone executables, portable bundles, Cargo
|
||||
binstall archives and SHA-256 checksums are provided. macOS is not packaged.
|
||||
Windows foreground activation, file association, physical multiscreen,
|
||||
clean-machine, sleep and performance behavior remain acceptance checks; this is a
|
||||
preview for testing.
|
||||
|
|
@ -0,0 +1,34 @@
|
|||
# Deckstride 0.1.83 preview
|
||||
|
||||
This preview improves settings organization and makes presentation tools easier to
|
||||
judge across Presenter previews and high-resolution Slides screens.
|
||||
|
||||
- **A clearer Preferences window.** Advanced settings now live in a resizable,
|
||||
scrollable window. Blank-output artwork, Windows PDF integration, RAM and disk
|
||||
cache controls, cleanup, preparation status and storage paths no longer crowd the
|
||||
Menu dropdown. Zoom, fitted-area behavior and automatic Slides output remain in
|
||||
Menu for quick access.
|
||||
- **Consistent tool sizing.** Pointer, highlighter and arrow dimensions scale with
|
||||
the visible slide height. Their relative size now stays comparable in the smaller
|
||||
Presenter preview, on 1080p output, on 4K output and across OS display scaling.
|
||||
The maximum selectable size increases from 32 to 48; on a 4K Slides screen it is
|
||||
rendered at roughly twice the physical width used on 1080p.
|
||||
- **Transparent project information.** The README states the MIT license and notes
|
||||
that development uses LLM-generated or LLM-assisted code with human review.
|
||||
|
||||
## Validation and packages
|
||||
|
||||
Formatting, warnings-denied Clippy and rustdoc, 129 automated Rust tests and 13
|
||||
Python build-helper tests pass on Linux. The tool-size path remains a lightweight
|
||||
vector overlay and does not rerender slide images. Windows-target validation on the
|
||||
release builder includes the embedded application icon; local cross-Clippy could not
|
||||
pass that resource step because MinGW `windres` is unavailable on the host.
|
||||
The memory-budget probe is pinned to a Rust 1.93-compatible dependency for the
|
||||
pinned Apple cross-build toolchain.
|
||||
|
||||
Linux x86_64, Windows x86_64 and, for this release, Apple Silicon macOS 13+
|
||||
standalone executables, Cargo binstall archives and SHA-256 checksums are provided.
|
||||
Linux and Windows also receive portable bundles. The macOS executable is unsigned
|
||||
and cross-built from Linux; native Mac startup and multiscreen behavior have not
|
||||
been tested. Windows runtime, physical multiscreen, clean-machine, sleep and
|
||||
performance acceptance remain open; this is a preview for testing.
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
# Deckstride 0.1.90 preview
|
||||
|
||||
This preview adds display controls and an optional single-screen presentation view.
|
||||
|
||||
- **Single-screen view.** Select Single screen in Displays for full-window slides
|
||||
with controls revealed at the top and bottom edges. The app offers this mode
|
||||
only when it starts with exactly one screen, explaining that Deckstride is
|
||||
intended for separate Presenter and Slides screens. Later disconnects never
|
||||
trigger the offer. Saved Presenter layouts and the independent audience host
|
||||
remain separate; controls overlay the slide without resizing it.
|
||||
- **Per-screen window modes.** Choose Follow global, Always fullscreen or Always
|
||||
windowed. Overrides ignore global fullscreen commands, follow the monitor, and
|
||||
use the existing Apply / Keep / Revert confirmation.
|
||||
- **Hold S to swap.** Hold S for one second in Presenter or All slides to swap
|
||||
Presenter and Slides groups with a timed confirmation. Single screen assignments
|
||||
remain in place. Short taps and keyboard repeats do not repeatedly swap screens.
|
||||
- **Confirmed quitting.** Escape and Ctrl+Q request a Quit presentation dialog;
|
||||
Cancel or Escape continues the show. Unsaved notes remain protected. Escape
|
||||
still reverts an active display trial first. Audience shortcuts request the
|
||||
confirmation on Presenter without showing operator dialogs or blanking Slides.
|
||||
- **Installation documentation.** The README includes application screenshots and
|
||||
a repository-based cargo-binstall command for published releases.
|
||||
|
||||
## Validation and packages
|
||||
|
||||
Linux formatting, warnings-denied Clippy/rustdoc, workspace tests, build and 13
|
||||
Python helper tests pass for the implementation. Regression coverage includes
|
||||
startup-only eligibility, disconnect sequences, settings round trips, display
|
||||
trials, quit confirmation, edge controls, fixed slide geometry and texture reuse.
|
||||
Full GUI coverage also passes outside the restricted sandbox: **84.83%** against
|
||||
the 75% floor, including native-window tests. These checks do not establish physical
|
||||
multiscreen, clean-machine or measured presentation-latency acceptance.
|
||||
|
||||
Linux x86_64 and Windows x86_64 standalone binaries, cargo-binstall archives,
|
||||
portable bundles and SHA-256 checksums are provided. Windows is unsigned. This
|
||||
release does not include a new macOS build; v0.1.83 retains its one-off Apple
|
||||
Silicon preview. Native Windows runtime, clean-machine, physical multiscreen,
|
||||
sleep and measured latency acceptance remain open. Test the actual presentation
|
||||
computer and display arrangement before a live event.
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
# Deckstride 0.1.91
|
||||
|
||||
Deckstride releases are now regular releases rather than previews. The version
|
||||
remains below 1.0 while the project continues to refine platform integration and
|
||||
physical-display acceptance.
|
||||
|
||||
## Expanded platform packages
|
||||
|
||||
This release provides standalone binaries, cargo-binstall archives, portable
|
||||
bundles and SHA-256 checksums for:
|
||||
|
||||
- Linux x86_64 GNU
|
||||
- Linux ARM64 musl
|
||||
- Windows x86_64 GNU
|
||||
- Apple Silicon macOS 13+
|
||||
- Intel macOS 13+
|
||||
|
||||
The Linux ARM64 build uses musl for a portable executable. Both macOS builds use a
|
||||
pinned cross-build image and macOS 13 deployment target. Windows and macOS builds
|
||||
are unsigned. The release page includes the commands needed to run the unsigned
|
||||
macOS archives.
|
||||
|
||||
## Validation
|
||||
|
||||
Linux formatting, warnings-denied Clippy/rustdoc, workspace tests, build and 13
|
||||
Python helper tests pass. Full GUI coverage is **84.79%** against the 75% floor.
|
||||
The release pipeline also verifies target architecture, archive layout, checksums,
|
||||
system-library dependencies and isolated cargo-binstall extraction for every
|
||||
target. Linux x86_64 receives the native-window smoke test. macOS artifacts cannot
|
||||
be executed on the Linux release host, and native Windows/macOS runtime,
|
||||
clean-machine and physical multiscreen acceptance remain open. Rehearse on the
|
||||
actual presentation computer and display arrangement before a live event.
|
||||
|
|
@ -0,0 +1,44 @@
|
|||
# Deckstride 0.1.96
|
||||
|
||||
This is the first release under the **Deckstride** name. The application, executable,
|
||||
portable archives, desktop integration and repository now use the new identity. The
|
||||
established application icon remains unchanged.
|
||||
|
||||
## What changed since 0.1.91
|
||||
|
||||
- Add automatic playback with a configurable slide interval and optional looping.
|
||||
Playback waits until the requested slide is visible and pauses for dialogs and
|
||||
safety states.
|
||||
- Add built-in Spanish, Japanese, Simplified Chinese, German and Brazilian Portuguese
|
||||
alongside English and French, with offline system-language detection.
|
||||
- Show the open PDF or picture-folder path in the Presenter footer and show the
|
||||
running portable executable path in Preferences.
|
||||
- Preserve existing user settings during the Deckstride rename and continue using
|
||||
an existing warm rendered-slide cache instead of forcing every presentation to
|
||||
render again.
|
||||
|
||||
The existing multiscreen routing, mirrored Presenter or Slides outputs, per-screen
|
||||
layouts, buffered rendering, notes, zoom, pointer tools and display recovery remain
|
||||
the core of the release.
|
||||
|
||||
## Downloads
|
||||
|
||||
Portable packages and cargo-binstall archives are provided for:
|
||||
|
||||
- Linux x86_64 GNU
|
||||
- Linux ARM64 musl
|
||||
- Windows x86_64 GNU
|
||||
- Apple Silicon macOS 13+
|
||||
- Intel macOS 13+
|
||||
|
||||
Windows and macOS packages are unsigned. The macOS packages are cross-built on Linux
|
||||
and include the release-page command for opening an unsigned application. Rehearse on
|
||||
the actual presentation computer, adapters and display arrangement before a live
|
||||
event.
|
||||
|
||||
## Validation
|
||||
|
||||
Linux formatting, warnings-denied Clippy and rustdoc, the complete Rust workspace
|
||||
test suite, and all 13 Python CI/launcher tests pass. Windows multi-screen behavior
|
||||
has been extensively tested in earlier releases; native runtime testing of these new
|
||||
archives remains appropriate before use in a live show.
|
||||
|
|
@ -1,23 +1,24 @@
|
|||
# Manual preview releases
|
||||
# Manual releases
|
||||
|
||||
The standalone `rust_realease` tool (sibling checkout `../rust_realease`) consumes
|
||||
root `rust-release.toml` and `Cross.toml`. Jenkins still only validates/publishes
|
||||
badges. The release configuration selects Linux x86_64 GNU and Windows x86_64 GNU.
|
||||
macOS remains an implementation target, but is not advertised as a prepared release
|
||||
artifact until a linked native build and runtime acceptance are available.
|
||||
badges. The release configuration selects Linux x86_64 GNU, Linux ARM64 musl,
|
||||
Windows x86_64 GNU, and both Apple Silicon and Intel macOS 13+ targets. Releases are
|
||||
ordinary releases below 1.0; do not pass `--prerelease` during publication.
|
||||
|
||||
Build local artifacts without a token or contacting Gitea:
|
||||
|
||||
```sh
|
||||
CROSS_CONTAINER_ENGINE=podman ../rust_realease/target/release/rust_realease . \
|
||||
--package pdf-presenter --compile-only
|
||||
--package deckstride --compile-only
|
||||
```
|
||||
|
||||
Use the installed `rust_realease` command instead if preferred. Cross must have
|
||||
access to its configured images. Outputs live under `dist/` (the tool prints the final release directory), including
|
||||
raw executables, binstall `.tgz` archives, a Linux portable `.tgz`, a Windows
|
||||
portable `.zip`, and `SHA256SUMS`. The binaries themselves need no companion assets.
|
||||
Portable bundles add the license, quickstart and optional Python Linux launcher.
|
||||
raw executables, binstall `.tgz` archives, portable bundles, `SHA256SUMS` and an
|
||||
artifact manifest. Windows portable bundles use ZIP; other targets use `.tgz`.
|
||||
The binaries themselves need no companion assets. Portable bundles add the license,
|
||||
quickstart and optional Python Linux launcher.
|
||||
Wayland shells resolve icons through the matching installed desktop entry;
|
||||
X11 and Windows also receive the embedded native window icon directly.
|
||||
The Windows PE icon is embedded at build time using winresource/windres.
|
||||
|
|
@ -27,19 +28,25 @@ ignored and never included in archives. Dependency notices are embedded (`--lice
|
|||
and regenerated with `python3 scripts/notices.py` after dependency changes.
|
||||
|
||||
Before publication, run all checks in [CI](ci.md), inspect bundle contents and
|
||||
checksums, and test extracted binaries on clean Windows/Linux machines. Physical
|
||||
multiscreen, sleep and performance acceptance remains in [the plan](plan.md).
|
||||
Version 0.1.33 is prepared as a **preview**, not a production-readiness claim.
|
||||
checksums, and test extracted binaries on available native platforms. Cross-built
|
||||
macOS artifacts require the generated release-page workaround and native Mac testing
|
||||
when available. Physical multiscreen, sleep and performance acceptance remains in
|
||||
[the plan](plan.md).
|
||||
|
||||
Publication is a separate explicit action: create local `v0.1.33` at the reviewed
|
||||
Publication is a separate explicit action: create the version tag at the reviewed
|
||||
commit, push that commit/tag, then run:
|
||||
|
||||
```sh
|
||||
rust_realease . --package pdf-presenter --prerelease \
|
||||
--message-file docs/development/release-notes/v0.1.33.md \
|
||||
--token-file ../gitea-token.txt
|
||||
rust_realease . --package deckstride \
|
||||
--message-file docs/development/release-notes/vVERSION.md \
|
||||
--token-file ../release-tokens.json
|
||||
```
|
||||
|
||||
`release-tokens.json` is an untracked JSON object with `gitea` and `github`
|
||||
keys. The matching tokens need repository read and release write access. As an
|
||||
alternative, set `GITEA_TOKEN` and `GITHUB_TOKEN` in the release environment.
|
||||
The publisher uploads and verifies the same artifacts on both services.
|
||||
|
||||
`--dry-run` previews without remote mutation. Before tagging, its missing-tag
|
||||
prerequisite is expected. Do not use automatic tag/push options as part of local
|
||||
preparation. Never put credentials in configuration, artifacts or Git.
|
||||
|
|
@ -47,7 +54,7 @@ preparation. Never put credentials in configuration, artifacts or Git.
|
|||
## Local validation for 0.1.33
|
||||
|
||||
Built Linux x86_64 GNU and Windows x86_64 GNU from commit `6bba0c4` with
|
||||
`CROSS_CONTAINER_ENGINE=podman rust_realease . --package pdf-presenter --compile-only`.
|
||||
`CROSS_CONTAINER_ENGINE=podman rust_realease . --package deckstride --compile-only`.
|
||||
Artifacts are in `dist/release-oTFW9Q/`. The installed tool is 0.1.6-rc.2: it builds
|
||||
raw binaries and binstall archives but does not implement the configured portable
|
||||
bundles. Those two bundles were assembled from the same binaries using exactly the
|
||||
|
|
|
|||
|
|
@ -11,14 +11,15 @@ T06 bundled renderer/codecs (Hayro replaces PDFium); T07 bounded pipes; T08 real
|
|||
T08a folders; T09 priorities; T10 worker deadlines; T11/T12 verified atomic caches;
|
||||
T13 bounded decoded cache; T14 software composition; T16 approved presenter/browser
|
||||
workflow; T17 asynchronous annotation/sidecar notes; T18 last-frame crash hold and
|
||||
blanked output-host restart. T01 full latency instrumentation, T15 disk quota,
|
||||
blanked output-host restart. 0.1.70 adds T15 disk size/age cleanup with active-deck
|
||||
protection and manual expunge. T01 full latency instrumentation,
|
||||
T17 explicit notes-region crop, T18 reconnect, platform acceptance and clean-machine
|
||||
release checks remain open. Do not mark their broader acceptance from this code alone.
|
||||
|
||||
0.1.13 adds whole-deck processed-frame reuse and RAM preparation to T09/T12/T13:
|
||||
two workers, screen-derived resolution, cache-first opening, retained complete buffers,
|
||||
explicit preparation progress/ETA and memory-pressure pause. T01's full optical
|
||||
latency matrix and T15's persistent disk quota remain open.
|
||||
latency matrix remains open; T15's persistent disk quota was added in 0.1.70.
|
||||
|
||||
0.1.19 replaces the memory-pressure pause with bounded rolling eviction, while
|
||||
retaining full RAM residency when the deck fits. Processed-page progress is separate
|
||||
|
|
|
|||
|
After Width: | Height: | Size: 44 KiB |
|
After Width: | Height: | Size: 133 KiB |
|
After Width: | Height: | Size: 129 KiB |
|
After Width: | Height: | Size: 145 KiB |
|
|
@ -0,0 +1,28 @@
|
|||
# Managed blank picture v1
|
||||
|
||||
One optional asset lives at `blank-picture.rgba` next to settings.toml. Settings v1
|
||||
`blank_picture` selects it; missing/false means solid black. It is independent of
|
||||
document caches and their cleanup. Reset disables the asset, retaining at most
|
||||
one bounded file; the next successful import atomically replaces it.
|
||||
|
||||
The v1 binary representation uses the existing frame envelope: unsigned
|
||||
little-endian u32 width, u32 height, row-major unpremultiplied RGBA8 pixels, then
|
||||
32 raw SHA256 bytes covering the header and pixels. Width and height must be
|
||||
1–2048; length must be exactly 8 + width × height × 4 + 32 bytes. Maximum file
|
||||
size is 16 MiB + 40 bytes. FrameInfo.sha256 is lowercase hex of that same digest.
|
||||
Invalid dimensions, lengths or checksum are rejected; there is no permissive
|
||||
interpretation of other versions. No source filename or operator notes are stored.
|
||||
|
||||
A killable worker reads at most 64 MiB of source data, with image decoder limits
|
||||
of 256 MiB allocation and 32768 pixels per source edge. Images are proportionally
|
||||
resized to fit 2048 × 2048 without upscaling; animated sources use a still frame.
|
||||
Import failure preserves the existing copy/selection. The original is read-only.
|
||||
|
||||
The presenter and output each retain at most 16 MiB of decoded blank pixels,
|
||||
separately from slide-cache budgets; native output textures are bounded per
|
||||
window. Loading is asynchronous and the output compares the returned digest,
|
||||
dimensions and path with its request to reject stale replacement reads.
|
||||
A missing/corrupt asset stays black; no slide is substituted. Output fits the
|
||||
whole image on black, including transparency, without zoom or annotations.
|
||||
Tests cover normalized import/load round trips, deleted sources, corruption,
|
||||
failed replacement, worker import/reset and native blank/show acknowledgements.
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
version = 1
|
||||
|
||||
[notes]
|
||||
"1" = "Welcome — introduce the presentation."
|
||||
"2" = "" # Intentionally blank, even if the PDF contains an annotation.
|
||||
"3" = """
|
||||
Explain the diagram.
|
||||
Pause for questions.
|
||||
"""
|
||||
|
|
@ -1,5 +1,13 @@
|
|||
version = 1
|
||||
# Optional slide-first view on an operator-owned route (0.1.89+).
|
||||
single_screens = ["Primary#1"]
|
||||
auto_show = true
|
||||
autoplay_enabled = false
|
||||
autoplay_seconds = 5.0
|
||||
autoplay_loop = false
|
||||
blank_picture = false
|
||||
zoom_enabled = false
|
||||
zoom_keep_fitted_area = false
|
||||
theme = "midra"
|
||||
language = "system"
|
||||
presenter_fullscreen = true
|
||||
|
|
@ -7,6 +15,10 @@ presentation_fullscreen = true
|
|||
thumbnail_size = 220.0
|
||||
buffer_mib = 1024
|
||||
|
||||
[disk_cache]
|
||||
max_mib = 10240
|
||||
max_days = 30
|
||||
|
||||
[slide_colors]
|
||||
page_background = [255, 255, 255]
|
||||
fit_padding = [0, 0, 0]
|
||||
|
|
@ -19,9 +31,32 @@ presentation = ["Projector#1"]
|
|||
elapsed_position = "above_slides"
|
||||
clock_position = "below_notes"
|
||||
slide_progress = true
|
||||
slide_progress_height = 32.0
|
||||
timer_mode = "countdown"
|
||||
countdown_seconds = 1200
|
||||
timer_autostart = true
|
||||
header = true
|
||||
footer = false
|
||||
|
||||
[layout.current]
|
||||
show = false
|
||||
size = 60.0
|
||||
|
||||
# Optional per-display visual profiles (0.1.76+).
|
||||
[display_layouts."Secondary#1".layout]
|
||||
header = false
|
||||
clock_position = "left_of_slides"
|
||||
|
||||
[display_layouts."Secondary#1".layout.notes]
|
||||
show = false
|
||||
size = 35.0
|
||||
|
||||
[display_layouts."Secondary#1".projects."0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"]
|
||||
slide_progress = true
|
||||
slide_progress_height = 40.0
|
||||
|
||||
# Per-screen mode overrides (0.1.87+), independent of display roles.
|
||||
[screen_modes]
|
||||
"Primary#1" = "always_windowed"
|
||||
"Secondary#1" = "always_fullscreen"
|
||||
"Third#1" = "follow_global"
|
||||
|
|
|
|||
|
|
@ -54,4 +54,48 @@ Stale reads for evicted entries are discarded. READY requires the whole deck to
|
|||
resident in both processes; rolling-buffer mode explicitly permits background disk
|
||||
reads and is never described as fully RAM-buffered. OS paging and software composition
|
||||
are outside this application-level no-file-read guarantee. The disk schema remains v1.
|
||||
Disk eviction/quota remains outstanding; full disk reports an explicit error.
|
||||
## Disk retention — 0.1.70
|
||||
|
||||
Menu → Preferences → Disk cache controls total size (default 10240 MiB / 10 GiB)
|
||||
and lifetime (default 30 days), with **Expunge unused cache now** to remove all
|
||||
eligible artifacts regardless of age/size. One day is 86400 seconds. Age is measured
|
||||
from filesystem modification time (render/write time), not access time; warm reads
|
||||
do not extend lifetime. Future timestamps do not expire until their age reaches
|
||||
the limit. Expired files are removed first in oldest-first order, then older files
|
||||
are removed until total bytes are within the target. Ties sort by path.
|
||||
|
||||
Since 0.1.71, a dedicated killable worker runs automatic maintenance once per launch,
|
||||
after settings and any initial document/notes loading and slide preparation finish.
|
||||
Rolling-buffer decks need all slides prepared on disk, not resident in RAM. With no
|
||||
document, cleanup runs after startup settings load. Incomplete/failed slide preparation
|
||||
defers automatic cleanup; manual expunge remains available. Later document opens and
|
||||
option changes do not schedule another pass. New limits apply on the next startup;
|
||||
manual expunge is immediate. Cleanup never blocks first-page display or UI input.
|
||||
Only one cleanup request is admitted per presenter; its deadline is 30 seconds.
|
||||
Errors/timeouts appear in the Disk cache section without automatic retries.
|
||||
A manual request also consumes any pending startup pass, avoiding duplicate work.
|
||||
Manual cleanup reports removed files/bytes, remaining bytes and retained candidates.
|
||||
Counts are a scan snapshot; concurrent rendering can change actual usage.
|
||||
|
||||
Current presenter projects are excluded. Live document workers also hold shared OS
|
||||
locks on `<project-key>/.lease-v1`; cleanup takes a nonblocking exclusive lock before
|
||||
deleting each file. Locks release on process exit, including crashes. This protects
|
||||
workers opening/rendering decks across instances. Lease files are empty, contain no
|
||||
persistent fields, are never unlinked, and support old caches by lazy creation.
|
||||
Older application versions do not honor these locks: avoid concurrent mixed-version
|
||||
use of one cache. Active decks can exceed the quota or lifetime; limits are eventual
|
||||
targets, not a hard write cap. Manual expunge also retains active projects. To clear
|
||||
the current deck, close the application and delete `slides-v1`, or reopen the app
|
||||
without a deck and use manual expunge.
|
||||
|
||||
The scan is fixed to project/source-hash directories, never follows discovered
|
||||
symlinks, and caps traversal at 200000 entries before deletion. It deletes only known
|
||||
page/edge `hayro09` and `hayro09-straight` RGBA files and extraction manifests;
|
||||
unknown files and temporary files are retained. Total bytes count all regular files
|
||||
at the artifact level, including unknown files, but exclude filesystem overhead and
|
||||
empty lease files. Unknown files or protected decks can prevent reaching the target.
|
||||
Metadata is rechecked under the project lock before deletion. Empty source-hash
|
||||
directories are removed when possible; project/lease directories remain. Image and
|
||||
manifest deletion is individually recoverable: missing artifacts regenerate.
|
||||
Source documents, notes sidecars and settings are outside cleanup scope. A full or
|
||||
unwritable disk still reports an explicit error; a memory-only fallback is pending.
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# HTML concept layout storage — version 1
|
||||
|
||||
Applies only to `docs/design/presenter-menu.html`, not the native application.
|
||||
The page uses browser localStorage key `pdf-presenter.menu-layouts.v1`. Storage is
|
||||
The page uses browser localStorage key `deckstride.menu-layouts.v1`. Storage is
|
||||
scoped by the browser to the page origin; file-URL handling is browser-dependent.
|
||||
It is not the native global configuration or a file saved alongside a PDF.
|
||||
|
||||
|
|
|
|||
|
|
@ -13,6 +13,10 @@ case folding, then exact filename breaks ties. There is no locale collation or U
|
|||
normalization. Use UTF-8 filenames for portable notes keys. Missing/corrupt slides
|
||||
retain their position and report an error rather than renumbering the deck.
|
||||
|
||||
Since 0.1.52, a presentation-named sidecar beside the folder takes priority over
|
||||
the sources below. See [presentation notes](presentation-notes.md) for its format
|
||||
and the double-click editor.
|
||||
|
||||
A UTF-8 matching-stem sidecar (`slide_01.png` → `slide_01.txt`) overrides global notes,
|
||||
even when empty. Multiple images sharing that stem share its sidecar. Otherwise use
|
||||
one global notes file mapping exact image filenames to strings:
|
||||
|
|
|
|||
|
|
@ -0,0 +1,103 @@
|
|||
# Presentation notes sidecars — version 1
|
||||
|
||||
Implemented in 0.1.52. A PDF `presentationX.pdf` uses
|
||||
`presentationX.notes.toml` in the same directory. Image folder `Slides/` uses
|
||||
`Slides.notes.toml` beside that folder. Paths follow the canonical source location.
|
||||
Opening a presentation never creates or writes a sidecar. The PDF, image files,
|
||||
legacy image `.txt` sidecars and folder-global notes are always left untouched.
|
||||
|
||||
```toml
|
||||
version = 1
|
||||
|
||||
[notes]
|
||||
"1" = "Opening remarks"
|
||||
"2" = "" # Explicitly suppress embedded notes on this page.
|
||||
"3" = """
|
||||
First point
|
||||
Second point
|
||||
"""
|
||||
```
|
||||
|
||||
PDF keys are one-based decimal page numbers. Image-folder keys are exact image
|
||||
filenames, matching the natural-ordered frozen slide list (e.g. `"slide_02.png"`).
|
||||
A named sidecar entry wins over PDF annotation text, or over the image folder's
|
||||
existing `.txt`/global notes. Missing entries fall back to extracted notes; explicit
|
||||
empty strings override them. Keys for other pages/files are ignored by display but
|
||||
preserved on save. Unknown top-level fields and unsupported versions are rejected.
|
||||
Malformed/unreadable sidecars produce a presenter warning and display falls back
|
||||
to extracted notes; the editor refuses to overwrite the invalid file.
|
||||
|
||||
Limits: 10000 entries, 256 KiB UTF-8 per note, 8 MiB combined note text, 16 MiB
|
||||
serialized file. Reads and writes run in a dedicated supervised worker with a
|
||||
30-second deadline, independently of rendering. Regular files only: symlink or
|
||||
non-file sidecars are refused. JSON worker messages retain their 16 MiB bound;
|
||||
pathological escape-heavy notes can exceed that transport bound and report an error.
|
||||
|
||||
Double-clicking the notes pane opens the current slide's editor and prepares the
|
||||
sidecar. If absent, all extracted/resolved notes (including empty slides) are written
|
||||
using an atomically persisted temporary file with no-clobber creation. If already
|
||||
present, preparation only reads it. The editor captures the slide index; subsequent
|
||||
navigation does not retarget a draft. Save modifies that page's key, preserving all
|
||||
other entries and showing saved text in the auto-fit pane after acknowledgement.
|
||||
TOML formatting/comments are regenerated on save; text values round-trip unchanged.
|
||||
|
||||
Creation and saves sync a temporary file in the sidecar directory before atomic
|
||||
persistence. Saves compare the sidecar's SHA-256 with the editor revision and check
|
||||
again just before replacement; detected external edits/removal fail without writing.
|
||||
This is optimistic conflict detection, not a lock against an external writer racing
|
||||
the final rename. Changed source SHA/slide identity is rejected; reopen the source.
|
||||
Read-only directories, invalid files, conflicts and worker failures retain the draft
|
||||
with explicit retry/reload/discard choices. Reload explicitly discards the draft.
|
||||
A file created by opening the editor remains even if editing is canceled.
|
||||
|
||||
The editor disables presentation keyboard shortcuts while open. Opening another
|
||||
source is held until it closes; normal application exit is held while saving or
|
||||
while a draft is dirty. Explicit Discard changes and close is available. Force-kill
|
||||
or OS shutdown can still lose unsaved drafts. Editor state is transient and never
|
||||
sent to presentation outputs or persisted in global/project layout settings.
|
||||
|
||||
See [example](examples/presentation.notes.toml), `tests/notes.rs`, the pointer
|
||||
interaction tests in `tests/presenter_ui.rs`, and the private worker protocol.
|
||||
|
||||
|
||||
## Importing TXT and Markdown
|
||||
|
||||
Implemented in 0.1.53, with no change to the version-1 TOML representation. A loaded
|
||||
presentation accepts `.txt` and `.md` files (case-insensitive extensions) through
|
||||
Menu → Import notes or drag-and-drop onto the presenter. Import review is read-only;
|
||||
only **Import and save notes** writes the named sidecar. Cancel writes nothing.
|
||||
|
||||
- Input is UTF-8, up to 8 MiB; an initial BOM is removed and CRLF becomes LF.
|
||||
- TXT splits at a line whose trimmed content is only two or more ASCII hyphens.
|
||||
Consecutive separators preserve empty sections, as do leading/trailing separators.
|
||||
No separators means one slide's notes. A trailing newline is not a separator.
|
||||
- Markdown splits at ATX level-one headings (`#` followed by space/tab, or `#`
|
||||
alone), with up to three leading spaces. The title is omitted. Level-two and
|
||||
deeper headings remain literal text. Backtick/tilde fences of at least three
|
||||
markers protect headings inside them; closing fences use the same marker and
|
||||
at least the opening length. A document without a heading, or with nonblank
|
||||
preamble before the first heading, is rejected. Setext headings are unsupported.
|
||||
- Blank newline characters at the beginning/end of each section are removed;
|
||||
internal newlines, indentation and Markdown body text are retained, displayed
|
||||
literally. This is section parsing, not Markdown rendering.
|
||||
- Sections replace slides sequentially from slide 1, using natural filename order
|
||||
for folders. Titles never match filenames or page numbers. Empty sections clear
|
||||
notes. Missing trailing sections retain current sidecar/extracted notes. Excess
|
||||
sections fail without writing. Limits remain 10000 sections and 256 KiB per note.
|
||||
- Saving materializes all slides' effective notes and preserves unknown existing
|
||||
page keys. Combined notes and serialized-file limits still apply. Existing TOML
|
||||
comments/formatting are regenerated. The source notes import is never modified.
|
||||
|
||||
Preview holds parsed sections in memory, the destination, slide count and optional
|
||||
existing-sidecar SHA. Apply revalidates the source identity and sidecar revision;
|
||||
external creation, edits or deletion since review cause a conflict. Atomic replace
|
||||
and no-clobber creation use the same guarantees/limitations as the editor above.
|
||||
Malformed existing sidecars are never overwritten. Errors appear in the import
|
||||
window; cancel and import again after resolving the cause. The first three sections
|
||||
are excerpted in the review; all sections are validated before writing.
|
||||
|
||||
Parsing, extraction and writes run in the supervised notes worker, never on the
|
||||
input/render thread. Presentation navigation and output continue independently.
|
||||
Keyboard presentation shortcuts are suspended while the import window is open.
|
||||
Opening another presentation/editing notes is held until the import closes; normal
|
||||
exit is held during an active import job. No notes payload reaches output windows.
|
||||
|
|
@ -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.
|
||||
|
||||
|
|
@ -70,8 +70,9 @@ No wire fields change. EOF/failed input drops the host command sender; the nativ
|
|||
host detects receiver disconnection instead of treating it as an empty queue forever.
|
||||
An established output keeps its last frame after unexpected connection loss, while
|
||||
Close or Escape requests exit on the next event-loop tick. A disconnected host with
|
||||
no windows exits immediately. B still blanks. With a live presenter, output Close or
|
||||
Escape retains the existing emergency-blank behavior.
|
||||
no windows exits immediately. B still blanks. With a live presenter, output Close
|
||||
retains emergency blanking, but Escape never blanks (since 0.1.72). It can still
|
||||
revert a pending display trial. Focus-transfer synthetic key presses are ignored.
|
||||
|
||||
Normal presenter shutdown signals the supervisor and allows 500 ms for graceful
|
||||
completion, then terminates/reaps the owned child through a separate shared process
|
||||
|
|
@ -102,3 +103,133 @@ 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.
|
||||
|
||||
## Editable notes in 0.1.52
|
||||
|
||||
`PrepareNotes {path, cache, source_sha}` and
|
||||
`SaveNotes {path, cache, source_sha, revision, page, text}` run through the dedicated
|
||||
notes bridge. `page` is zero-based, `source_sha` identifies the loaded PDF/slide list,
|
||||
and `revision` is the notes file SHA-256 observed when editing began. A successful
|
||||
`Reply.notes` contains `{path, revision, notes}` with all resolved notes in slide
|
||||
order. Errors use the existing error field. The presenter ignores stale-generation
|
||||
completions and late background extraction after an editor snapshot has been accepted.
|
||||
The current page draft survives save failure. None of this payload enters output IPC.
|
||||
|
||||
|
||||
## Notes import in 0.1.53
|
||||
|
||||
`PickNotes {owner}` uses the existing owned, supervised file chooser with TXT/MD
|
||||
filters. `PreviewNotesImport {path, cache, source_sha, import}` returns
|
||||
`Reply.notes_import {path, revision, sections, total}`: destination sidecar path,
|
||||
optional existing-file SHA, parsed strings and total slide count. It writes nothing.
|
||||
`ApplyNotesImport {path, cache, source_sha, preview}` revalidates identity/revision,
|
||||
merges notes and writes atomically, returning the existing `Reply.notes` snapshot.
|
||||
Both notes jobs use the dedicated 30-second bridge, bounded JSON messages and source
|
||||
generations. Notes picker results carry the source generation too. These messages
|
||||
are private same-executable presenter/worker traffic, never output-host traffic.
|
||||
|
||||
|
||||
## Shared zoom in 0.1.54
|
||||
|
||||
HostState adds `zoom {enabled, view {scale, center}, epoch, serial}` and
|
||||
`zoom_only` (false by default). Scale is bounded to 1–8 and center is normalized
|
||||
page UV coordinates, clamped to keep the full crop inside the page. Disabled or
|
||||
invalid views normalize to a complete fitted page. Since 0.1.55, zoom also carries `keep_fitted_area` (missing defaults false).
|
||||
The default preserves page proportions while expanding into each viewport, clipping
|
||||
overflow with bounded UVs and geometry. True retains the original fitted rectangle.
|
||||
Visible crop/edge clamping is local to each viewport; scale and page center are shared.
|
||||
No higher-resolution request, texture upload or image buffer is created by zoom.
|
||||
Large crops split into disjoint clip bands on a pool capped at four CPU threads;
|
||||
scanline interpolation uses O(viewport width) scratch memory.
|
||||
|
||||
Presenter gestures, enable/disable and slide changes advance `epoch`, reset serial
|
||||
to zero and invalidate prior output gestures. Output gestures increment `serial`
|
||||
within that epoch, sharing the crop immediately among output mirrors. Ack adds
|
||||
optional `zoom` and boolean `zoom_slow`; crop ACKs include generation and page.
|
||||
Presenter accepts only current-generation/current-page/current-epoch newer serials.
|
||||
The output retains newer local serials against delayed presenter states. Pending
|
||||
output changes retry at most every 33 ms until the presenter echoes the crop; pipe
|
||||
queues remain bounded and the latest absolute crop replaces intermediate gestures.
|
||||
|
||||
Zoom-only messages contain only crop/page/generation metadata and must not replace
|
||||
frame, preload, monitor, fullscreen or visibility state. Coalescing retains queued
|
||||
full state and merges same-page zoom metadata. The host validates page/generation
|
||||
before applying a lightweight update, without touching its RAM cache or textures.
|
||||
Full state also carries zoom for recovery. Notes and other operator data remain
|
||||
absent. No zoom state is persisted except the opt-in boolean in settings.
|
||||
|
||||
The performance watcher counts three consecutive zoomed window draws above 33 ms,
|
||||
including software drawing/presentation. The presenter shows the warning locally;
|
||||
output hosts report only a boolean. It does not alter visibility or navigation.
|
||||
|
||||
## Bounded presentation overlays in 0.1.67
|
||||
|
||||
HostState adds `overlay` and default-false `overlay_only`. The overlay contains an
|
||||
optional normalized page-coordinate pointer and at most 64 normalized straight
|
||||
arrow/highlighter marks with RGB color and bounded logical width. Invalid points are
|
||||
dropped, coordinates and widths are clamped, and excess marks are discarded. No
|
||||
notes, source paths or operator UI text enter this payload.
|
||||
|
||||
Overlay-only messages carry page/generation identity and absolute current overlay
|
||||
state. They share the two-slot presenter queue with zoom updates: coalescing merges
|
||||
same-page overlay and zoom fields into a pending full state without replacing frame,
|
||||
preload, routing, fullscreen or visibility data. The host rejects stale page or
|
||||
generation updates. Full state carries the overlay for host recovery. Drawing uses
|
||||
the existing buffered texture plus bounded vector shapes; it performs no PDF render,
|
||||
image decode, texture upload or slide-file access. This remains private same-build
|
||||
IPC.
|
||||
|
||||
|
||||
Since 0.1.60, output heartbeats may include `viewport {monitor, size, fullscreen}`.
|
||||
`size` is the actual reference output window’s physical client size `[width, height]`.
|
||||
The reference is the first connected presentation route. This transient metadata
|
||||
lets the current preview use that aspect ratio, without transferring image data.
|
||||
Missing/zero dimensions or a route/fullscreen mismatch fall back to the connected
|
||||
monitor size. Reports are refreshed by the existing one-second heartbeat, and are
|
||||
not persisted. Outputs with different aspect ratios still use their own viewport.
|
||||
|
||||
## Cache maintenance — 0.1.70
|
||||
|
||||
`CleanCache {path, policy: {max_mib, max_days}, protected: [project_key], manual}`
|
||||
runs on a dedicated 30-second supervised worker, one outstanding job per presenter.
|
||||
The reply adds optional `cleanup` with unsigned `removed_bytes`, `remaining_bytes`,
|
||||
`removed_files`, and `skipped_files`. Errors use the existing error field. No frame
|
||||
payload is transferred. The same-build private protocol requires no migration.
|
||||
|
||||
The optional full HostState field `blank_picture: FrameInfo | null` (0.1.77)
|
||||
identifies the managed blank image by path, dimensions and content SHA256.
|
||||
Lightweight updates retain it. A separate supervised worker reads it; the output
|
||||
validates identity before accepting the pixels. It is never acknowledged as a
|
||||
slide, and a failed read leaves blank output black. Worker requests
|
||||
`PickBlankPicture { owner }` and `BlankPicture { source, path }` select and
|
||||
import/load the asset; source null loads the stored copy. See
|
||||
[blank picture](blank-picture.md) for bounds.
|
||||
|
||||
## Per-screen window mode — 0.1.87
|
||||
|
||||
HostState adds `screen_fullscreen`, a monitor-ID-to-boolean map containing the
|
||||
resolved mode for each assigned Slides monitor (at most 32 route entries).
|
||||
Missing entries fall back to the existing `fullscreen` role-wide boolean.
|
||||
The presenter resolves saved or trial overrides before sending; the map contains
|
||||
no presenter layout, notes or paths. Placement and OutputViewport acknowledgments
|
||||
use the same per-monitor value. Full state updates replace the map; lightweight
|
||||
zoom/overlay updates preserve it. Values round-trip through JSON; both processes
|
||||
must still run the same executable build.
|
||||
|
||||
## Quit confirmation — 0.1.88
|
||||
|
||||
ACK adds optional boolean `request_quit` (default false). Escape/Ctrl+Q on a
|
||||
connected output requests the shared operator-only quit dialog; it does not blank
|
||||
or stop the output. No confirmation text or notes are sent to the audience host.
|
||||
Only a confirmed presenter-side quit triggers existing shutdown. Escape retains
|
||||
priority for display-trial rollback; an orphan output can still close directly.
|
||||
|
|
|
|||