Skip to content

fix(windows): 收紧 Capsule 几何契约#182

Merged
appergb merged 3 commits into
Open-Less:mainfrom
Cooper-X-Oak:codex/windows-capsule-geometry-pr
May 2, 2026
Merged

fix(windows): 收紧 Capsule 几何契约#182
appergb merged 3 commits into
Open-Less:mainfrom
Cooper-X-Oak:codex/windows-capsule-geometry-pr

Conversation

@Cooper-X-Oak
Copy link
Copy Markdown
Contributor

治理归属

  • 族群:B 族群 / 窗口几何契约
  • canonical issue:[windows] Capsule 变形、失真与尺寸错位 #142
  • 主修范围:capsule host bounds、visual pill metrics、badge offset、clipping、distortion、DPI 几何对齐
  • 不默认并入:helper-window 生命周期、startup visible/ready ownership、QA helper-window 语义
  • 参考:
    • docs/windows-window-governance-board.zh-CN.md
    • docs/2026-05-02-window-capability-family-audit.md
    • docs/github-tracking/windows-window-family-canonical-map.md

摘要

Closes #142

这条 PR 承接 Windows Capsule 几何契约修复。
本轮把:

  • native host bounds
  • visual pill metrics
  • translation badge offset
  • Windows bottom inset / shadow allowance

收口成同一套几何契约,避免继续混用视觉尺寸和宿主窗口尺寸。

修复 / 新增 / 改进

  • 在前端新增 host metrics 与 pill metrics 分层
  • 让 Windows capsule host 改为按底部 inset 对齐,而不是在更大的 host 内简单居中
  • 让翻译徽章改为从 shared host metrics 锚定,而不是从固定中心偏移锚定
  • 在 Rust 侧把 capsule runtime bounds 改成 host bounds 语义,并保留 visual height 的独立来源
  • 扩充 windows-ui-config.test.mjs,锁住 capsule geometry contract

兼容

  • 不包含:helper-window hidden-state participation
  • 不包含:startup visible / ready ownership
  • 不包含:QA helper-window 语义
  • 对现有用户 / 本地环境 / 构建流程的影响:只聚焦 Capsule geometry 主线

测试计划

  • node openless-all/app/scripts/windows-ui-config.test.mjs
  • npm run build
  • cargo check --manifest-path openless-all/app/src-tauri/Cargo.toml
  • powershell -ExecutionPolicy Bypass -File openless-all/app/scripts/windows-build-gnu.ps1
  • powershell -ExecutionPolicy Bypass -File openless-all/app/scripts/windows-open-dev.ps1 -ExePath <GNU dev exe>
  • Windows 100% / 125% / 150% DPI 人工视觉回归
  • normal / translating / ending-stage 实机几何回归

说明

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

Here are some automated review suggestions for this pull request.

Reviewed commit: 75633f1898

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

display: 'flex',
alignItems: 'center',
justifyContent: 'center',
justifyContent: os === 'win' ? 'flex-end' : 'center',
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 Use cross-axis alignment for Windows pill anchoring

In this flex container, flex-direction is the default row, so switching justifyContent to flex-end moves the pill horizontally, not vertically. On Windows that pushes the 196px pill to the right side of the 220px host while the translation badge is still centered via left: '50%', creating a visible horizontal misalignment. If the goal is bottom anchoring, this needs cross-axis alignment (alignItems or a column direction) instead of main-axis justification.

Useful? React with 👍 / 👎.

Comment on lines +581 to +582
let y = (logical_h - capsule_visual_height(translation_active) - 80.0 - bounds.bottom_inset)
.max(0.0);
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 Preserve non-Windows bottom clearance when translating

The new y position uses capsule_visual_height(translation_active), but on non-Windows that function is constant (42.0) while capsule_window_bounds(true) grows host height to 110.0. This means translated state keeps the same top coordinate as non-translated state and drops the larger host 68px lower, so the window bottom no longer respects the prior 80pt clearance behavior on macOS/Linux. Non-Windows positioning should still account for the expanded host height.

Useful? React with 👍 / 👎.

@appergb appergb force-pushed the codex/windows-capsule-geometry-pr branch from 75633f1 to 9fd726e Compare May 2, 2026 04:06
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@appergb appergb merged commit a2d243f into Open-Less:main May 2, 2026
2 checks passed
@Cooper-X-Oak
Copy link
Copy Markdown
Contributor Author

自动 Windows 实机回归补充:\n\n- fresh-start 后通过 windows-open-dev.ps1 成功 bring-to-foreground\n- 主窗口进程状态:Responding=True\n- 窗口矩形:约 Left=102, Top=56, Right=1356, Bottom=864\n- 已抓到一张主窗口截图,说明这条分支至少在 main-window visible baseline 上是正常的\n\n剩余仍需人工确认的是 Capsule 本体在 normal / translating / ending-stage 下的视觉几何,以及 100% / 125% / 150% DPI 的稳定性。

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 变形、失真与尺寸错位

2 participants