Adjust to kdecoration api changes

This commit is contained in:
Vlad Zahorodnii 2023-03-30 14:52:58 +03:00
parent d76527e7e6
commit 222b23eaa3
4 changed files with 5 additions and 31 deletions

View file

@ -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)

View file

@ -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;

View file

@ -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()

View file

@ -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;