Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions panels/dock/waylanddockhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,23 @@
#include "wayland-treeland-region-watch-unstable-v1-client-protocol.h"

#include <QtWaylandClient/private/qwaylandscreen_p.h>
#include <QtWaylandClient/private/qwaylandsurface_p.h>

Check warning on line 17 in panels/dock/waylanddockhelper.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QtWaylandClient/private/qwaylandsurface_p.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QtWaylandClient/private/qwaylandwindow_p.h>

Check warning on line 18 in panels/dock/waylanddockhelper.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QtWaylandClient/private/qwaylandwindow_p.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include <QDBusConnection>

Check warning on line 20 in panels/dock/waylanddockhelper.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusConnection> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QDBusInterface>

Check warning on line 21 in panels/dock/waylanddockhelper.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QDBusInterface> not found. Please note: Cppcheck does not need standard library headers to get proper results.

namespace dock {
WaylandDockHelper::WaylandDockHelper(DockPanel *panel)
: DockHelper(panel)
, m_isWindowOverlap(false)
, m_isCurrentActiveWindowFullscreened(false)
, m_showingDesktop(false)
, m_panel(panel)
{
m_xwindowControl.reset(new TreeLandXWindowControl());
m_regionWatchManager.reset(new TreeLandRegionWatchManager());
setupKWinDBusConnection();
DS_NAMESPACE::DAppletBridge bridge("org.deepin.ds.dock.taskmanager");
if (auto applet = bridge.applet()) {
connect(applet, SIGNAL(windowFullscreenChanged(bool)), this, SLOT(setCurrentActiveWindowFullscreened(bool)));
Expand Down Expand Up @@ -123,6 +128,9 @@

bool WaylandDockHelper::isWindowOverlap()
{
if (m_showingDesktop) {
return false;
}
return m_isWindowOverlap;
}

Expand Down Expand Up @@ -204,6 +212,25 @@
return true;
}

void WaylandDockHelper::setupKWinDBusConnection()
{
QDBusInterface kwin("org.kde.KWin", "/KWin", "org.kde.KWin", QDBusConnection::sessionBus());
if (kwin.isValid()) {
m_showingDesktop = kwin.property("showingDesktop").toBool();
kwin.connection().connect("org.kde.KWin", "/KWin", "org.kde.KWin",
Comment on lines +219 to +220

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Medium · Show-desktop state stays stale

When KWin changes show-desktop state between the property read and signal subscription, setupKWinDBusConnection() misses the transition, so m_showingDesktop stays stale until another transition and overlap checks or popup handling use the wrong state.

Subscribe to showingDesktopChanged before reading the property, so transitions during setup are not missed.

Also at panels/dock/waylanddockhelper.cpp:221.

Prompt for AI agents
In `panels/dock/waylanddockhelper.cpp` at lines 219-220:

**Show-desktop state stays stale**

When KWin changes show-desktop state between the property read and signal subscription, `setupKWinDBusConnection()` misses the transition, so `m_showingDesktop` stays stale until another transition and overlap checks or popup handling use the wrong state.

Subscribe to `showingDesktopChanged` before reading the property, so transitions during setup are not missed.

Also at `panels/dock/waylanddockhelper.cpp:221`.

"showingDesktopChanged", this, SLOT(onShowingDesktopChanged(bool)));
}
}

void WaylandDockHelper::onShowingDesktopChanged(bool showing)
{
m_showingDesktop = showing;
if (showing) {
m_panel->requestClosePopup();
}
Q_EMIT isWindowOverlapChanged(isWindowOverlap());
}

WallpaperColorManager::WallpaperColorManager(WaylandDockHelper *helper)
: QWaylandClientExtensionTemplate<WallpaperColorManager>(treeland_wallpaper_color_manager_v1_interface.version)
, m_helper(helper)
Expand Down
3 changes: 3 additions & 0 deletions panels/dock/waylanddockhelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,18 @@ class WaylandDockHelper : public DockHelper

protected Q_SLOTS:
void setCurrentActiveWindowFullscreened(bool);
void onShowingDesktopChanged(bool showing);

private:
void updateRegionWatchPos();
void initWallpaperColorManager();
void setupKWinDBusConnection();

private:
friend class TreeLandRegionWatch;
bool m_isWindowOverlap;
bool m_isCurrentActiveWindowFullscreened;
bool m_showingDesktop;
DockPanel *m_panel;
QScopedPointer<WallpaperColorManager> m_wallpaperColorManager;
QScopedPointer<TreeLandRegionWatch> m_regionWatch;
Expand Down
Loading