Repository navigation
feat: adapt dtkgui to Treeland 0.7.0 protocols - #416
18202781743 wants to merge 1 commit into
Conversation
|
Warning
|
Reviewer's GuideData structuresIntroduce separate manager, context, and surface client-extension types for Treeland appearance, decoration, and background-effect protocols.
APIExtend platform-window blur APIs to route rectangular areas and painter paths to the Treeland implementation.
Uses of the APIReport titlebar and blur availability from their respective Treeland protocol managers.
ImplementationImplement appearance event handling and update platform-interface state from the new protocol callbacks.
Implement decoration and background-effect protocol managers and their surface/context wrappers.
Refactor Treeland window lifecycle, decoration scheduling, blur-region state, capability updates, and dragging behavior for the split protocols.
Remove the obsolete personalization protocol client implementation replaced by the new protocol extensions.
ConfigurationRequire TreelandProtocols 0.7.0 and WaylandProtocols 1.45 and generate the new protocol bindings for Qt5 and Qt6.
TestsUpdate the Treeland protocol configuration test to exercise the new decoration context protocol.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/plugins/platform/treeland/dtreelandplatformwindowinterface.cpp" line_range="161-166" />
<code_context>
return ret;
}
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
- QPointF delta = me->globalPosition() - self->m_pressPoint;
-#else
- QPointF delta = me->globalPos() - self->m_pressPoint;
-#endif
- if (delta.manhattanLength() < QGuiApplication::styleHints()->startDragDistance()) {
- return ret;
- }
</code_context>
<issue_to_address>
**issue (bug_risk):** The drag-distance guard was removed, so the first unaccepted left-button mouse move after a press starts a system window move regardless of how far the pointer moved. A click followed by a tiny pointer movement therefore initiates a window drag instead of preserving normal application mouse handling.
**Triggers:** When system move is enabled and a window receives a small mouse movement after a left-button press.
**Suggested fix:** Retain the `startDragDistance()` check using `m_pressPoint` before entering the system-move branch.
</issue_to_address>
### Comment 2
<location path="src/plugins/platform/treeland/dtreelandplatformwindowinterface.cpp" line_range="433-437" />
<code_context>
}
}
+
+ if (m_blurDirty) {
+ m_blurDirty = false;
+ if (m_blurEnabled && BackgroundEffectManager::instance()->isSupported()
+ && BackgroundEffectManager::instance()->hasBlurCapability()) {
+ if (!m_effectSurface) {
+ auto waylandWindow = dynamic_cast<QtWaylandClient::QWaylandWindow *>(window()->handle());
+ if (waylandWindow && waylandWindow->waylandSurface()) {
</code_context>
<issue_to_address>
**issue (bug_risk):** `applyPending()` clears `m_blurDirty` before checking whether the background-effect capability is available, while `blurCapabilityChanged()` only emits the window-manager-helper signal and never reschedules existing window helpers. If blur is enabled before the capability event arrives, the blur request is discarded and is never applied when the capability becomes available.
**Triggers:** When a window enables blur before the background-effect manager delivers its capabilities event.
**Suggested fix:** Keep the blur state dirty until it is applied, or connect the capability change to each helper and call `scheduleApply()` when blur becomes supported.
</issue_to_address>|
Warning
|
1 similar comment
|
Warning
|
b59d9b3 to
baa59ef
Compare
|
Warning
|
|
TAG Bot New tag: 6.7.51 |
baa59ef to
82fe66f
Compare
|
Warning
|
2 similar comments
|
Warning
|
|
Warning
|
1ad8e43 to
c6915b9
Compare
|
Warning
|
c6915b9 to
f9a0f40
Compare
|
Warning
|
f9a0f40 to
a17749f
Compare
|
Warning
|
a17749f to
02ac591
Compare
|
Warning
|
There was a problem hiding this comment.
Hey - I've found 2 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="src/plugins/plugins.cmake" line_range="58-63" />
<code_context>
pkg_check_modules(WAYLAND_CLIENT REQUIRED wayland-client)
-find_package(TreelandProtocols)
+find_package(TreelandProtocols 0.7.0 REQUIRED)
set(TreelandProtocols_FOUND ${TreelandProtocols_FOUND})
+find_package(ECM REQUIRED NO_MODULE)
+set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${ECM_MODULE_PATH}")
+find_package(WaylandProtocols 1.45 REQUIRED)
add_executable(${PROJECT_NAME} main.cpp)
</code_context>
<issue_to_address>
**Optional Treeland dependencies block configuration**
When the build environment lacks treeland-protocols 0.7.0 or wayland-protocols 1.45, cMake now requires Treeland and Wayland protocol packages while configuring Treeland support. A build environment without those optional packages fails configuration instead of simply omitting the Treeland backend, preventing builds for other supported platforms.
Treat these packages as optional during feature detection and disable Treeland support when they are unavailable.
Also at `src/plugins/platform/config.tests/treeland_test/CMakeLists.txt:22-26`.
</issue_to_address>
### Comment 2
<location path="src/kernel/dplatformhandle.cpp" line_range="613-615" />
<code_context>
+#endif
+#ifndef DTK_DISABLE_TREELAND
+ if (auto impl = dynamic_cast<DTreeLandPlatformWindowInterface *>(platformWindowImpl(&handle))) {
+ impl->setWindowBlurAreas(area);
+ return true;
+ }
#endif
handle.setEnableBlurWindow(true);
</code_context>
<issue_to_address>
**Platform support documentation is outdated**
The new Treeland routing makes some `DPlatformHandle` operations effective outside the DXCB/X11 platform, contradicting the class description that says its functionality is implemented by DXCB and the class has no effect on other platforms. Consumers relying on that description are misled about Treeland support.
Update the class description to identify the Treeland-supported operations and distinguish them from DXCB-only functionality.
</issue_to_address>| find_package(TreelandProtocols 0.7.0 REQUIRED) | ||
| find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS WaylandClient) | ||
| set(TreelandProtocols_FOUND ${TreelandProtocols_FOUND}) | ||
| find_package(ECM REQUIRED NO_MODULE) | ||
| set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${ECM_MODULE_PATH}") | ||
| find_package(WaylandProtocols 1.45 REQUIRED) |
There was a problem hiding this comment.
🟠 High · Optional Treeland dependencies block configuration
When the build environment lacks treeland-protocols 0.7.0 or wayland-protocols 1.45, cMake now requires Treeland and Wayland protocol packages while configuring Treeland support. A build environment without those optional packages fails configuration instead of simply omitting the Treeland backend, preventing builds for other supported platforms.
Treat these packages as optional during feature detection and disable Treeland support when they are unavailable.
Also at src/plugins/platform/config.tests/treeland_test/CMakeLists.txt:22-26.
Prompt for AI agents
In `src/plugins/plugins.cmake` at lines 58-63:
**Optional Treeland dependencies block configuration**
When the build environment lacks treeland-protocols 0.7.0 or wayland-protocols 1.45, cMake now requires Treeland and Wayland protocol packages while configuring Treeland support. A build environment without those optional packages fails configuration instead of simply omitting the Treeland backend, preventing builds for other supported platforms.
Treat these packages as optional during feature detection and disable Treeland support when they are unavailable.
Also at `src/plugins/platform/config.tests/treeland_test/CMakeLists.txt:22-26`.| impl->setWindowBlurAreas(area); | ||
| return true; | ||
| } |
There was a problem hiding this comment.
⚪ Low · Platform support documentation is outdated
The new Treeland routing makes some DPlatformHandle operations effective outside the DXCB/X11 platform, contradicting the class description that says its functionality is implemented by DXCB and the class has no effect on other platforms. Consumers relying on that description are misled about Treeland support.
Update the class description to identify the Treeland-supported operations and distinguish them from DXCB-only functionality.
Prompt for AI agents
In `src/kernel/dplatformhandle.cpp` at lines 613-615:
**Platform support documentation is outdated**
The new Treeland routing makes some `DPlatformHandle` operations effective outside the DXCB/X11 platform, contradicting the class description that says its functionality is implemented by DXCB and the class has no effect on other platforms. Consumers relying on that description are misled about Treeland support.
Update the class description to identify the Treeland-supported operations and distinguish them from DXCB-only functionality.|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743, BLumia The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
TAG Bot New tag: 6.7.52 |
|
TAG Bot New tag: 6.7.53 |
1. Split the monolithic treeland-personalization-manager-v1 protocol into three dedicated implementations: appearance (treeland-appearance- unstable-v1), decoration (treeland-decoration-unstable-v1), and background effect (ext-background-effect-v1) 2. Add new TreelandAppearance client extension to handle appearance properties including font, font size (point size divided by 10 with clamping to 8.25-15.00pt), icon theme, accent color, window opacity, color scheme, titlebar height, and corner radius 3. Add new TreelandDecorationManager and TreelandDecorationContext to handle window decoration properties like titlebar mode, corner radius, border, and shadow 4. Add new BackgroundEffectManager and BackgroundEffectSurface to handle blur window and blur region functionality with capability detection 5. Refactor DTreeLandPlatformWindowHelper to use separate feature flags for BlurWindow and BlurRegion, storing them independently 6. Apply decoration only after the surface's first configure (check isExposed) to avoid overriding xdg-decoration negotiation 7. Update DPlatformHandle to route blur area and blur path calls to the new DTreeLandPlatformWindowInterface methods 8. Update treeland window manager helper to check decoration and background effect managers separately for hasNoTitlebar and hasBlurWindow 9. Update build dependencies to require treeland-protocols >= 0.7.0 and wayland-protocols >= 1.45 10. Update CMake to scan the three new protocol XML files for both Qt6 and Qt5 builds 11. Remove obsolete personalizationwaylandclientextension files 12. Preserve uniform window lifecycle and property scheduling logic while adding repositioning drag threshold handling Log: Adapted to Treeland 0.7.0 split protocols for appearance, decoration, and background effect; separated blur window toggle from blur region with independent saving; applied decoration after first surface configure Influence: 1. Verify window decoration properties (titlebar, corner radius, border, shadow) apply correctly on freshly created windows 2. Test blur window toggle and blur region independently - enabling one should not affect the other 3. Verify blur area and blur path APIs route to background effect protocol on Treeland 4. Test window resizing when blur window is enabled to ensure blur region updates 5. Verify font size handling still divides by 10 and clamps to 8.25- 15.00pt range 6. Test window dragging with the updated manhattan length threshold logic 7. Verify fallback behavior when Treeland protocols are unsupported (returns false/empty values) 8. Check that decoration changes are not applied before the window is exposed 9. Test blur capability changes triggering re-application of blur state 10. Verify build succeeds with treeland-protocols 0.7.0 and wayland- protocols 1.45 feat: 适配 Treeland 0.7.0 协议拆分 1. 将单一的 treeland-personalization-manager-v1 协议拆分为三个独立实 现:appearance(treeland-appearance-unstable-v1)、decoration(treeland- decoration-unstable-v1)和 background effect(ext-background-effect-v1) 2. 新增 TreelandAppearance 客户端扩展,处理外观属性,包括字体、字号 (pointSize 除以 10 并限制在 8.25-15.00pt 范围内)、图标主题、强调色、窗 口不透明度、配色方案、标题栏高度和圆角半径 3. 新增 TreelandDecorationManager 和 TreelandDecorationContext,处理窗口 装饰属性,如标题栏模式、圆角半径、边框和阴影 4. 新增 BackgroundEffectManager 和 BackgroundEffectSurface,处理全窗模糊 和局部区域模糊功能,并支持能力检测 5. 重构 DTreeLandPlatformWindowHelper,使用独立的特性标记 BlurWindow 和 BlurRegion,并分别保存 6. 在 surface 首次 configure 完成后(检查 isExposed)才应用装饰,避免覆 盖 xdg-decoration 协商结果 7. 更新 DPlatformHandle,将模糊区域和模糊路径的调用路由到新的 DTreeLandPlatformWindowInterface 方法 8. 更新 treeland 窗口管理器辅助类,分别检查 decoration 和 background effect 管理器以确定 hasNoTitlebar 和 hasBlurWindow 9. 更新构建依赖,要求 treeland-protocols >= 0.7.0 和 wayland-protocols >= 1.45 10. 更新 CMake,为 Qt6 和 Qt5 构建扫描三个新的协议 XML 文件 11. 移除废弃的 personalizationwaylandclientextension 文件 12. 保留统一窗口生命周期和属性调度逻辑,同时增加拖拽重定位阈值处理 Log: 适配 Treeland 0.7.0 拆分协议,涵盖 appearance、decoration 和 background effect;全窗模糊开关与局部区域模糊独立保存;首次 surface 配置 完成后应用装饰 Influence: 1. 验证窗口装饰属性(标题栏、圆角、边框、阴影)在新建窗口上正确应用 2. 单独测试全窗模糊开关和局部区域模糊 - 启用其中一个不应影响另一个 3. 验证模糊区域和模糊路径 API 在 Treeland 上正确路由到 background effect 协议 4. 启用全窗模糊时测试窗口缩放,确保模糊区域正确更新 5. 验证字号处理逻辑仍除以 10 并限制在 8.25-15.00pt 范围内 6. 使用更新后的曼哈顿距离阈值逻辑测试窗口拖拽功能 7. 验证 Treeland 协议不支持时的回退行为(返回 false/空值) 8. 检查窗口未 exposed 前装饰变更不会被应用 9. 测试模糊能力变化触发模糊状态重新应用 10. 验证使用 treeland-protocols 0.7.0 和 wayland-protocols 1.45 构建成功 PMS: TASK-396717
02ac591 to
e572dbf
Compare
|
Warning
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: ['在 applyPending() 的 blur 非空分支中,当 backgroundEffectSurface() 返回 null 时也清除 dirty flags,或添加计数器限制重试次数避免无限重试', '在 handleListenerGlobal() 中匹配到接口时同步设置 m_isSupported = true', '在 treeland_appearance_v1_accent_color 中使用 qBound(0u, r, 255u) 对 RGB 值做范围限制'] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: ["为空实现的 setter 方法添加注释说明原因(如'设置由 compositor 通过 appearance 协议事件下发,客户端不需要主动设置')", '移除从未调用的 removeListener() 方法,或添加析构函数进行清理', '为 m_titleHeight 和 m_blurOpacity 添加 getter 或信号,或在不需要时移除成员和回调', '将 m_decorationContext 和 m_backgroundEffectSurface 声明为 mutable,移除 const_cast', '移除未使用的前向声明,为 bool 成员添加 = false 默认初始化器', "将 '!!!' 日志改为更专业的描述性消息"] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: ['在 backgroundEffectSurface() 返回 null 时也清除 dirty flags,或添加重试计数器/退避机制避免频繁重试'] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: ['在 setBlurRegion() 中添加 display 和 wlRegion 的 null 检查', '在 removeListener() 中添加 m_waylandDisplay null 检查(或移除死代码)', '在 static_cast 前通过 QGuiApplication::platformName() 检查平台,或使用 dynamic_cast'] 💡 改进建议代码示例// 修复1: applyPending() 中清除 dirty flags 避免重复调用
void DTreeLandPlatformWindowHelper::applyPending()
{
m_applyScheduled = false;
// ... decoration context handling ...
const auto blurFeatures = Features(BlurWindow) | BlurRegion;
if (m_dirty & blurFeatures) {
const QRegion region = m_blurWindowEnabled
? QRegion(QRect(QPoint(0, 0), window()->size())) : m_blurRegion;
auto waylandWindow = dynamic_cast<QtWaylandClient::QWaylandWindow *>(window()->handle());
bool changed = false;
if (region.isEmpty()) {
changed = m_backgroundEffectSurface != nullptr;
delete m_backgroundEffectSurface;
m_backgroundEffectSurface = nullptr;
m_dirty &= ~blurFeatures;
} else {
auto manager = BackgroundEffectManager::instance();
if (manager->hasBlurCapability() && waylandWindow) {
if (auto effect = backgroundEffectSurface()) {
effect->setBlurRegion(region, waylandWindow->display());
m_dirty &= ~blurFeatures;
changed = true;
}
}
// 即使 surface 未就绪也清除 flags,避免每次 Expose 重复触发
// surface 就绪后通过 blurCapabilityChanged 信号重新标记 dirty
if (m_dirty & blurFeatures) {
m_dirty &= ~blurFeatures;
}
}
if (changed && waylandWindow && waylandWindow->isExposed())
waylandWindow->commit();
}
}
// 修复2: setBlurRegion 添加 null 防御
void BackgroundEffectSurface::setBlurRegion(const QRegion ®ion,
QtWaylandClient::QWaylandDisplay *display)
{
if (!display) {
qWarning() << "BackgroundEffectSurface::setBlurRegion: display is null";
return;
}
auto wlRegion = display->createRegion(region);
if (!wlRegion) {
qWarning() << "BackgroundEffectSurface::setBlurRegion: failed to create wl_region";
return;
}
set_blur_region(wlRegion);
wl_region_destroy(wlRegion);
}
// 修复3: accent_color RGB 值范围限制
void TreelandAppearance::treeland_appearance_v1_accent_color(uint32_t r, uint32_t g, uint32_t b)
{
if (m_interface) {
m_interface->m_activeColor = QColor(
static_cast<int>(qBound(0u, r, 255u)),
static_cast<int>(qBound(0u, g, 255u)),
static_cast<int>(qBound(0u, b, 255u)));
emit m_interface->m_platformTheme->activeColorChanged(m_interface->m_activeColor);
}
}本报告由 AI 代码审查工具自动生成 |
变更
适配 treeland-protocols 0.7.0,将旧 personalization 协议替换为
treeland-appearance-unstable-v1、treeland-decoration-unstable-v1 和
ext-background-effect-v1,并更新 Qt5/Qt6 协议生成及依赖要求。
设置局部区域不修改全窗开关,关闭全窗后恢复保存的局部区域。
验证与待处理项
连续更新与清除、全窗与局部区域独立保存及切换。
关联任务
Summary by Sourcery
Adapt dtkgui to Treeland 0.7.0 by replacing personalization support with the new appearance, decoration, and background-effect protocols.
New Features:
Bug Fixes:
Enhancements:
Build:
Tests:
Chores: