From ef8fcf90e8325e469a1198261ffb9e1fe098224b Mon Sep 17 00:00:00 2001 From: Dandaedre Date: Wed, 18 Nov 2026 18:06:52 +0100 Subject: [PATCH] Read Midra crop controls when validating input switches --- Cargo.lock | 2 +- Cargo.toml | 2 +- crates/canvas-pilot/src/device_send.rs | 24 +++++++++++++++++++++--- docs/canvas-pilot/changelog.md | 6 ++++++ 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 28ceba4..4a67e20 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -602,7 +602,7 @@ dependencies = [ [[package]] name = "canvas-pilot" -version = "0.10.0-rc.3" +version = "0.10.0-rc.4" dependencies = [ "base64 0.22.1", "craft-dwg", diff --git a/Cargo.toml b/Cargo.toml index eb9a623..6e7f03c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ default-members = ["crates/canvas-pilot"] resolver = "3" [workspace.package] -version = "0.10.0-rc.3" +version = "0.10.0-rc.4" edition = "2024" license = "MIT" repository = "https://proxy.dandaedre.com/gitea/idle-org/canvas-pilot" diff --git a/crates/canvas-pilot/src/device_send.rs b/crates/canvas-pilot/src/device_send.rs index 79ae9cd..6cb68b1 100644 --- a/crates/canvas-pilot/src/device_send.rs +++ b/crates/canvas-pilot/src/device_send.rs @@ -146,7 +146,7 @@ impl Plan { if snapshot.profile == device::Profile::Midra4k { for edge in ["left", "right", "top", "bottom"] { if settings - .pointer(&format!("/settings/cropping/status/pp/{edge}")) + .pointer(&format!("/settings/cropping/control/pp/{edge}")) .and_then(Value::as_f64) .ok_or("Input crop status unavailable; refresh before switching input.")? != 0. @@ -718,7 +718,7 @@ mod tests { "status":{"pp":{"isAvailable":true,"plug":"HDMI"}}, "plugList":{"items":{"HDMI":{ "status":{"signal":{"pp":{"isValid":true,"imageWidth":1920,"imageHeight":1080}}}, - "settings":{"cropping":{"status":{"pp":{"left":0,"right":0,"top":0,"bottom":0}}}, + "settings":{"cropping":{"control":{"pp":{"left":0,"right":0,"top":0,"bottom":0}}}, "aspect":{"pp":{"signal":"NATIVE","transformTo":"SIGNAL"}}} }}} }}}); @@ -769,8 +769,26 @@ mod tests { ) .is_err() ); + // Midra has no cropping/status branch. Missing or malformed control data + // must still fail closed instead of being treated as an uncropped input. + for value in [Value::Null, json!("unknown")] { + let mut incomplete = state.clone(); + incomplete.raw["device"]["inputList"]["items"]["INPUT_5"]["plugList"]["items"]["HDMI"] + ["settings"]["cropping"]["control"]["pp"]["left"] = value; + let error = Plan::prepare_with_inputs( + &incomplete, + &editor, + 0, + &mappings, + Target::Preview, + Sizing::OutputBox, + &[(2, 5)].into(), + ) + .unwrap_err(); + assert!(error.contains("Input crop status unavailable")); + } state.raw["device"]["inputList"]["items"]["INPUT_5"]["plugList"]["items"]["HDMI"]["settings"] - ["cropping"]["status"]["pp"]["left"] = json!(12); + ["cropping"]["control"]["pp"]["left"] = json!(12); assert!( Plan::prepare_with_inputs( &state, diff --git a/docs/canvas-pilot/changelog.md b/docs/canvas-pilot/changelog.md index b0a424f..916fc1a 100644 --- a/docs/canvas-pilot/changelog.md +++ b/docs/canvas-pilot/changelog.md @@ -4,6 +4,12 @@ ## Unreleased +### v0.10.0-rc.4 + +- Fix Midra layer input switching reading the wrong input crop path. Validate + Midra crop controls rather than Aquilon crop status; missing or malformed data + still blocks switching, as do active crop and aspect correction. + ### v0.10.0-rc.3 - Use stable selectable rows and a subtle background hover in device input