Repository navigation
🐞 fix: 修复嵌入桌面图标层后顶部白条残留 - #5
Conversation
问题:DeskZero 嵌入到桌面图标层(壁纸与桌面图标之间)后,窗口顶部出现一条白色标题栏,左上角显示 "deskzero" 字样。 根因: 1. WNDPROC 子类化只拦截了 WM_NCCALCSIZE,但 Windows 11 仍会通过 WM_NCPAINT 和 WM_NCACTIVATE 触发非客户区重绘 2. Windows 11 DWM 在窗口周围强制绘制几像素的"隐形边框"和圆角,仅靠 WNDPROC 拦截无法消除 3. subclass_window 多次调用时会用 custom_wndproc 自身覆盖 OLD_WNDPROC,导致消息处理无限递归 修复: - 拦截 WM_NCPAINT(返回 0)阻止非客户区绘制 - 拦截 WM_NCACTIVATE(返回 1)阻止激活态非客户区重绘 - 通过 DwmSetWindowAttribute 禁用窗口圆角(DWMWA_WINDOW_CORNER_PREFERENCE = 1)和非客户区渲染(DWMWA_NCRENDERING_POLICY = 1) - 通过 DwmExtendFrameIntoClientArea 将所有边距设为 -1,扩展到整个窗口 - 修复 subclass_window 递归 Bug,只在第一次记录 OLD_WNDPROC - 在 build.rs 链接 dwmapi.lib 验证:npm run tauri build 重新构建后,exe 启动并嵌入桌面图标层,顶部白条已完全消失。
There was a problem hiding this comment.
Code Review
This pull request introduces changes to eliminate Windows 11 invisible borders and rounded corners using the DWM API, and refactors window styling logic to handle embedding failures gracefully. The reviewer identified two critical issues: first, a potential data race and window procedure bypass involving the static mutable OLD_WNDPROC variable, which should be made thread-safe using an atomic type; second, a race condition in the fallback path where synchronous Win32 API calls in a background thread are overridden by asynchronous Tauri window operations, which should instead be dispatched to the main thread.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
- 将 OLD_WNDPROC 改为 AtomicIsize,保证线程安全 - 将回退路径的 Tauri 窗口操作分发到主线程执行,修复竞态条件
问题:DeskZero 嵌入到桌面图标层(壁纸与桌面图标之间)后,窗口顶部出现一条白色标题栏,左上角显示 "deskzero" 字样。
根因:
修复:
验证:npm run tauri build 重新构建后,exe 启动并嵌入桌面图标层,顶部白条已完全消失。