From 222b23eaa3c52aad6bd57c8c193bc131a2e599d2 Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Thu, 30 Mar 2023 14:52:58 +0300 Subject: [PATCH] Adjust to kdecoration api changes --- src/decorations/decoratedclient.cpp | 1 - src/decorations/decoratedclient.h | 1 - .../declarative-plugin/previewclient.cpp | 28 +++---------------- .../declarative-plugin/previewclient.h | 6 +--- 4 files changed, 5 insertions(+), 31 deletions(-) diff --git a/src/decorations/decoratedclient.cpp b/src/decorations/decoratedclient.cpp index 6eee1b02eb..58486a84b8 100644 --- a/src/decorations/decoratedclient.cpp +++ b/src/decorations/decoratedclient.cpp @@ -115,7 +115,6 @@ DELEGATE(bool, isMoveable, isMovable) DELEGATE(bool, isResizeable, isResizable) DELEGATE2(bool, isShadeable) DELEGATE2(bool, providesContextHelp) -DELEGATE2(int, desktop) DELEGATE2(bool, isOnAllDesktops) DELEGATE2(QPalette, palette) DELEGATE2(QIcon, icon) diff --git a/src/decorations/decoratedclient.h b/src/decorations/decoratedclient.h index 9bd5907a46..cfa3f37aba 100644 --- a/src/decorations/decoratedclient.h +++ b/src/decorations/decoratedclient.h @@ -31,7 +31,6 @@ public: ~DecoratedClientImpl() override; QString caption() const override; WId decorationId() const override; - int desktop() const override; int height() const override; QIcon icon() const override; bool isActive() const override; diff --git a/src/kcms/decoration/declarative-plugin/previewclient.cpp b/src/kcms/decoration/declarative-plugin/previewclient.cpp index 53db4e3301..f0f0a9a26c 100644 --- a/src/kcms/decoration/declarative-plugin/previewclient.cpp +++ b/src/kcms/decoration/declarative-plugin/previewclient.cpp @@ -37,7 +37,7 @@ PreviewClient::PreviewClient(DecoratedClient *c, Decoration *decoration) , m_shadeable(true) , m_shaded(false) , m_providesContextHelp(false) - , m_desktop(1) + , m_onAllDesktops(false) , m_width(0) , m_height(0) , m_bordersTopEdge(false) @@ -61,7 +61,6 @@ PreviewClient::PreviewClient(DecoratedClient *c, Decoration *decoration) connect(this, &PreviewClient::shadeableChanged, c, &DecoratedClient::shadeableChanged); connect(this, &PreviewClient::shadedChanged, c, &DecoratedClient::shadedChanged); connect(this, &PreviewClient::providesContextHelpChanged, c, &DecoratedClient::providesContextHelpChanged); - connect(this, &PreviewClient::onAllDesktopsChanged, c, &DecoratedClient::onAllDesktopsChanged); connect(this, &PreviewClient::widthChanged, c, &DecoratedClient::widthChanged); connect(this, &PreviewClient::heightChanged, c, &DecoratedClient::heightChanged); connect(this, &PreviewClient::iconChanged, c, &DecoratedClient::iconChanged); @@ -76,9 +75,6 @@ PreviewClient::PreviewClient(DecoratedClient *c, Decoration *decoration) m_icon = QIcon::fromTheme(m_iconName); Q_EMIT iconChanged(m_icon); }); - connect(this, &PreviewClient::desktopChanged, this, [this]() { - Q_EMIT onAllDesktopsChanged(isOnAllDesktops()); - }); connect(&m_palette, &KWin::Decoration::DecorationPalette::changed, this, [this]() { Q_EMIT paletteChanged(m_palette.palette()); }); @@ -131,23 +127,6 @@ WId PreviewClient::decorationId() const return 0; } -int PreviewClient::desktop() const -{ - return m_desktop; -} - -void PreviewClient::setDesktop(int desktop) -{ - if (desktop == 0) { - desktop = 1; - } - if (m_desktop == desktop) { - return; - } - m_desktop = desktop; - Q_EMIT desktopChanged(m_desktop); -} - QIcon PreviewClient::icon() const { return m_icon; @@ -215,7 +194,7 @@ bool PreviewClient::isMoveable() const bool PreviewClient::isOnAllDesktops() const { - return desktop() == -1; + return m_onAllDesktops; } bool PreviewClient::isResizeable() const @@ -402,7 +381,8 @@ void PreviewClient::showApplicationMenu(int actionId) void PreviewClient::requestToggleOnAllDesktops() { - setDesktop(isOnAllDesktops() ? 1 : -1); + m_onAllDesktops = !m_onAllDesktops; + Q_EMIT onAllDesktopsChanged(m_onAllDesktops); } void PreviewClient::requestToggleShade() diff --git a/src/kcms/decoration/declarative-plugin/previewclient.h b/src/kcms/decoration/declarative-plugin/previewclient.h index 998dee3b9b..d5c38dfe2d 100644 --- a/src/kcms/decoration/declarative-plugin/previewclient.h +++ b/src/kcms/decoration/declarative-plugin/previewclient.h @@ -35,7 +35,6 @@ class PreviewClient : public QObject, public ApplicationMenuEnabledDecoratedClie Q_PROPERTY(bool minimizable READ isMinimizeable WRITE setMinimizable NOTIFY minimizableChanged) Q_PROPERTY(bool modal READ isModal WRITE setModal NOTIFY modalChanged) Q_PROPERTY(bool movable READ isMoveable WRITE setMovable NOTIFY movableChanged) - Q_PROPERTY(int desktop READ desktop WRITE setDesktop NOTIFY desktopChanged) Q_PROPERTY(bool onAllDesktops READ isOnAllDesktops NOTIFY onAllDesktopsChanged) Q_PROPERTY(bool resizable READ isResizeable WRITE setResizable NOTIFY resizableChanged) Q_PROPERTY(bool shadeable READ isShadeable WRITE setShadeable NOTIFY shadeableChanged) @@ -54,7 +53,6 @@ public: QString caption() const override; WId decorationId() const override; WId windowId() const override; - int desktop() const override; QIcon icon() const override; bool isActive() const override; bool isCloseable() const override; @@ -114,7 +112,6 @@ public: void setShadeable(bool shadeable); void setShaded(bool shaded); void setProvidesContextHelp(bool contextHelp); - void setDesktop(int desktop); void setWidth(int width); void setHeight(int height); @@ -153,7 +150,6 @@ Q_SIGNALS: void shadeableChanged(bool); void shadedChanged(bool); void providesContextHelpChanged(bool); - void desktopChanged(int); void widthChanged(int); void heightChanged(int); void paletteChanged(const QPalette &); @@ -186,7 +182,7 @@ private: bool m_shadeable; bool m_shaded; bool m_providesContextHelp; - int m_desktop; + bool m_onAllDesktops; int m_width; int m_height; bool m_bordersTopEdge;