← Commit history

1.0.46: 1.0.46: a KiCad window that opens underneath the cursor is no longer mistaken for the user clicking it. 1.0.40 counted any input in the last 1.5 s with the cursor over the new window as a click, which is true whenever someone is simply using their machine; on AdomLapper, with the guard on, a Schematic Editor the bridge opened was judged user-foregrounded and left on top of John's browser. Now recent input only counts as a click when the cursor is on the taskbar or Start; a click ON the window itself still needs the mouse button to have been seen down.

John Lauer ·5e12b5aca8 ·1mo ago ·parent 2c9d034
1 file changed +10−3
rust/crates/kicad-platform/src/win/etiquette.rs+10−3
@@ -659,9 +659,16 @@ fn handle_foreground(h: u64, source: Source, cache: &mut ExeCache) {         // user's own window was bounced "sometimes") OR any user input in the last 1.5 s. Either one         // only counts with the cursor on the shell (a taskbar button, Start) or on this window:         // someone typing in their editor while KiCad raises itself has the cursor elsewhere.-        let clicked = within(g.last_click, CLICK_WINDOW, now) || ago < USER_INPUT_GRACE_SECS;-        // Only pay for the hit tests when a click is recent.-        let clicked_here = clicked && (cursor_over(h) || cursor_over_shell());+        // Two kinds of evidence, and they do NOT get the same hit test (1.0.46):+        // - a mouse BUTTON seen down (polled): the cursor on this window or on the shell is a click on it;+        // - merely RECENT INPUT of any kind: only the cursor on the SHELL counts (a taskbar button,+        //   Start). 1.0.40 also accepted "cursor over this window", which is true whenever a new KiCad+        //   window happens to open underneath the cursor of someone who is just using their machine:+        //   on AdomLapper the Schematic Editor was judged "user-foregrounded" and left on top of John's+        //   browser with the guard ON (2026-09-21 11:50:36).+        let button = within(g.last_click, CLICK_WINDOW, now);+        let recent_input = ago < USER_INPUT_GRACE_SECS;+        let clicked_here = (button && (cursor_over(h) || cursor_over_shell())) || (recent_input && cursor_over_shell());         let t = Transition {             is_kicad: true,             sanctioned: active_until(g.expected_fg_until, now),