Skip to content

fix(windows): 修复翻译态 Capsule 宿主标题条重新出现#191

Closed
Cooper-X-Oak wants to merge 2 commits into
Open-Less:mainfrom
Cooper-X-Oak:codex/issue-190-translation-delivery
Closed

fix(windows): 修复翻译态 Capsule 宿主标题条重新出现#191
Cooper-X-Oak wants to merge 2 commits into
Open-Less:mainfrom
Cooper-X-Oak:codex/issue-190-translation-delivery

Conversation

@Cooper-X-Oak
Copy link
Copy Markdown
Contributor

摘要

Fixes #190.

这个 PR 解决的单一目标是:
修复 Windows 在翻译态(显示“● 正在翻译” badge)时,Capsule 宿主标题条 / 原生 chrome 重新暴露的问题。

说明:

  • 普通 Capsule 主修线已经在本地独立验证通过
  • 本 PR 只聚焦翻译态专属回归
  • 当前分支基于普通 Capsule 修复基线 cad8536 叠加最小增量提交 c5cdc8d

修复 / 新增 / 改进

  • configure_capsule_window_for_platform(...) 中显式调用 window.set_decorations(false)
  • 确保翻译态扩高 / 重新显示路径不会把 Windows 原生标题条带回 Capsule 宿主窗口
  • 将问题继续限定在 Windows 宿主 non-client area / decorations 路径,不回到 pill 本体视觉层

兼容

  • 不包含:普通 Capsule 主修线、QA 宿主矩形问题、helper-window lifecycle 主线、macOS 修复
  • 对现有用户 / 本地环境 / 构建流程的影响:
    • 仅影响 Windows 翻译态 Capsule 宿主窗口承载
    • 普通非翻译态 Capsule 行为不在本 PR 主修范围内扩散

测试计划

  • 命令:npm exec tsc; npx vite build

  • 结果:通过

  • 证据路径:clean worktree codex/issue-190-translation-delivery 本地终端构建记录

  • 命令:Set-Location src-tauri; cargo check --manifest-path Cargo.toml

  • 结果:通过

  • 证据路径:clean worktree openless-all/app/src-tauri 本地检查记录

  • 命令:本地 debug 运行 + WebView2 remote debugging + 翻译态复现

  • 结果:通过

  • 证据路径:翻译态复现下,可见 Capsule 原生样式不再包含 WS_CAPTION;对应 issue 证据已补充到 [windows] Capsule 宿主标题条仍然可见,用户没有只看到胶囊本体 #190

Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

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

Sorry @Cooper-X-Oak, you have reached your weekly rate limit of 500000 diff characters.

Please try again later or upgrade to continue using Sourcery

Copy link
Copy Markdown

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

Choose a reason for hiding this comment

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

💡 Codex Review

https://github.com/appergb/openless/blob/c5cdc8dabf0f17268988bd220a537d4589c6abd0/openless-all/app/scripts/windows-ui-config.test.mjs#L80-L81
P2 Badge Update Windows UI config test to match refactored capsule layout

This assertion still expects the old Windows host metrics (220/118/84 with bottomInset: 12) even though this commit changes getCapsuleHostMetrics to 196/92/52 with bottomInset: 0, so the script now fails immediately (node scripts/windows-ui-config.test.mjs). Keeping this stale check makes the regression test unusable and masks future config regressions.

ℹ️ 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".

Comment on lines +436 to +442
if let Err(e) = window.set_decorations(false) {
log::warn!("[main] disable native decorations failed: {e}");
}
if let Err(e) = apply_mica(window, None) {
log::warn!("[main] mica failed: {e}");
}
apply_windows_rounded_frame(window);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Guard Windows-only main-window calls with cfg blocks

configure_main_window_for_platform now calls apply_mica and apply_windows_rounded_frame outside any #[cfg(target_os = "windows")] block, so non-Windows builds hit Windows-specific symbols in a function compiled for all targets. This breaks macOS/Linux compilation paths (and also applies set_decorations(false) unconditionally), so the change is not portable across the repo’s supported platforms.

Useful? React with 👍 / 👎.

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.

[windows] Capsule 宿主标题条仍然可见,用户没有只看到胶囊本体

1 participant