mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-07 23:23:52 +08:00
- 支持全部工作台标签与 AI 对话在多显示器中原生独立展示 - 修复拖拽指针捕获,恢复关闭、右键菜单和跨窗口释放识别 - 拆分子窗启动入口并按需加载语言与工作台内容 - 内容与 Monaco 完成可见绘制后再提交迁移,消除白屏和加载闪烁 - 加固结果编辑、宿主同步及关闭、超时和焦点竞态
40 lines
828 B
Go
40 lines
828 B
Go
package nativewindow
|
|
|
|
import "sync"
|
|
|
|
// closeGate lets the first native close request ask the frontend for a final
|
|
// sync. Control.Close opens the gate after that terminal action succeeds.
|
|
type closeGate struct {
|
|
mu sync.Mutex
|
|
allowed bool
|
|
}
|
|
|
|
func (g *closeGate) intercept() (veto bool, requestFrontendClose bool) {
|
|
g.mu.Lock()
|
|
defer g.mu.Unlock()
|
|
if g.allowed {
|
|
return false, false
|
|
}
|
|
// Emit on every native close attempt. The React terminal state deduplicates
|
|
// concurrent requests, while a user can retry after a failed final flush.
|
|
return true, true
|
|
}
|
|
|
|
func (g *closeGate) allow() {
|
|
g.mu.Lock()
|
|
g.allowed = true
|
|
g.mu.Unlock()
|
|
}
|
|
|
|
func (g *closeGate) cancel() {
|
|
g.mu.Lock()
|
|
g.allowed = false
|
|
g.mu.Unlock()
|
|
}
|
|
|
|
func (g *closeGate) isAllowed() bool {
|
|
g.mu.Lock()
|
|
defer g.mu.Unlock()
|
|
return g.allowed
|
|
}
|