Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion panels/dock/dockpanel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,13 @@ bool DockPanel::init()
m_theme = static_cast<ColorTheme>(Dtk::Gui::DGuiApplicationHelper::instance()->themeType());
auto platformName = QGuiApplication::platformName();
if (QStringLiteral("wayland") == platformName) {
// TODO: support get color type from wayland
m_helper = new WaylandDockHelper(this);
// Fallback to DGuiApplicationHelper for theme color when wayland wallpaper color is not available.
// TODO: remove this when initWallpaperColorManager is re-enabled
QObject::connect(Dtk::Gui::DGuiApplicationHelper::instance(), &Dtk::Gui::DGuiApplicationHelper::themeTypeChanged,
this, [this]() {
setColorTheme(static_cast<ColorTheme>(Dtk::Gui::DGuiApplicationHelper::instance()->themeType()));
});
} else if (QStringLiteral("xcb") == platformName) {
QObject::connect(Dtk::Gui::DGuiApplicationHelper::instance(), &Dtk::Gui::DGuiApplicationHelper::themeTypeChanged,
this, [this](){
Expand Down
42 changes: 24 additions & 18 deletions panels/dock/waylanddockhelper.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

Expand All @@ -22,26 +22,12 @@ WaylandDockHelper::WaylandDockHelper(DockPanel *panel)
, m_isCurrentActiveWindowFullscreened(false)
, m_panel(panel)
{
m_wallpaperColorManager.reset(new WallpaperColorManager(this));
m_ddeShellManager.reset(new TreeLandDDEShellManager());
DS_NAMESPACE::DAppletBridge bridge("org.deepin.ds.dock.taskmanager");
if (auto applet = bridge.applet()) {
connect(applet, SIGNAL(windowFullscreenChanged(bool)), this, SLOT(setCurrentActiveWindowFullscreened(bool)));
}

connect(m_panel, &DockPanel::rootObjectChanged, this, [this]() {
m_wallpaperColorManager->watchScreen(dockScreenName());
});

connect(m_wallpaperColorManager.get(), &WallpaperColorManager::activeChanged, this, [this]() {
if (m_panel->rootObject() != nullptr) {
m_wallpaperColorManager->watchScreen(dockScreenName());
}
});

connect(m_panel, &DockPanel::dockScreenChanged, this, [this]() {
m_wallpaperColorManager->watchScreen(dockScreenName());
});

connect(m_panel, &DockPanel::positionChanged, this, &WaylandDockHelper::updateOverlapCheckerPos);
connect(m_panel, &DockPanel::dockSizeChanged, this, &WaylandDockHelper::updateOverlapCheckerPos);
Expand All @@ -65,9 +51,6 @@ WaylandDockHelper::WaylandDockHelper(DockPanel *panel)
}
});

if (m_panel->rootObject() != nullptr) {
m_wallpaperColorManager->watchScreen(dockScreenName());
}
}

void WaylandDockHelper::updateOverlapCheckerPos()
Expand Down Expand Up @@ -139,6 +122,29 @@ bool WaylandDockHelper::isWindowOverlap()
return m_isWindowOverlap;
}

void WaylandDockHelper::initWallpaperColorManager()
{
m_wallpaperColorManager.reset(new WallpaperColorManager(this));

connect(m_panel, &DockPanel::rootObjectChanged, this, [this]() {
m_wallpaperColorManager->watchScreen(dockScreenName());
});

connect(m_wallpaperColorManager.get(), &WallpaperColorManager::activeChanged, this, [this]() {
if (m_panel->rootObject() != nullptr) {
m_wallpaperColorManager->watchScreen(dockScreenName());
}
});

connect(m_panel, &DockPanel::dockScreenChanged, this, [this]() {
m_wallpaperColorManager->watchScreen(dockScreenName());
});

if (m_panel->rootObject() != nullptr) {
m_wallpaperColorManager->watchScreen(dockScreenName());
}
}

void WaylandDockHelper::setDockColorTheme(const ColorTheme &theme)
{
m_panel->setColorTheme(theme);
Expand Down
3 changes: 2 additions & 1 deletion panels/dock/waylanddockhelper.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2024 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later
#pragma once
Expand Down Expand Up @@ -42,6 +42,7 @@ protected Q_SLOTS:

private:
void updateOverlapCheckerPos();
void initWallpaperColorManager();

private:
friend class TreeLandWindowOverlapChecker;
Expand Down
Loading