diff --git a/launchercontroller.cpp b/launchercontroller.cpp index 58b17cb0..81fac513 100644 --- a/launchercontroller.cpp +++ b/launchercontroller.cpp @@ -141,7 +141,29 @@ bool LauncherController::visible() const void LauncherController::setVisible(bool visible) { - if (visible == m_visible) return; + if (!visible && m_showPending) { + m_showPending = false; + return; + } + + if (visible == m_visible || (visible && m_showPending)) return; + + if (visible && QGuiApplicationPrivate::popupCount() > 0) { + m_showPending = true; + closeAllPopups(); + + // Let Qt finish hiding the current popup and release the Wayland + // popup grab before the launcher window is mapped. + QTimer::singleShot(0, this, [this] { + if (!m_showPending) { + return; + } + + m_showPending = false; + setVisible(true); + }); + return; + } m_visible = visible; diff --git a/launchercontroller.h b/launchercontroller.h index 15954724..ea09d6ec 100644 --- a/launchercontroller.h +++ b/launchercontroller.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. +// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd. // // SPDX-License-Identifier: GPL-3.0-or-later @@ -86,6 +86,7 @@ class LauncherController : public QObject QTimer *m_timer; Launcher1Adaptor * m_launcher1Adaptor; bool m_visible; + bool m_showPending = false; QString m_currentFrame; QString m_currentScreen; bool m_pendingHide = false;