← Commit history

1.0.16: NATIVE (Rust) build. 1.0.16: the native window enumeration reports z-order, so the front window of a kind is the one the placement memory learns from on the local path too (wiki #48).

John Lauer ·8136deab04 ·1mo ago ·parent 88f11aa
3 files changed +10−7
rust/Cargo.lock+3−3
@@ -244,7 +244,7 @@ dependencies = [  [[package]] name = "kicad-bridge"-version = "1.0.15"+version = "1.0.16" dependencies = [  "kicad-core",  "kicad-platform",@@ -255,7 +255,7 @@ dependencies = [  [[package]] name = "kicad-core"-version = "1.0.15"+version = "1.0.16" dependencies = [  "kicad-ipc-rs",  "kicad-platform",@@ -281,7 +281,7 @@ dependencies = [  [[package]] name = "kicad-platform"-version = "1.0.15"+version = "1.0.16" dependencies = [  "serde",  "serde_json",
rust/Cargo.toml+1−1
@@ -3,7 +3,7 @@ resolver = "2" members = ["crates/*"]  [workspace.package]-version = "1.0.15"+version = "1.0.16" edition = "2021" license = "MIT" publish = false
rust/crates/kicad-bridge/src/verbs_windows.rs+6−3
@@ -531,8 +531,11 @@ impl Win {     fn rect_json(&self) -> Value {         json!({"x": self.rect.0, "y": self.rect.1, "width": self.rect.2, "height": self.rect.3})     }-    fn from_info(w: &WindowInfo) -> Win {-        Win { hwnd: w.hwnd, title: w.title.clone(), class_name: w.class_name.clone(), rect: w.rect, z: None, owner: w.owner, pid: w.pid, exe: w.exe.clone(), minimized: w.minimized, maximized: w.maximized, hung: w.hung }+    /// `z` is the window's position in the OS enumeration, which EnumWindows returns front+    /// first, so a caller can tell which of two windows of a kind the user was looking at+    /// (wiki #48). ab's inventory carries its own z; this is the native fallback's.+    fn from_info(w: &WindowInfo, z: usize) -> Win {+        Win { hwnd: w.hwnd, title: w.title.clone(), class_name: w.class_name.clone(), rect: w.rect, z: Some(z as i64), owner: w.owner, pid: w.pid, exe: w.exe.clone(), minimized: w.minimized, maximized: w.maximized, hung: w.hung }     } } @@ -575,7 +578,7 @@ fn list_all_windows() -> Result<(Vec<Win>, &'static str), Value> {         }         _ => {             let rows = plat("window enumeration (list_windows)", native().list_windows())?;-            Ok((rows.iter().filter(|w| w.visible).map(Win::from_info).collect(), "local:EnumWindows"))+            Ok((rows.iter().filter(|w| w.visible).enumerate().map(|(z, w)| Win::from_info(w, z)).collect(), "local:EnumWindows"))         }     } }