Commit 13e6459a authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Add a convenience property to retrieve the size of the decorated client

Summary:
It can be useful if we want to know both width and height or react to
any changes in the size of the decorated client.

Reviewers: #kwin, davidedmundson

Reviewed By: #kwin, davidedmundson

Subscribers: davidedmundson, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D26937
parent fbca9b33
......@@ -242,6 +242,11 @@ void MockClient::requestHideToolTip()
}
QSize MockClient::size() const
{
return QSize(m_width, m_height);
}
int MockClient::width() const
{
return m_width;
......
......@@ -67,6 +67,7 @@ public:
void requestToggleShade() override;
void requestShowToolTip(const QString &text) override;
void requestHideToolTip() override;
QSize size() const override;
int width() const override;
WId windowId() const override;
......
......@@ -64,6 +64,7 @@ DELEGATE(WId, windowId)
DELEGATE(WId, decorationId)
DELEGATE(int, width)
DELEGATE(int, height)
DELEGATE(QSize, size)
DELEGATE(QPalette, palette)
DELEGATE(Qt::Edges, adjacentScreenEdges)
......
......@@ -157,6 +157,10 @@ class KDECORATIONS2_EXPORT DecoratedClient : public QObject
* The height of the DecoratedClient.
**/
Q_PROPERTY(int height READ height NOTIFY heightChanged)
/**
* The size of the DecoratedClient.
**/
Q_PROPERTY(QSize size READ size NOTIFY sizeChanged)
/**
* The palette this DecoratedClient uses. The palette might be different for each
* DecoratedClient and the Decoration should honor the palette.
......@@ -212,6 +216,7 @@ public:
int width() const;
int height() const;
QSize size() const;
QPointer<Decoration> decoration() const;
QPalette palette() const;
......@@ -273,6 +278,7 @@ Q_SIGNALS:
void widthChanged(int);
void heightChanged(int);
void sizeChanged(const QSize &size);
void paletteChanged(const QPalette &palette);
void adjacentScreenEdgesChanged(Qt::Edges edges);
......
......@@ -25,7 +25,7 @@ target_link_libraries(kdecorations2private
target_include_directories(kdecorations2private INTERFACE "$<INSTALL_INTERFACE:${KDECORATION2_INCLUDEDIR}>" )
set_target_properties(kdecorations2private PROPERTIES VERSION ${KDECORATION2_VERSION_STRING}
SOVERSION 6
SOVERSION 7
EXPORT_NAME KDecoration2Private
)
......
......@@ -73,6 +73,7 @@ public:
virtual int width() const = 0;
virtual int height() const = 0;
virtual QSize size() const = 0;
virtual QPalette palette() const = 0;
virtual Qt::Edges adjacentScreenEdges() const = 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment