fix(windows): 拆分 Capsule 平台承载并恢复完整视口#188
Conversation
There was a problem hiding this comment.
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
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: cad8536884
ℹ️ 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".
| #[cfg(target_os = "windows")] | ||
| use window_vibrancy::apply_mica; | ||
| 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); |
There was a problem hiding this comment.
Guard Windows-only main-window calls with cfg
Wrap the Windows-specific calls in configure_main_window_for_platform with #[cfg(target_os = "windows")] (or an equivalent block). As written, window.set_decorations(false), apply_mica(...), and apply_windows_rounded_frame(...) are emitted for non-Windows targets too, but apply_mica is only imported on Windows and apply_windows_rounded_frame is itself Windows-gated, so non-Windows builds fail when compiling this function.
Useful? React with 👍 / 👎.
|
补充验证证据:
|
|
|
Codex:P1 |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
已处理 review 提到的
这条修正只处理 review 提到的 cfg 包裹问题,不改变 |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7dcca318e0
ℹ️ 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".
| coordinator.start_qa_hotkey_listener(); | ||
| if std::env::var("OPENLESS_SHOW_MAIN_ON_START").ok().as_deref() == Some("1") { | ||
| show_main_window(app.handle()); | ||
| } | ||
|
|
||
| Ok(()) |
There was a problem hiding this comment.
Restore OPENLESS_SHOW_MAIN_ON_START startup hook
The setup path now returns immediately after starting listeners and no longer checks OPENLESS_SHOW_MAIN_ON_START, so the existing Windows automation paths that still set this variable (for example scripts/windows-cold-start.ps1 in ForceImmediateShow mode and other smoke scripts) have lost their explicit backend-driven “show + focus main window” override. This is a regression in test/dev workflow behavior because those flows can no longer force the foreground activation path that previously called show_main_window (show/unminimize/set_focus).
Useful? React with 👍 / 👎.
|
Codex:p2 |

摘要
Fixes #139.
这个 PR 解决的单一目标是:
修复 Windows Capsule 宿主 viewport 被系统窗口非客户区吃掉后,胶囊本体被压进更小矩形、出现白框 / 宿主矩形可见 / 底部裁切的问题。
这个 PR 基于最新
upstream/main干净重放,只包含这次 Capsule 修复所需的最小改动,不依赖之前本地工作树的其他上下文。修复 / 新增 / 改进
Capsule.tsx拆成平台路由,只负责win -> WindowsCapsule、非 Windows ->SharedCapsuleuseCapsuleState.ts,统一承接 capsule 状态订阅与动作命令兼容
SharedCapsule测试计划
命令:
npm run build结果:通过
证据路径:本地 clean worktree 终端构建记录;Vite build 完成,无阻塞错误
命令:
cargo check --manifest-path Cargo.toml结果:通过
证据路径:
openless-all/app/src-tauri目录下本地 clean worktree 检查记录;Rust backend check 完成,仅有既有 warning命令:本地 debug 运行 + WebView2 remote debugging 读取 Capsule layout metrics
结果:通过
证据路径:本地验证结果显示 Capsule
innerWidth/innerHeight从修复前的164x44恢复到196x52,对应胶囊完整显示,不再被宿主矩形裁切