Skip to content

fix(windows): 修复自绘窗口圆角与外框贴合#125

Closed
Cooper-X-Oak wants to merge 4 commits into
Open-Less:mainfrom
Cooper-X-Oak:codex/windows-native-titlebar-off
Closed

fix(windows): 修复自绘窗口圆角与外框贴合#125
Cooper-X-Oak wants to merge 4 commits into
Open-Less:mainfrom
Cooper-X-Oak:codex/windows-native-titlebar-off

Conversation

@Cooper-X-Oak
Copy link
Copy Markdown
Contributor

@Cooper-X-Oak Cooper-X-Oak commented May 1, 2026

治理归属

  • 族群:A 族群 / 窗口外观契约
  • canonical issue:[Windows][P1] 主窗口四周圆角与自绘外框贴合不完整 #127
  • 主修范围:主窗口圆角、外框、titlebar、shadow、首帧 shell 贴合
  • 不默认并入:capsule geometry、helper-window 生命周期、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

修复要点

  • Windows 主窗口改为隐藏创建,setup 阶段先完成窗口外壳设置,再统一 show(),降低首帧 native chrome 与自绘 chrome 不一致的概率。
  • Windows 下移除系统 caption,但保留 resize frame 能力,并补充自绘窗口 resize handles,避免视觉修复引入边缘交互回归。
  • 对齐 WindowChrome / FloatingShell / 全局窗口背景圆角,减少四周圆角、边框和 shadow 的多层错位。
  • 标题栏按钮改为有 hover / pressed 反馈的自绘按钮,保持 Windows custom chrome 的基本交互语义。
  • 保留 macOS 的系统红黄绿窗口控制,不把 Windows 修复扩散成跨平台行为变化。

关联 Issue

Closes #127

回归背景:#103 曾记录 Windows 原生标题栏与应用内自绘标题栏同时出现;这次 PR 先保持 Draft,用来继续收敛 Windows custom chrome 的圆角和外框一致性。

测试计划

  • npm run build
  • cargo check --lib --manifest-path openless-all\app\src-tauri\Cargo.toml --target x86_64-pc-windows-gnu
  • npm run tauri build -- --target x86_64-pc-windows-gnu --no-bundle
  • 启动 GNU release 产物后用 Win32 style probe 验证:HasSystemCaption=FalseHasThickFrame=True
  • 用 Win32 probe 验证右边缘拖拽可以改变窗口宽度,最大化按钮点击可以进入 zoomed 状态。
  • 人工复核 100% / 125% DPI 下四角圆角贴合效果。

Draft 说明

当前本地测试版已经明显改善,但四周圆角仍需要继续人工回归确认;因此先保持 Draft,不转 Ready。

本机验证备注

本机 C 盘空间紧张,构建验证已将 TMP/TEMPCARGO_TARGET_DIR 指向 D 盘临时目录,避免继续写入大量 AppData\Local\Temp\openless-*

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

@Cooper-X-Oak
Copy link
Copy Markdown
Contributor Author

补充了一版 Windows 圆角贴合修复:

  • 不再让 Windows 外层同时走 CSS 圆角和系统圆角,外边界交给 Win32/DWM 裁剪。
  • 用 HWND 兜底清理 WS_CAPTION | WS_THICKFRAME,避免 Tauri decorations 状态和真实 Win32 style 不一致。
  • 对主窗口应用 DWM rounded corner / no border color,并用 SetWindowRgn 裁剪真实窗口区域;窗口 resize/scale 后会重新套用。
  • 前端根层保持 transparent + overflow hidden,内部卡片保留自己的圆角。

本机补充验证:

  • npm run build
  • cargo check --lib --manifest-path openless-all\\app\\src-tauri\\Cargo.toml --target x86_64-pc-windows-gnu
  • npm run tauri build -- --target x86_64-pc-windows-gnu --no-bundle
  • 启动 release 产物后 Win32 style probe:HasSystemCaption=FalseHasThickFrame=False

构建临时目录继续放在 D 盘,C 盘 %TEMP% 没有 openless-* 残留。

@Cooper-X-Oak Cooper-X-Oak marked this pull request as draft May 1, 2026 09:55
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: 8f5b7682ce

