[decoration] Implement the size property

Summary: See D26937

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D26939
This commit is contained in:
Vlad Zahorodnii 2020-01-27 15:16:02 +02:00
parent 1b31bb23d6
commit 827578577f
4 changed files with 18 additions and 0 deletions

View file

@ -67,6 +67,7 @@ DecoratedClientImpl::DecoratedClientImpl(AbstractClient *client, KDecoration2::D
if (oldSize.height() != m_clientSize.height()) { if (oldSize.height() != m_clientSize.height()) {
emit decoratedClient->heightChanged(m_clientSize.height()); emit decoratedClient->heightChanged(m_clientSize.height());
} }
emit decoratedClient->sizeChanged(m_clientSize);
} }
); );
connect(client, &AbstractClient::desktopChanged, this, connect(client, &AbstractClient::desktopChanged, this,
@ -273,6 +274,11 @@ int DecoratedClientImpl::height() const
return m_clientSize.height(); return m_clientSize.height();
} }
QSize DecoratedClientImpl::size() const
{
return m_clientSize;
}
bool DecoratedClientImpl::isMaximizedVertically() const bool DecoratedClientImpl::isMaximizedVertically() const
{ {
return m_client->requestedMaximizeMode() & MaximizeVertical; return m_client->requestedMaximizeMode() & MaximizeVertical;

View file

@ -66,6 +66,7 @@ public:
QPalette palette() const override; QPalette palette() const override;
QColor color(KDecoration2::ColorGroup group, KDecoration2::ColorRole role) const override; QColor color(KDecoration2::ColorGroup group, KDecoration2::ColorRole role) const override;
bool providesContextHelp() const override; bool providesContextHelp() const override;
QSize size() const override;
int width() const override; int width() const override;
WId windowId() const override; WId windowId() const override;

View file

@ -111,6 +111,11 @@ PreviewClient::PreviewClient(DecoratedClient *c, Decoration *decoration)
connect(this, &PreviewClient::bordersLeftEdgeChanged, this, emitEdgesChanged); connect(this, &PreviewClient::bordersLeftEdgeChanged, this, emitEdgesChanged);
connect(this, &PreviewClient::bordersRightEdgeChanged, this, emitEdgesChanged); connect(this, &PreviewClient::bordersRightEdgeChanged, this, emitEdgesChanged);
connect(this, &PreviewClient::bordersBottomEdgeChanged, this, emitEdgesChanged); connect(this, &PreviewClient::bordersBottomEdgeChanged, this, emitEdgesChanged);
auto emitSizeChanged = [this, c]() {
emit c->sizeChanged(c->size());
};
connect(this, &PreviewClient::widthChanged, this, emitSizeChanged);
connect(this, &PreviewClient::heightChanged, this, emitSizeChanged);
qApp->installEventFilter(this); qApp->installEventFilter(this);
} }
@ -133,6 +138,11 @@ int PreviewClient::height() const
return m_height; return m_height;
} }
QSize PreviewClient::size() const
{
return QSize(m_width, m_height);
}
QString PreviewClient::caption() const QString PreviewClient::caption() const
{ {
return m_caption; return m_caption;

View file

@ -90,6 +90,7 @@ public:
int width() const override; int width() const override;
int height() const override; int height() const override;
QSize size() const override;
QPalette palette() const override; QPalette palette() const override;
QColor color(ColorGroup group, ColorRole role) const override; QColor color(ColorGroup group, ColorRole role) const override;
Qt::Edges adjacentScreenEdges() const override; Qt::Edges adjacentScreenEdges() const override;