diff --git a/launchercontroller.cpp b/launchercontroller.cpp index a6ad273a..52e9bf86 100644 --- a/launchercontroller.cpp +++ b/launchercontroller.cpp @@ -127,6 +127,7 @@ void LauncherController::setCurrentFrame(const QString &frame) settings.setValue("current_frame", frame); m_currentFrame = frame; + m_timer->start(); emit currentFrameChanged(); } @@ -141,3 +142,8 @@ void LauncherController::hideWithTimer() setVisible(false); } } + +bool LauncherController::shouldAvoidHideOrActive() +{ + return m_timer->isActive(); +} diff --git a/launchercontroller.h b/launchercontroller.h index c3c6dace..9835a119 100644 --- a/launchercontroller.h +++ b/launchercontroller.h @@ -35,6 +35,7 @@ class LauncherController : public QObject void setCurrentFrame(const QString & frame); Q_INVOKABLE void hideWithTimer(); + Q_INVOKABLE bool shouldAvoidHideOrActive(); signals: void currentFrameChanged(); diff --git a/qml/Main.qml b/qml/Main.qml index 16c8c145..83edbb17 100644 --- a/qml/Main.qml +++ b/qml/Main.qml @@ -137,7 +137,13 @@ QtObject { onActiveChanged: { if (!active && !DebugHelper.avoidHideWindow && (LauncherController.currentFrame === "WindowedFrame")) { - LauncherController.hideWithTimer() + // When composting is disabled, switching mode from fullscreen to windowed mode will cause window + // activeChanged signal get emitted. We reused the delay timer here to avoid the window get hide + // caused by that. + // Issue: https://github.com/linuxdeepin/developer-center/issues/6818 + if (!LauncherController.shouldAvoidHideOrActive()) { + LauncherController.hideWithTimer() + } } }