ℹ️ 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 thread openless-all/app/src-tauri/src/lib.rs Outdated
Comment on lines +241 to +243
let native_frame_bits = (WS_CAPTION.0 | WS_THICKFRAME.0) as i32;
if style & native_frame_bits != 0 {
SetWindowLongW(hwnd, GWL_STYLE, style & !native_frame_bits);
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 Keep WS_THICKFRAME so borderless window stays resizable

Clearing WS_THICKFRAME here removes the native sizing border on Windows, so users can no longer resize the main window by dragging edges/corners after this commit. The frontend title bar (WindowChrome) only wires move/min/max/close actions and does not implement custom resize hit-testing, so there is no fallback path for resizing once this style bit is stripped.

Useful? React with 👍 / 👎.

@Cooper-X-Oak
Copy link
Copy Markdown
Contributor Author

继续保持 Draft。根据本机测试版复现,窗口交互问题拆成三条:

  • 边缘 resize:上一版把 WS_THICKFRAME 一起清掉,导致边缘没有系统 resize 能力。新提交改为只清 WS_CAPTION、保留 WS_THICKFRAME,并补 Windows 八方向 resize 热区调用 startResizeDragging
  • 标题按钮 hover:上一版按钮只有固定 inline style,没有 hover/pressed 状态。新提交改成 WinTitleButton,最小化/最大化/关闭都有 hover/pressed 反馈,关闭 hover 使用红底白字。
  • 标题按钮 click:自动化验证中最大化/关闭 click 可触发;本轮继续保留并提高标题栏 z-index,避免 resize 热区抢按钮中心点击。

本机验证:

  • npm run build
  • cargo check --lib --manifest-path openless-all\\app\\src-tauri\\Cargo.toml --target x86_64-pc-windows-gnu
  • npm run tauri build -- --target x86_64-pc-windows-gnu --no-bundle
  • Win32 交互探针:HasSystemCaption=FalseHasThickFrame=True;右边缘拖拽后 rect 从 80,80,1080,780 变为 80,80,1502,780;最大化按钮 click 后 IsZoomed=True

仍不转 ready,等人工视觉/手感确认圆角、边缘热区和按钮 hover。

@Cooper-X-Oak Cooper-X-Oak changed the title fix(windows): 修复主窗口双标题栏 fix(windows): 修复自绘窗口圆角与外框贴合 May 1, 2026
@Cooper-X-Oak
Copy link
Copy Markdown
Contributor Author

Governance note:

This draft PR is treated as the canonical implementation anchor for Family A: Window Shell Appearance, paired with issue #127.

Keep in scope:

  • main window shell fit
  • round corner / frame / titlebar continuity
  • frameless resize affordance when needed for shell usability

Keep out of scope:

  • capsule geometry
  • helper-window lifecycle ownership
  • QA helper-window semantics
  • dual hotkey source cleanup

Reference docs:

  • docs/2026-05-02-window-capability-family-audit.md
  • docs/github-tracking/windows-window-family-canonical-map.md

@Cooper-X-Oak
Copy link
Copy Markdown
Contributor Author

自动推进更新:\n\n- 已把当前工作区中属于 A 族群(窗口外观契约)的代码单独切回这条 canonical draft PR\n- 本轮新增点主要是:Windows shell radius / console radius 收紧、自绘 resize handles、tauri.conf main window frameless create、静态 UI guard 扩展\n- 已完成验证:\n -
ode openless-all/app/scripts/windows-ui-config.test.mjs\n -
pm run build\n - cargo check --manifest-path openless-all/app/src-tauri/Cargo.toml\n\n当前判断:代码层已收紧到可回归状态,但仍建议保持 draft,等待 Windows 实机 100% / 125% DPI 视觉回归。

@appergb
Copy link
Copy Markdown
Collaborator

appergb commented May 2, 2026

@Cooper-X-Oak 这条 PR 是 draft + CONFLICTING。main 在过去合入了 #145 tauri.conf.json visible: true → false 跨平台改动 + 启动顺序重构,跟本 PR 的同字段冲突。issue #127 (主窗口圆角与自绘外框贴合) 仍然 open + priority: high label。烦请基于最新 main rebase 后开新 PR。

提醒:此前评估发现本 PR 当前的 global.css overflow / isolation: isolate + tauri.conf.json visible:false 是跨平台改动。后者在 #145 里已经做了,rebase 后请只保留 Windows DWM 圆角(apply_windows_rounded_frame) + WindowsResizeHandles 那块(macOS 路径 #[cfg(...)] gate 干净),避免再次跨平台 stacking-context 副作用。

这次关闭不是否定内容(DWM 圆角 + resize handles 的实现是对的),纯粹清场。

@appergb appergb closed this May 2, 2026
@Cooper-X-Oak
Copy link
Copy Markdown
Contributor Author

自动回归补充:\n\n- fresh-start smoke:powershell -ExecutionPolicy Bypass -File openless-all/app/scripts/windows-open-dev.ps1 -ExePath <#125 GNU dev exe> 通过\n- 进程状态:可见主窗口、Responding=True\n- 已完成自动门禁:\n -
ode openless-all/app/scripts/windows-ui-config.test.mjs\n -
pm run build\n - cargo check --manifest-path openless-all/app/src-tauri/Cargo.toml\n - powershell -ExecutionPolicy Bypass -File openless-all/app/scripts/windows-build-gnu.ps1\n\n结论:代码与自动 smoke 已达到进入 regression review 的条件;剩余重点是人工 Windows 视觉贴合回归。

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][P1] 主窗口四周圆角与自绘外框贴合不完整

2 participants