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:
@@ -115,6 +115,7 @@ type Window struct {
|
||||
latestImage *image.RGBA
|
||||
imageGen uint64
|
||||
pending *alert.Record
|
||||
pendingAt time.Time
|
||||
seenAlerts map[string]struct{}
|
||||
incoming []galleryIncoming
|
||||
seenEvents map[string]struct{}
|
||||
@@ -335,6 +336,7 @@ func (window *Window) PresentAlert(record alert.Record) {
|
||||
window.seenAlerts[record.Event.EventID] = struct{}{}
|
||||
queued := record
|
||||
window.pending = &queued
|
||||
window.pendingAt = time.Now()
|
||||
window.mu.Unlock()
|
||||
playAlertSound()
|
||||
window.appWindow.Invalidate()
|
||||
@@ -360,6 +362,7 @@ func (window *Window) layout(gtx layout.Context) layout.Dimensions {
|
||||
frame := window.latestImage
|
||||
gen := window.imageGen
|
||||
pending := window.pending
|
||||
pendingAt := window.pendingAt
|
||||
incoming := window.incoming
|
||||
running := window.running
|
||||
window.incoming = nil
|
||||
@@ -410,6 +413,17 @@ func (window *Window) layout(gtx layout.Context) layout.Dimensions {
|
||||
window.mu.Unlock()
|
||||
pending = nil
|
||||
}
|
||||
// The confirm popup auto-closes 5 seconds after it opens.
|
||||
if pending != nil {
|
||||
if time.Since(pendingAt) >= 5*time.Second {
|
||||
window.mu.Lock()
|
||||
window.pending = nil
|
||||
window.mu.Unlock()
|
||||
pending = nil
|
||||
} else {
|
||||
gtx.Execute(op.InvalidateCmd{At: pendingAt.Add(5 * time.Second)})
|
||||
}
|
||||
}
|
||||
|
||||
content := func(gtx layout.Context) layout.Dimensions {
|
||||
return layout.Flex{Axis: layout.Vertical}.Layout(gtx,
|
||||
@@ -701,7 +715,7 @@ func (window *Window) layoutSettings(gtx layout.Context, model ViewModel) layout
|
||||
window.editorRow("传输 (tcp/udp)", &window.editTransport),
|
||||
window.editorRow("连接超时 (秒)", &window.editTimeout),
|
||||
window.checkRow("低延迟", &window.lowLatency),
|
||||
window.buttonRow(&window.saveCamera, "保存摄像头"),
|
||||
window.buttonRow(&window.saveCamera, "保存摄像头参数"),
|
||||
)
|
||||
paramsCard := verticalRows(
|
||||
window.heading("常用检测参数(下次启动生效)"),
|
||||
@@ -711,7 +725,7 @@ func (window *Window) layoutSettings(gtx layout.Context, model ViewModel) layout
|
||||
window.editorRow("模型置信度", &window.editModelConf),
|
||||
window.checkRow("要求先快速下移", &window.requireRapid),
|
||||
window.checkRow("要求膝踝清晰", &window.requireLower),
|
||||
window.buttonRow(&window.saveParams, "保存参数"),
|
||||
window.buttonRow(&window.saveParams, "保存常用检测参数"),
|
||||
window.labelRow(window.settingsStatus),
|
||||
)
|
||||
depsCard := verticalRows(
|
||||
|
||||
Reference in New Issue
Block a user