优化: 知识卡片交互+deepseek模型+鼠标钩子

This commit is contained in:
2026-06-05 21:45:45 +08:00
parent 004dba7db6
commit 0302546267
10 changed files with 667 additions and 77 deletions

View File

@@ -124,7 +124,7 @@ func startWebView() {
wvHwnd = uintptr(wv.Window())
procShowWindow.Call(wvHwnd, 0) // SW_HIDE
procSetWindowLongPtrW.Call(wvHwnd, gwlStyle, wsPopup|wsVisible|wsChild)
procSetWindowLongPtrW.Call(wvHwnd, gwlExStyle, wsExTransparent|wsExLayered)
procSetWindowLongPtrW.Call(wvHwnd, gwlExStyle, wsExLayered)
// 立即嵌入 WorkerW
embedWorkerW(workerw, screenW, screenH)
@@ -136,6 +136,20 @@ func startWebView() {
return saveConfig(cfg)
})
wv.Bind("refreshKnowledge", func() string {
go fetchAndPushKnowledge()
return ""
})
wv.Bind("setInteractiveRect", func(left, top, right, bottom float64) string {
overlayHitRect.Left = int32(left)
overlayHitRect.Top = int32(top)
overlayHitRect.Right = int32(right)
overlayHitRect.Bottom = int32(bottom)
overlayHasHitRect = true
return ""
})
log.Println("设置 HTML...")
cfg := loadConfig()
wv.SetHtml(buildWallpaperHTML(cfg))
@@ -145,6 +159,11 @@ func startWebView() {
procShowWindow.Call(wvHwnd, 5)
log.Println("壁纸窗口已显示")
// 子类化WM_NCHITTEST 动态穿透WebView2 初始化完成后)
subclassOverlayWindows()
// 全局鼠标钩子:桌面图标层拦截了 WM_NCHITTEST用钩子直接捕获点击
installMouseHook()
go func() {
time.Sleep(500 * time.Millisecond)
reloadAllCards()