Skip to content

fix: 关闭动画时右键托盘图标需点击三次才打开快捷面板 - #113

Merged
Ray-lea merged 3 commits into
Ray-lea:mainfrom
digital-bombyx:fix/tray-right-click
Nov 15, 2026
Merged

Ray-lea merged 3 commits into
Ray-lea:mainfrom
digital-bombyx:fix/tray-right-click

Conversation

@digital-bombyx

Copy link
Copy Markdown
Contributor

改动内容 / Changes

在 Windows 中关闭动画效果后,右键托盘图标需要点击三次才能打开快捷面板。

原因:悬停卡片与快捷面板共用同一个窗口。指针停在图标上时卡片已显示,右键时先关闭卡片,再在同一窗口打开面板。没有淡出时,卡片立即隐藏,但 SetWindowPos(SWP_HIDEWINDOW) 被延后到下一帧执行,而此时面板已经显示,于是窗口又被藏起,界面却仍认为面板处于打开状态:

  1. 第一次右键:面板打开后立即被藏起;
  2. 第二次右键:界面以为面板已打开,执行的是“关闭”;
  3. 第三次右键:面板才真正打开。

开启动画时卡片经淡出关闭,show 会覆盖 Leaving 状态,因此不会出现此问题。

修复:Flyout::hide 中延后执行的隐藏与 tray_closed 在窗口已再次显示(phase != Hidden)时跳过。后者同时避免面板打开期间 set_flyout_open(false) 让采样放慢。


With Windows animations off, a right click on the tray icon needed three clicks to open the quick panel: closing the hover card hid the shared flyout window one frame later, after the panel had already been shown in it. The deferred hide and tray_closed now skip when the window was shown again in the meantime.

检查清单 / Checklist

  • 拉取请求标题与各个提交信息符合 Conventional Commits(<type>(<scope>): <描述>)/ The title and commit messages follow Conventional Commits
  • start.bat check 通过 / start.bat check passes(rustfmt、clippy -D warnings)
  • 行为变化已同步到 docs/ 中对应的页面 / Behavior changes are reflected in docs/(无行为变化,仅修复)
  • 文案已写入 locales/ 的中文与英文目录 / New text is in both the Chinese and English catalogs under locales/(无新文案)
  • 界面改动附有截图,并按性能基线测量了开销 / UI changes include screenshots and a measurement against the performance baseline(无界面改动)

手动测试:关闭动画效果,指针停在托盘图标上待卡片出现后右键,一次即打开快捷面板;未出现卡片时直接右键同样正常。

悬停卡片与快捷面板共用一个窗口。关闭动画时,右键先立即隐藏卡片,再在同一窗口打开面板;隐藏操作延后一帧执行,在面板显示后又把窗口藏起,界面却仍认为面板已打开。第二次右键因此只是“关闭”看不见的面板,第三次才真正打开。现在延后的隐藏与关闭记录在窗口已再次显示时跳过。
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 14, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-15T00:11:58.765284Z 4b7141e New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4b7141e159

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

{"control":{"page":"components","windowMotion":"off","pointerOutside":true},"wait":700,"inspect":"layout","label":"motion-off","expect":{"animations.window":false}},
{"probe":"hide","wait":300},
{"control":{"trayFlyout":"card"},"wait":900,"inspect":"layout","label":"card","expect":{"tray.card":true,"tray.visible":true,"tray.animated":false,"tray.samplingShown":true},"captureFlyout":"card"},
{"control":{"trayFlyout":"panel"},"wait":900,"inspect":"layout","label":"card-to-panel","expect":{"tray.panel":true,"tray.visible":true,"tray.samplingShown":true},"captureFlyout":"panel"},

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reproduce the close-and-reopen sequence in the regression test

With window motion off, this step calls tray_panel directly through src-gpui/src/frontend/test_control.rs:24–30, replacing the card without closing it first. The real right-click path in src-gpui/src/shell.rs:1241–1246 closes the card before requesting the panel, which is what queues the stale deferred hide. Consequently, this regression test never exercises the new guards and can pass with the original bug intact. Add a test control that closes the card and opens the panel within the same effect cycle, and use it for the card-to-panel cases.

Useful? React with 👍 / 👎.

@Ray-lea
Ray-lea merged commit 5071ec7 into Ray-lea:main Nov 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants