feat(v2): T-309 no startup foreground grab, auto-close popup, rename buttons

- Comment out Gio's startup SetForegroundWindow/SetFocus in the vendored
  os_windows.go (marked SILVER-POSE PATCH; reverts on re-vendor) so the
  window no longer steals foreground on launch. Gio has no option for this.
- The fall confirm popup auto-closes 5s after opening (op.InvalidateCmd
  schedules the redraw even with no live frames); '我已知晓' still closes early.
- Rename save buttons to 保存摄像头参数 / 保存常用检测参数. Cross-compiles for Windows.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
ila
2026-07-23 22:00:44 +08:00
co-authored by Claude Opus 4.8
parent d92b53d7a3
commit aced262f6b
3 changed files with 29 additions and 4 deletions
+9
View File
@@ -639,3 +639,12 @@
- 验证:UI 用 `GOOS=windows CGO_ENABLED=0` 交叉编译;store(sqlite,cgo) 本地 `CGO_ENABLED=1` gcc 编译;窗口/弹窗/DB 目视需 Windows。
- 决策:SQLite 用 cgo mattn(用户选,vendor 更小;V2 本就 cgo)。DB 只存内网 host/端口/通道,不存密码;DB 放 artifacts/ 下随 gitignore。先做 ①(取消置顶/抢前台)。
- 下一步:定位并取消窗口置顶(Gio ViewEvent 拿 HWND + SetWindowPos NOTOPMOST/NOACTIVATE),交叉编译验证。
## 【2026-07-23】T-309 A:取消抢前台 + 弹窗自动关 + 按钮改名
- 状态:DOING
- 变更:①**vendored patch**——注释掉 `v2/vendor/gioui.org/app/os_windows.go` 启动时的 `SetForegroundWindow`/`SetFocus`(带 `SILVER-POSE PATCH (T-309)` 标记),取消"启动抢前台"。**注意:Gio 无 API 可关此行为;重跑 `go mod vendor` 会还原此补丁,需按标记重打。** 窗口默认非置顶(TopMost=false),故不需另改置顶。②④ 保存按钮改名为"保存摄像头参数"/"保存常用检测参数"。⑤ 摔倒确认弹窗记录打开时间,`layout` 中超 5 秒自动清除,并用 `op.InvalidateCmd{At:}` 调度到期重绘(停流也能自动关);"我已知晓"仍可提前关。
- 验证:`GOOS=windows CGO_ENABLED=0 go build -mod=vendor ./internal/ui/... ./cmd/ui-spike/...` 退出码 0(含 patched os_windows.go);gofmt 干净。窗口不抢前台/弹窗自动关的实际行为需 Windows 目视。
- 阻塞:③测试连接、⑥SQLite 未做。
- 决策:抢前台只能靠 patch vendored Gio(无 API);已加显著标记并在此记录,便于 re-vendor 后重打。
- 下一步:③测试连接摄像头按钮+弹窗;⑥SQLite(mattn) 记录(config 保留 host/端口/通道 + internal/store + 接线)。