diff --git a/liblattedock/windowsystem.cpp b/liblattedock/windowsystem.cpp index 445ccf77f..0d3fd0dec 100644 --- a/liblattedock/windowsystem.cpp +++ b/liblattedock/windowsystem.cpp @@ -8,32 +8,35 @@ WindowSystem::WindowSystem(QObject *parent) : QObject(parent) { if (KWindowSystem::isPlatformWayland()) { - //! TODO: Wayland compositing + } else { compositingChangedProxy(KWindowSystem::self()->compositingActive()); - connect(KWindowSystem::self(), SIGNAL(compositingChanged(bool)) - , this, SLOT(compositingChangedProxy(bool))); + connect(KWindowSystem::self(), SIGNAL(compositingChanged(bool)), this, SLOT(compositingChanged(bool))); } } -WindowSystem &WindowSystem::self() +WindowSystem::~WindowSystem() { - static WindowSystem wm; - return wm; } -WindowSystem::~WindowSystem() +WindowSystem &WindowSystem::self() { + static WindowSystem ws; + + return ws; } bool WindowSystem::compositingActive() const { - return m_enabled; + return m_compositing; } -void WindowSystem::compositingChangedProxy(bool enabled) +void WindowSystem::compositingChangedProxy(bool enable) { - m_enabled = enabled; + if (m_compositing == enable) + return; + + m_compositing = enable; emit compositingChanged(); } diff --git a/liblattedock/windowsystem.h b/liblattedock/windowsystem.h index 4bbba75f2..95f361f82 100644 --- a/liblattedock/windowsystem.h +++ b/liblattedock/windowsystem.h @@ -11,21 +11,21 @@ class WindowSystem : public QObject { Q_PROPERTY(bool compositingActive READ compositingActive NOTIFY compositingChanged) public: - explicit WindowSystem(QObject *parent = nullptr); - - static WindowSystem &self(); + explicit WindowSystem(QObject *parent = Q_NULLPTR); ~WindowSystem(); + static WindowSystem &self(); + bool compositingActive() const; signals: void compositingChanged(); private slots: - void compositingChangedProxy(bool enabled); + void compositingChangedProxy(bool state); private: - bool m_enabled{false}; + bool m_compositing{false}; }; }//LatteDock namespace