← Commit history

1.0.15: NATIVE (Rust) build. 1.0.15: when two KiCad windows share a kind, the placement memory learns from the FRONT one, the window the user was actually looking at (wiki #48).

John Lauer ·88f11aab22 ·1mo ago ·parent 08eaa0a
3 files changed +12−6
rust/Cargo.lock+3−3
@@ -244,7 +244,7 @@ dependencies = [  [[package]] name = "kicad-bridge"-version = "1.0.14"+version = "1.0.15" dependencies = [  "kicad-core",  "kicad-platform",@@ -255,7 +255,7 @@ dependencies = [  [[package]] name = "kicad-core"-version = "1.0.14"+version = "1.0.15" dependencies = [  "kicad-ipc-rs",  "kicad-platform",@@ -281,7 +281,7 @@ dependencies = [  [[package]] name = "kicad-platform"-version = "1.0.14"+version = "1.0.15" dependencies = [  "serde",  "serde_json",
rust/Cargo.toml+1−1
@@ -3,7 +3,7 @@ resolver = "2" members = ["crates/*"]  [workspace.package]-version = "1.0.14"+version = "1.0.15" edition = "2021" license = "MIT" publish = false
rust/crates/kicad-bridge/src/verbs_windows.rs+8−2
@@ -620,11 +620,17 @@ pub(crate) fn remember_placement() -> usize {     let now = utc_stamp();     let mut mem = window_memory::load();     let mut learned = 0;-    for w in kicad_windows() {+    // Front to back, so that when two windows share a kind (two PCB Editors, say) the one the+    // user was actually looking at is the one whose place is remembered for that kind.+    let mut windows = kicad_windows();+    windows.sort_by_key(|w| w.z.unwrap_or(i64::MAX));+    let mut seen: Vec<WindowKind> = Vec::new();+    for w in windows {         let kind = w.kind();-        if matches!(kind, WindowKind::Dialog | WindowKind::Other) {+        if matches!(kind, WindowKind::Dialog | WindowKind::Other) || seen.contains(&kind) {             continue;         }+        seen.push(kind);         // placement() reports the NORMAL rect plus the maximized flag, which is what has to         // come back; the enumerated rect is the fallback where that call is unavailable.         let place = native().placement(w.hwnd).unwrap_or(Placement {