Repository navigation
Conversation
This branch has not been deployed
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.
改动类型
是否包含破坏性变更
改动说明
修复 Windows 任务栏「自动隐藏」开启时,任务栏歌词不随任务栏滑动动画逐帧跟随、且收起后残留窗口挡住底缘唤醒带的问题。
根因:
TrayWatcher的LOCATIONCHANGE每帧都会触发布局更新,但Win11Strategy.update_layout每次都跑整树 UIA 扫描(单次上百毫秒),service.rs的 worker 又把队列里的 Update 合并成最后一帧——动画期间歌词被钉在原地,等动画结束才跳变。收起完成后歌词窗口停在底缘 2px 的鼠标唤醒触发带上,导致无法唤起任务栏。主要变更:
strategy/win11.rs:新增ScanCache缓存任务栏内容横向边界(相对任务栏左缘的偏移,是平移不变量)。滑动动画期间(矩形逐帧变化)或任务栏未完整可见时跳过 UIA 扫描、直接复用缓存按当前矩形组装布局,逐帧跟随;稳态下矩形不变时以 2s 周期重扫兜底内部布局变化。收起到底缘(可见高度 ≤4px)时返回宽高为 0 的空布局,让 JS 端停靠窗口、让出唤醒带。启动时任务栏常已收起,用seed_cache预建缓存避免首次展开走慢路径。service.rs:队列里的 Update 不再合并成最后一帧,而是逐帧跑update_layout——每个 Update 对应一帧位置,合并会让动画期间钉在原地。lib.rs:新增move_windowNAPI 函数。Electron 的setBounds对嵌入任务栏的 owner 窗口 move 部分不生效,动画跟随需要直接调SetWindowPos。taskbarLyric.ts:parkWindow:收起时不再hide(),只把窗口有效区域setShape裁到远端 1×1。hide/show会让 Chromium 重新合成首帧、展开瞬间歌词先出现在偏移位置(实测约 100ms 内从右向左滑 ~60 DIP);保持窗口可见则展开只恢复形状即可直接呈现正确内容。showInactive完成首帧合成,再应用真实形状,避免首次展开横移。applyLayout优先调用原生moveWindow(物理像素),失败回退setBounds(DIP)。已知行为:收起动画最后 1-2 帧因队列/合成延迟可能残留约 3-4px 的位置差,下一个布局周期即对齐,肉眼不可感知。
关联 Issue
Closes #457
测试情况
Win11Strategy路径)pnpm format/pnpm lint(0 errors)/pnpm typecheck/cargo clippy -p taskbar-lyric -- -D warnings/pnpm build:native全部通过截图 / 录屏
录屏逐帧分析(ffmpeg gdigrab 捕获任务栏条带,逐像素定位内容首列):
自查清单
pnpm format,并确认pnpm typecheck、pnpm lint通过pnpm build:native验证;未手写native/*/index.d.tsdev分支提交