From 7d07d5e64a40fc943b9b4a5d06d92bf69697d551 Mon Sep 17 00:00:00 2001 From: tsic404 Date: Fri, 10 May 2024 15:18:31 +0800 Subject: [PATCH] fix: dock not shown with launchpad log: as title issue: https://github.com/linuxdeepin/developer-center/issues/8502 --- panels/dock/dockpanel.cpp | 16 +++++++++++++++- panels/dock/dockpanel.h | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/panels/dock/dockpanel.cpp b/panels/dock/dockpanel.cpp index 73c626a4c..fc6844fc2 100644 --- a/panels/dock/dockpanel.cpp +++ b/panels/dock/dockpanel.cpp @@ -35,6 +35,7 @@ DockPanel::DockPanel(QObject * parent) , m_theme(ColorTheme::Dark) , m_hideState(Hide) , m_compositorReady(false) + , m_launcherShown(false) { // connect(this, &DockPanel::compositorReadyChanged, this, &DockPanel::loadDockPlugins); } @@ -131,6 +132,9 @@ bool DockPanel::init() Q_EMIT dockDaemonAdaptor->FrontendWindowRectChanged(frontendWindowRect()); }); + // TODO: get launchpad status from applet not dbus + QDBusConnection::sessionBus().connect("org.deepin.dde.Launcher1", "/org/deepin/dde/Launcher1", "org.deepin.dde.Launcher1", "VisibleChanged", this, SLOT(launcherVisibleChanged(bool))); + return true; } @@ -258,7 +262,7 @@ void DockPanel::setCompositorReady(bool ready) HideState DockPanel::hideState() { - if (hideMode() == KeepShowing) + if (hideMode() == KeepShowing || m_launcherShown) return Show; return m_hideState; } @@ -314,6 +318,16 @@ void DockPanel::loadDockPlugins() } } +void DockPanel::launcherVisibleChanged(bool visible) +{ + if (visible == m_launcherShown) return; + + m_launcherShown = visible; + if (hideMode() != KeepShowing) { + Q_EMIT hideStateChanged(hideState()); + } +} + void DockPanel::setMouseGrabEnabled(QQuickItem *item, bool enabled) { if (!item) return; diff --git a/panels/dock/dockpanel.h b/panels/dock/dockpanel.h index c8db6d6f2..d9c2dbbb8 100644 --- a/panels/dock/dockpanel.h +++ b/panels/dock/dockpanel.h @@ -80,6 +80,7 @@ class DockPanel : public DS_NAMESPACE::DPanel, public QDBusContext private Q_SLOTS: void onWindowGeometryChanged(); void loadDockPlugins(); + void launcherVisibleChanged(bool visible); Q_SIGNALS: void geometryChanged(QRect geometry); @@ -99,6 +100,7 @@ private Q_SLOTS: HideState m_hideState; DockHelper* m_helper; bool m_compositorReady; + bool m_launcherShown; }; }