Skip to content

Commit 7b87246

Browse files
wjyrichdeepin-bot[bot]
authored andcommitted
fix: init showingDesktop for smart Hide.
as title. Logs:
1 parent 9abb8fd commit 7b87246

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

panels/dock/x11dockhelper.cpp

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
#include <QGuiApplication>
1717
#include <QPointer>
1818
#include <QDBusConnection>
19+
#include <QDBusInterface>
20+
#include <QDBusReply>
1921

2022
namespace dock {
2123
Q_LOGGING_CATEGORY(dockX11Log, "dde.shell.dock.x11")
@@ -628,15 +630,12 @@ void X11DockWakeUpArea::updateDockWakeArea(Position pos)
628630

629631
void X11DockHelper::setupKWinDBusConnection()
630632
{
631-
// 连接到 KWin 的 D-Bus 接口监听 showingDesktopChanged 信号
632-
QDBusConnection::sessionBus().connect(
633-
"org.kde.KWin",
634-
"/KWin",
635-
"org.kde.KWin",
636-
"showingDesktopChanged",
637-
this,
638-
SLOT(onShowingDesktopChanged(bool))
639-
);
633+
QDBusInterface kwin("org.kde.KWin", "/KWin", "org.kde.KWin", QDBusConnection::sessionBus());
634+
if (kwin.isValid()) {
635+
m_showingDesktop = kwin.property("showingDesktop").toBool();
636+
kwin.connection().connect("org.kde.KWin", "/KWin", "org.kde.KWin",
637+
"showingDesktopChanged", this, SLOT(onShowingDesktopChanged(bool)));
638+
}
640639
}
641640

642641
void X11DockHelper::onShowingDesktopChanged(bool showing)

0 commit comments

Comments
 (0)