Repository navigation
feat: adapt dtkgui to Treeland 0.7.0 protocols - #416
18202781743 wants to merge 1 commit into
Conversation
|
Warning
|
Reviewer's GuideAdapts dtkgui’s Treeland backend from the legacy personalization protocol to Treeland 0.7.0 by generating and consuming separate appearance, decoration, and background-effect protocols, refactoring surface-lifecycle property application and independent blur state handling, and updating Qt5/Qt6 build dependencies. Sequence diagram for surface property applicationsequenceDiagram
participant Window as QWindow
participant Helper as DTreeLandPlatformWindowHelper
participant Decoration as TreelandDecorationContext
participant Effect as BackgroundEffectSurface
Window->>Helper: SurfaceCreated
Helper->>Helper: onSurfaceCreated()
Window->>Helper: Expose
Helper->>Helper: scheduleApply()
Helper->>Decoration: set_titlebar_mode()
Helper->>Decoration: set_corner_radius()
Helper->>Effect: setBlurRegion()
Helper->>Window: commit()
State diagram for independent Treeland blur modesstateDiagram-v2
[*] --> Disabled
Disabled --> WindowBlur: setEnableBlurWindow(true)
Disabled --> RegionBlur: setWindowBlurAreas() or setWindowBlurPaths()
WindowBlur --> Disabled: setEnableBlurWindow(false)
WindowBlur --> RegionBlur: setEnableBlurWindow(false)
RegionBlur --> Disabled: setWindowBlurAreas() or setWindowBlurPaths() with empty region
RegionBlur --> WindowBlur: setEnableBlurWindow(true)
File-Level Changes
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>| #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()) { |
There was a problem hiding this comment.
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.
| if (m_blurDirty) { | ||
| m_blurDirty = false; | ||
| if (m_blurEnabled && BackgroundEffectManager::instance()->isSupported() | ||
| && BackgroundEffectManager::instance()->hasBlurCapability()) { | ||
| if (!m_effectSurface) { |
There was a problem hiding this comment.
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.
|
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
|
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
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.
deepin pr auto reviewAI 代码审查报告
总体评价
本次 PR 将 dtkgui 从旧的 漏洞统计
漏洞对比统计:新增漏洞 0 个,减少漏洞 0 个,持平 0 个 四维度评分
维度1:语法逻辑 (25/25 ✓)
审查内容:
无语法逻辑问题。 维度2:代码质量 (23/25 ✓)
审查内容:
维度3:代码性能 (20/20 ✓)
审查内容:
无性能问题。 维度4:代码安全 (30/30 ✓)
审查内容:
安全合规。 改进建议
// 示例:模板基类减少重复
template<typename Derived, typename Interface>
class WaylandManagerBase : public QWaylandClientExtensionTemplate<Derived>,
public QtWayland::Interface
{
public:
static Derived *instance() {
static Derived inst;
return &inst;
}
[[nodiscard]] inline bool isSupported() const { return m_isSupported; }
protected:
WaylandManagerBase() : m_isSupported(false) {
auto *waylandIntegration = static_cast<QtWaylandClient::QWaylandIntegration *>(
QGuiApplicationPrivate::platformIntegration());
if (!waylandIntegration) {
qWarning() << "waylandIntegration is nullptr!!!";
return;
}
m_waylandDisplay = waylandIntegration->display();
if (!m_waylandDisplay) {
qWarning() << "waylandDisplay is nullptr!!!";
return;
}
m_waylandDisplay->addRegistryListener(&handleListenerGlobal, this);
m_isSupported = m_waylandDisplay->hasRegistryGlobal(
QString::fromUtf8(Interface::interface.name));
}
private:
static void handleListenerGlobal(void *data, wl_registry *registry,
uint32_t id, const QString &interface,
uint32_t version) {
if (interface == Interface::interface.name) {
auto *self = static_cast<Derived *>(data);
if (self) self->init(registry, id, version);
}
}
QtWaylandClient::QWaylandDisplay *m_waylandDisplay = nullptr;
bool m_isSupported;
};审查结论本次 PR 将 dtkgui 适配到 Treeland 0.7.0 协议体系,将原单一 |
|
[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 |
变更
适配 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 the personalization protocol with dedicated appearance, decoration, and background-effect integrations.
New Features:
Bug Fixes:
Enhancements:
Build:
Tests:
Chores: