Skip to content

fix(windows): 使用 Acrylic 控制器修复边缘模糊并保持失焦效果 - #1

Merged
JoyElliot merged 15 commits into
mainfrom
acrylic-controller
Sep 26, 2026
Merged

JoyElliot merged 15 commits into
mainfrom
acrylic-controller

Conversation

@JoyElliot

@JoyElliot JoyElliot commented Sep 22, 2026 •

Copy link
Copy Markdown
Owner

Result / 用户结果

Windows 窗口贴近屏幕边缘时,原 Accent Acrylic 会透出未充分模糊的背景细节。本改动在受支持的系统上使用 DesktopAcrylicController 改善边缘,并显式配置失焦状态,避免切到其他窗口后变成不透明灰底。保留现有透明度、主题及窗口内容绘制,不增加边缘遮罩。最大化与还原到窗口的动画期间暂时清空 backdrop,避免旧模糊采样随窗口拉伸/裁切,随后恢复;普通移动、最小化到任务栏及从任务栏恢复保持原生材质行为。

这是 fork 内部验收 PR。启动空白和初始尺寸跳变不包含在本次改动中。

Design / 设计边界

  • 原生运行库、控制器和 Composition 资源归属 platform/acrylic;gpui_shell/wallpaper.rs 继续负责材质选择和每窗口更新门控。
  • Windows 11 22H2+ 优先使用已安装、架构匹配的 Windows App Runtime 1.8(最低已测版本 8000.946.1701.0)。缺失运行库或创建失败时保留现有 Accent 回退,不安装或随包捆绑运行库。
  • 平台差异归属 platform/acrylic 门面,非 Windows 保持原有 GPUI 材质路径;Windows 原生验收测试与控制器生命周期同目录。
  • HWND 的 backdrop 随窗口关闭或材质切换释放;共享 DispatcherQueue 只在应用循环退出后排空。资源保持在 UI 线程,不新增工作线程、焦点轮询或逐帧材质调用。
  • 透明度更新不重建控制器;先清理旧 Accent/DWM 通道,再绑定新材质。
  • 动画回退由每个 Backdrop 拥有的原生子类回调管理:系统命令及 ShowWindow 路径均覆盖;300 ms 非阻塞恢复窗口只是本机验证的 settling interval,并非 DWM 动画完成通知。旧定时消息不会提前恢复,新 SDK 材质优先,窗口销毁前取消回调和定时器。
  • 决策与兼容边界见 architecture/notes/nebula_app/platform/2026-09-22-acrylic-controller.md 及同目录 2026-09-22-acrylic-window-transitions.md。

Evidence / 验证依据

  • 默认 GPUI 产品 cargo build -p nebula --locked 成功。
  • cargo test -p nebula --bin pebrel --features gpui-test-support platform::acrylic:: --locked --offline -- --include-ignored --test-threads=1:4 项测试通过,覆盖缺失运行库、无效 HWND、双窗口资源、材质切换、ShowWindowAsync/系统命令、旧 queued timer、连续切换、任务栏最小化/恢复材质不变、最新 SDK brush 优先、HWND 先销毁以及队列退出。
  • cargo test -p nebula --bin pebrel native_acrylic_gpui_material_switches_and_window_lifecycle -- --ignored --test-threads=1:1 项真实 GPUI 测试通过,覆盖五种材质切换、相同档位第二窗口、21 次透明度更新不重建、窗口关闭及正常应用退出。
  • Windows 11 build 26200.9457、150% DPI 的真实产品截图覆盖浮动、贴左/贴右、最大化、失焦及恢复焦点。新方案保持失焦模糊;相较旧 Accent 略亮,不宣称完全相同的材质像素。
  • 前期 16 轮交替原型采样隔离目标 PID/窗口线程:窗口线程 cycles 中位数约增加 5–10%,工作集约增加 3 MiB;CPU 时间有波动,不构成通用性能保证。正式产品与验收原型的干净背景区域逐像素一致。
  • 平台 cfg 门禁保持原预算 484,11 项平台/CI 合同测试通过。
  • python scripts/check_architecture.py --base 3050374343f0b3b1821c38ffaedb3a75201b6355、git diff --check、cargo fmt --all -- --check --config newline_style=Auto 通过。newline_style=Auto 用于本机 CRLF checkout;未格式化无关文件。
  • 动画验收使用有明显色块与重复文字的真实背景;对比旧 Accent、未修复控制器、透明回退。SYSTEMBACKDROP AUTO/叠加透明 Accent 未解决旧采样;关闭 GPUI DComp 会破坏正文,未采用。最小化前异步准备虽然能清除快照,但产生先闪一下再缩小的视觉代价,未采用;不加入 CBT hook、延迟最小化或同步等待。
  • Windows 10、其他 GPU、混合 DPI 多屏、高对比和系统透明策略切换尚未实机验收。未运行完整跨平台测试套件;原生桌面测试为显式 opt-in,普通 CI 不会自动覆盖桌面视觉。

Required Review / 必须确认

  • 遵循 CONTRIBUTING.md、docs/architecture.md 和 docs/project-constraints.md。
  • 按职责划分原生资源与 UI 编排,没有复制主题、透明度或设置规则。
  • 架构检查通过,没有提高预算或新增排除项。
  • 成功及失败路径有覆盖,平台和实机验收限制如上所述。
  • 无新增用户界面文案或持久化格式。
  • 无治理规则变更。

这些本地结果不代替 CI 和维护者审查。

上游草稿 PR:https://github.com/Kuddev/pebrel/pull/250(关联上游 issue Kuddev#236 的 Acrylic 部分)。

@github-actions

Copy link
Copy Markdown

This pull request changes 8265 source lines (limit 1500; docs, lockfiles and assets excluded). Changes this large cannot be reviewed reliably, so please split it into independent pull requests — one behaviour change each, with its own tests.

本 PR 改动 8265 行源码(上限 1500,不计文档、lockfile、资源)。这么大的改动无法可靠审查,请拆成多个相互独立的 PR,每个只做一件事并附测试。

Maintainers can add the size-exempt label for integration branches. / 维护者可对集成分支加 size-exempt 放行。

JoyElliot and others added 10 commits September 26, 2026 00:16
…#133)

Localize GPUI workspace controls, split actions, file panels, and close confirmations using existing typed messages and application language.

Add 57 English/Chinese message entries and focused i18n regressions. Keep close confirmations in the existing closing lifecycle module.

Retain the scoped contribution from PR Kuddev#133 without adding global language state, translation macros, or legacy-shell migrations.
Use pinned nextest for full native tests while retaining doctests, production-feature checks and both macOS release checks.

Publish shared dependency snapshots from successful default-branch runs, keep compiled artifacts architecture-specific, and preserve cross-process exclusion for shared theme fixtures.

Run the full platform matrix for both draft and ready pull requests without repeating it for readiness-only transitions.
Forward the current and legacy hook executable variables through WSLENV with /p path translation. Document the boundary contract and cover the primary hook variable in the existing environment test.
…ddev#293)

Add opt-in off/smooth cursor-motion preferences with conservative defaults and reset support. Add GPUI-local motion trajectory contracts and synchronized-update snapshot regression coverage. Renderer and settings UI integration remain separate.
Complete the Traditional Chinese catalog and align Taiwan UI terminology. Preserve message IDs and placeholders, correct the search coverage wording, and label backup contents consistently.
Keep DECSET 2031 enable/re-enable silent while retaining reports for actual palette changes. Cover repeated subscriptions and byte boundaries.

Fixes Kuddev#283.
…ws (Kuddev#234)

Reanchor only uniquely matched content after complete synchronized Pi redraws. Preserve standard clearing and cancel stale anchors on user actions or interrupted updates.

Related to Kuddev#159.
@JoyElliot
JoyElliot merged commit c70073b into main Sep 26, 2026
10 of 11 checks passed
@JoyElliot
JoyElliot deleted the acrylic-controller branch September 26, 2026 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants