Repository navigation
fix: 浮窗点击激活后自闪退与空格关闭失效,玻璃材质跟随应用主题 - #66
Merged
Merged
Conversation
空格关闭(点击激活后 ~96ms 自闪退的根因):
- 前端 onFocusChanged(false)→hidePopup 是自关元凶:激活链路
(set_focusable 异步落标志 + startDragging 模态循环 + set_focus)
交错产生的瞬时 blur 被立即响应,用户来不及按空格(日志实录
popup_activated_by_user → +96ms popup_hidden,含 WM_KILLFOCUS
回声的双份隐藏)
- popup_watch 升级出交互态:activate_popup 不再停看守,判定改为
「前台 ∉ {基线, 浮窗句柄}」,150ms 前台轮询成为两个状态唯一的
关闭权威,对瞬时焦点抖动天然免疫;前端彻底移除 onFocusChanged 监听
- 点击与拖拽统一为 4px 阈值判定:mousedown 只记起点,mouseup 位移
≤4px 转交互态,mousemove 超阈值才真正 startDragging(此前每次
点击都在 OS 模态移动循环里空转一圈)
- macOS 语义单独处理:foreground_window 把本应用折叠成 0,激活后
前台查询即 0 → 不关是预期;前台变非 0 的其他应用 → 正常关
液态玻璃(PRD 5.4):
- Windows 11 22H2+ 的 Acrylic 走 DWMWA_SYSTEMBACKDROP_TYPE,着色
参数被静默忽略且材质跟随系统主题:新增 set_popup_theme 命令写
DWMWA_USE_IMMERSIVE_DARK_MODE,前端 MutationObserver 监听 .dark
class 同步,材质明暗与 CSS 着色层保持同一来源
- CSS 着色层减薄(浅色 0.55→0.22、深色 0.58→0.28):0.55 会把
系统材质闷成色块,玻璃观感名存实亡
测试:popup_watch 新增交互态判定 5 例;cargo test --lib 225 通过,
clippy -D warnings 零警告;tsc 零错误,vitest 25 通过
This was referenced Oct 20, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
两个用户可直接感知的浮窗缺陷:
popup_activated_by_user→popup_hidden,还有 18ms 后的 WM_KILLFOCUS 回声双份隐藏),用户根本来不及按空格。DWMWA_SYSTEMBACKDROP_TYPE,着色参数被静默忽略,且材质跟随系统主题而非应用主题——应用深色 + 系统浅色时浮窗背后是一块浅色亚克力;CSS 着色层 0.55 的不透明度进一步把材质闷成色块。根因
自闪退元凶是前端
onFocusChanged(false) → hidePopup:激活链路(set_focusable异步落标志 +startDragging模态移动循环 +set_focus)交错产生的瞬时 blur 被立即响应。此前 mousedown 就无条件startDragging(),把点击、拖拽、激活三条链路搅在一起。修复
空格关闭
popup_watch升级出交互态:activate_popup不再停看守,判定改为「前台 ∉ {基线, 浮窗句柄}」;150ms 前台轮询成为被动/交互两个状态唯一的关闭权威,对瞬时焦点抖动天然免疫onFocusChanged监听startDragging()foreground_window把本应用折叠成 0,激活后前台查询即 0 → 不关是预期;前台变成非 0 的其他应用 → 正常关液态玻璃
set_popup_theme命令写DWMWA_USE_IMMERSIVE_DARK_MODE,前端 MutationObserver 监听.darkclass 同步,材质明暗与 CSS 着色层保持同一来源验证
cargo test --lib225 通过(popup_watch 新增交互态判定 5 例)cargo clippy -- -D warnings零警告、cargo fmt --check干净tsc --noEmit零错误、vitest25 通过建议实测
npm run tauri dev:复制触发浮窗 → 点击浮窗 → 按空格应正常关闭(不再闪退);切换应用深色模式观察玻璃材质明暗是否跟随。