fix: use platform check API for menu decoration in treeland#318
Conversation
1. Replace manual platform name checking with DTK API to detect Wayland platform 2. Fix menu decoration issue under treeland by using proper platform detection method 3. Include DGuiApplicationHelper header for the new API usage Log: Fixed menu decoration issue in treeland environment by using correct platform detection API Influence: 1. Test menu display in treeland environment 2. Verify menu decorations appear correctly 3. Test menu functionality in other window managers (dxcb, dwayland) 4. Verify no regression in normal X11 environment 5. Test context menus in various applications fix: 适配treeland下菜单无装饰器问题 1. 使用DTK API替换手动平台名称检查来检测Wayland平台 2. 通过正确的平台检测方法修复treeland下的菜单装饰问题 3. 添加DGuiApplicationHelper头文件以使用新的API Log: 修复treeland环境下菜单没有装饰器的问题 Influence: 1. 在treeland环境测试菜单显示 2. 验证菜单装饰器是否正确显示 3. 在其他窗口管理器(dxcb、dwayland)测试菜单功能 4. 验证在普通X11环境下没有回归问题 5. 测试各种应用程序中的上下文菜单
Reviewer's guide (collapsed on small PRs)Reviewer's GuideThis PR fixes menu decoration handling under Treeland/Wayland by replacing manual platform name checks with the DTK DGuiApplicationHelper platform attribute API and updating includes accordingly. Sequence diagram for updated platform detection in ChameleonStyle::polishsequenceDiagram
participant ChameleonStyle
participant QWidget
participant DApplication
participant DGuiApplicationHelper
ChameleonStyle->>QWidget: polish(QWidget w)
ChameleonStyle->>DApplication: isDXcbPlatform()
alt DXcb platform
ChameleonStyle->>QWidget: qobject_cast<QMenu>(w) / inherits("QTipLabel")
ChameleonStyle->>QWidget: apply menu decoration
else not DXcb
ChameleonStyle->>DGuiApplicationHelper: testAttribute(IsWaylandPlatform)
alt Wayland platform (treeland, dwayland, etc.)
ChameleonStyle->>QWidget: qobject_cast<QMenu>(w) / inherits("QTipLabel")
ChameleonStyle->>QWidget: apply menu decoration
else not Wayland
ChameleonStyle->>QWidget: no special menu decoration
end
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[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 |
deepin pr auto review★ 总体评分:100分■ 【总体评价】
■ 【详细分析】
■ 【改进建议代码示例】 // 当前代码已为最佳实践,无需修改,此处展示当前正确实现供参考
#include <DGuiApplicationHelper>
// ...
void ChameleonStyle::polish(QWidget *w)
{
// ...
if (DApplication::isDXcbPlatform() || DGuiApplicationHelper::testAttribute(DGuiApplicationHelper::IsWaylandPlatform)) {
bool is_menu = qobject_cast<QMenu *>(w);
bool is_tip = w->inherits("QTipLabel");
// ...
}
} |
platform
detection method
Log: Fixed menu decoration issue in treeland environment by using
correct platform detection API
Influence:
fix: 适配treeland下菜单无装饰器问题
Log: 修复treeland环境下菜单没有装饰器的问题
Influence:
Summary by Sourcery
Use DTK's platform helper to detect Wayland and fix menu decoration behavior on treeland.
Bug Fixes:
Enhancements: