From 337eaeb7eff1bb81779ef307acbdb2b6bb23d09c Mon Sep 17 00:00:00 2001 From: H-Chris233 Date: Mon, 4 May 2026 16:51:45 +0800 Subject: [PATCH] Restore Windows QA no-activate contract without breaking close interaction Issue #239 required the close button to be clickable, but a plain window.show() regression can steal focus and break selection capture assumptions in QA flow. Keep an explicit no-activate show on Windows while simplifying the native call path to only SW_SHOWNOACTIVATE. Constraint: QA panel must not steal foreground focus when opening Rejected: Keep plain window.show() | violates non-activation contract and risks wrong selection source Confidence: medium Scope-risk: narrow Directive: If Windows QA show logic changes again, verify both close-button clickability and front-app selection capture Tested: cargo check -q (openless-all/app/src-tauri) Not-tested: Manual Windows interaction on physical device --- openless-all/app/src-tauri/src/lib.rs | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/openless-all/app/src-tauri/src/lib.rs b/openless-all/app/src-tauri/src/lib.rs index ecd872a1..1fe64723 100644 --- a/openless-all/app/src-tauri/src/lib.rs +++ b/openless-all/app/src-tauri/src/lib.rs @@ -645,12 +645,10 @@ pub(crate) fn show_qa_window(app: &AppHandle, content_kind }); } #[cfg(target_os = "windows")] - { - if !show_qa_window_no_activate(&window) { - log::warn!("[qa] show_no_activate failed; falling back to window.show()"); - if let Err(e) = window.show() { - log::warn!("[qa] show fallback failed: {e}"); - } + if !show_qa_window_no_activate(&window) { + log::warn!("[qa] show_no_activate failed; falling back to window.show()"); + if let Err(e) = window.show() { + log::warn!("[qa] show fallback failed: {e}"); } } #[cfg(all(not(target_os = "macos"), not(target_os = "windows")))] @@ -703,10 +701,7 @@ pub(crate) fn hide_qa_window(app: &AppHandle) { fn show_qa_window_no_activate(window: &tauri::WebviewWindow) -> bool { use raw_window_handle::{HasWindowHandle, RawWindowHandle}; use windows::Win32::Foundation::HWND; - use windows::Win32::UI::WindowsAndMessaging::{ - SetWindowPos, ShowWindow, HWND_TOPMOST, SWP_NOACTIVATE, SWP_NOMOVE, SWP_NOSIZE, - SWP_SHOWWINDOW, SW_SHOWNOACTIVATE, - }; + use windows::Win32::UI::WindowsAndMessaging::{ShowWindow, SW_SHOWNOACTIVATE}; let Ok(handle) = window.window_handle() else { return false; @@ -720,17 +715,6 @@ fn show_qa_window_no_activate(window: &tauri::WebviewWindow