Skip to content

Commit

Permalink
fix: udpate blur background on window mode changed
Browse files Browse the repository at this point in the history
window frame to fullscreen frame update current background

Issue: linuxdeepin/developer-center#8828
  • Loading branch information
kegechen committed Jun 20, 2024
1 parent 5f3d718 commit 7e1a395
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
5 changes: 5 additions & 0 deletions launchercontroller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ void LauncherController::setVisible(bool visible)
emit visibleChanged(m_visible);
}

bool LauncherController::isFullScreenFrame() const
{
return m_currentFrame == QStringLiteral("FullscreenFrame");
}

QString LauncherController::currentFrame() const
{
return m_currentFrame;
Expand Down
1 change: 1 addition & 0 deletions launchercontroller.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ class LauncherController : public QObject

bool visible() const;
void setVisible(bool visible);
bool isFullScreenFrame() const;
QString currentFrame() const;
void setCurrentFrame(const QString & frame);

Expand Down
11 changes: 7 additions & 4 deletions src/ddeintegration/appearance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ Appearance::Appearance(QObject *parent)
if (key == "allwallpaperuris") updateAllWallpaper();
});

connect(&(LauncherController::instance()), &LauncherController::visibleChanged, this, [this](bool isVisible){
if (isVisible && (QStringLiteral("FullscreenFrame") == LauncherController::instance().currentFrame()))
updateCurrentWallpaperBlurhash();
});
connect(&(LauncherController::instance()), &LauncherController::currentFrameChanged,
this, &Appearance::updateCurrentWallpaperBlurhash);
connect(&(LauncherController::instance()), &LauncherController::visibleChanged,
this, &Appearance::updateCurrentWallpaperBlurhash);

if (m_dbusAppearanceIface->isValid()) {
connect(m_dbusAppearanceIface, &Appearance1::OpacityChanged, this, [this](double value) {
Expand All @@ -51,6 +51,9 @@ QString Appearance::wallpaperBlurhash() const

void Appearance::updateCurrentWallpaperBlurhash()
{
if (!LauncherController::instance().visible() || !LauncherController::instance().isFullScreenFrame())
return;

const QString screenName = qApp->primaryScreen()->name();
QDBusPendingReply<QString> async = m_dbusAppearanceIface->GetCurrentWorkspaceBackgroundForMonitor(screenName);
QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(async, this);
Expand Down

0 comments on commit 7e1a395

Please sign in to comment.