fix: fallback dock theme to system settings on wayland#1605
Conversation
1. Disable WallpaperColorManager initialization in WaylandDockHelper constructor 2. Extract wallpaper color management to a separate initWallpaperColorManager() method 3. Connect dock theme changes to DGuiApplicationHelper themeTypeChanged signal on Wayland 4. This ensures dock follows system theme when wallpaper color is unavailable Log: Dock theme on Wayland now falls back to system color settings Influence: 1. Test dock color theme toggling between light and dark on Wayland 2. Verify dock theme syncs with system settings after change 3. Ensure no regression in dock color behavior on X11 4. Check that wallpaper color feature is cleanly disabled without errors 5. Verify dock screen changes don't trigger wallpaper color manager calls fix: wayland下dock暗亮色回退到系统设置 1. 禁用WaylandDockHelper构造函数中的WallpaperColorManager初始化 2. 将壁纸颜色管理提取到独立的initWallpaperColorManager()方法中 3. 在Wayland上连接dock主题变化到DGuiApplicationHelper的themeTypeChanged 信号 4. 确保壁纸颜色不可用时dock遵循系统主题 Log: Wayland下Dock主题现在回退到系统颜色设置 Influence: 1. 在Wayland上测试dock颜色主题在亮色和暗色间切换 2. 验证dock主题在系统设置更改后同步 3. 确保X11上dock颜色行为无回归 4. 检查壁纸颜色功能被干净禁用,无错误产生 5. 验证dock屏幕变化不会触发壁纸颜色管理器调用 PMS: BUG-344841
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: 18202781743 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 |
Reviewer's GuideRefactors Wayland dock wallpaper color handling by disabling WallpaperColorManager initialization on Wayland, extracting it into a dedicated initializer, and wiring the dock’s color theme to DGuiApplicationHelper’s themeTypeChanged signal so that on Wayland the dock falls back to system theme colors when wallpaper-based colors are unavailable. Sequence diagram for dock theme fallback to system settings on WaylandsequenceDiagram
participant DGuiApplicationHelper
participant DockPanel
participant WaylandDockHelper
participant WallpaperColorManager
Note over DockPanel,WaylandDockHelper: Wayland platform
alt [wallpaper color available]
DockPanel->>WaylandDockHelper: initWallpaperColorManager()
WaylandDockHelper->>WallpaperColorManager: watchScreen(dockScreenName())
WallpaperColorManager-->>DockPanel: activeChanged
DockPanel->>DockPanel: setColorTheme(ColorTheme_from_wallpaper)
else [wallpaper color unavailable]
DGuiApplicationHelper-->>DockPanel: themeTypeChanged
DockPanel->>DockPanel: setColorTheme(ColorTheme_from_themeType)
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review你好!我是CodeGeeX,你的智能编程助手。我已经仔细审查了你提供的 Git Diff。本次修改主要针对 Wayland 环境下的 Dock 面板主题颜色获取逻辑进行了重构,将 以下是针对语法逻辑、代码质量、代码性能和代码安全四个方面的详细审查意见及改进建议: 1. 语法与逻辑
2. 代码质量
3. 代码性能
4. 代码安全
💡 综合改进建议代码示例基于以上分析,我为你优化了 // panels/dock/dockpanel.cpp
bool DockPanel::init()
{
m_theme = static_cast<ColorTheme>(Dtk::Gui::DGuiApplicationHelper::instance()->themeType());
auto platformName = QGuiApplication::platformName();
// 提取公共 Fallback 逻辑,消除代码重复,并增加 this 作为 receiver 保证对象析构时安全断开连接
// TODO: remove this when initWallpaperColorManager is re-enabled for Wayland
QObject::connect(Dtk::Gui::DGuiApplicationHelper::instance(), &Dtk::Gui::DGuiApplicationHelper::themeTypeChanged,
this, [this]() {
setColorTheme(static_cast<ColorTheme>(Dtk::Gui::DGuiApplicationHelper::instance()->themeType()));
});
if (QStringLiteral("wayland") == platformName) {
m_helper = new WaylandDockHelper(this);
// Fallback to DGuiApplicationHelper for theme color when wayland wallpaper color is not available.
// 注意:未来重新启用 initWallpaperColorManager 时,需在此处断开上述 Fallback 连接
} else if (QStringLiteral("xcb") == platformName) {
// xcb 的逻辑已经被上方的公共逻辑取代,如无特殊需求可留空或删除原有重复代码
}
// ... 其他逻辑
}对于 |
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- The new
initWallpaperColorManager()helper is currently unused; consider either wiring it behind a clear feature flag or removing it for now to avoid dead code and keep the Wayland path easier to reason about. - In
DockPanel::init()on Wayland, thethemeTypeChangedconnection is created unconditionally; ifinit()can be called more than once, consider usingQt::UniqueConnectionor moving this connection to the constructor to avoid accumulating duplicate connections.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The new `initWallpaperColorManager()` helper is currently unused; consider either wiring it behind a clear feature flag or removing it for now to avoid dead code and keep the Wayland path easier to reason about.
- In `DockPanel::init()` on Wayland, the `themeTypeChanged` connection is created unconditionally; if `init()` can be called more than once, consider using `Qt::UniqueConnection` or moving this connection to the constructor to avoid accumulating duplicate connections.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
constructor
initWallpaperColorManager() method
signal on Wayland
unavailable
Log: Dock theme on Wayland now falls back to system color settings
Influence:
calls
fix: wayland下dock暗亮色回退到系统设置
信号
Log: Wayland下Dock主题现在回退到系统颜色设置
Influence:
PMS: BUG-344841
Summary by Sourcery
Make the Wayland dock fall back to system theme settings when wallpaper-based colors are unavailable.
Bug Fixes:
Enhancements: