Repository navigation
feat(window): transparent framebuffer support for rounded custom chrome - #92
Closed
Linductor-alkaid wants to merge 1 commit into
Closed
Linductor-alkaid wants to merge 1 commit into
Linductor-alkaid wants to merge 1 commit into
Conversation
DslAppConfig gains .transparent(bool) plumbed into WindowCreateRequest: GLFW requests GLFW_TRANSPARENT_FRAMEBUFFER, Vulkan selects a supported composite-alpha mode (POST_MULTIPLIED preferred) instead of hardcoding OPAQUE, and framebufferTransparent() reports what the platform granted. SDL2 has no transparent-window flag (SDL3-only) and reports false. The renderer already produces premultiplied content, so apps can clear to transparent and draw their own rounded root surface. Issue: sudoevolve#90
Owner
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
.decorated(false)应用自绘圆角窗口需要带 alpha 的 framebuffer:WindowCreateRequest没有透明选项、GLFW 后端从不设置GLFW_TRANSPARENT_FRAMEBUFFER,clearColor的 alpha 写进的是不透明表面,圆角窗口无法实现。(0,0,0,0)清屏上恰好产出合成器期望的 premultiplied 内容)。修改
WindowCreateRequest.transparent(默认 false):GLFW 后端映射为glfwWindowHint(GLFW_TRANSPARENT_FRAMEBUFFER, ...)(该常量自 GLFW 3.3 起存在,且同时是窗口属性,可查询实际授予状态);SDL2 后端忽略(SDL2 无透明窗口 flag,SDL3 才加入),framebufferTransparent()如实返回 false。framebufferTransparent(Handle):报告平台实际授予状态(X11 无合成器时 GLFW 会拒绝)。DslAppConfig.transparent(bool)→app::windowTransparent()→ 两个*_app_main的主窗口请求与createRenderBackend第三参。compositeAlpha不再硬编码 OPAQUE,transparent 时从capabilities.supportedCompositeAlpha优先选POST_MULTIPLIED(渲染内容为 premultiplied),次选INHERIT,否则退回OPAQUE,不会因不支持而创建失败。tests/fixtures/transparent_window_viewer.cpp:透明无边框窗口 + 圆角面板 +framebufferTransparent状态展示。docs/DSL.md:.transparent(true)说明;原文"全屏、透明窗口和 VSync 不属于 DslAppConfig"中透明窗口属创建期属性(与decorated同类),移出该清单并说明查询方式。.transparent()的应用行为逐像素等价。影响
本机环境
-std=gnu++17 -Os -fno-exceptions -fno-rtti编译)验证
ctest -L unit25/25,DISPLAY=:0 ctest -L probe8/8)transparent_window_viewer以 X11 平台运行 12s 无错误退出,窗口存在;真机 GNOME/XWayland 下窗口深度 32 ARGB,四角像素 alpha=0,圆角外透出桌面)备注
glfwGetWindowAttrib(GLFW_TRANSPARENT_FRAMEBUFFER)为 true,窗口 composite pixmap 四角rgba=(0,0,0,0),背景矩形以 radius 12 绘制后圆角边缘抗锯齿正常。POST_MULTIPLIED/INHERIT回退链未做运行时验证(本机无 Vulkan 头文件环境),需 CI 编译与后续运行确认。