Adjust to KDecoration API changes
This commit is contained in:
parent
c2b4526791
commit
18a9b3b25a
10 changed files with 24 additions and 29 deletions
|
@ -114,7 +114,7 @@ void TestMaximized::testMaximizedPassedToDeco()
|
||||||
|
|
||||||
// now maximize
|
// now maximize
|
||||||
QSignalSpy bordersChangedSpy(decoration, &KDecoration2::Decoration::bordersChanged);
|
QSignalSpy bordersChangedSpy(decoration, &KDecoration2::Decoration::bordersChanged);
|
||||||
QSignalSpy maximizedChangedSpy(decoration->client().toStrongRef().get(), &KDecoration2::DecoratedClient::maximizedChanged);
|
QSignalSpy maximizedChangedSpy(decoration->client(), &KDecoration2::DecoratedClient::maximizedChanged);
|
||||||
QSignalSpy frameGeometryChangedSpy(window, &Window::frameGeometryChanged);
|
QSignalSpy frameGeometryChangedSpy(window, &Window::frameGeometryChanged);
|
||||||
|
|
||||||
workspace()->slotWindowMaximize();
|
workspace()->slotWindowMaximize();
|
||||||
|
|
|
@ -31,7 +31,7 @@ DecoratedClientImpl::DecoratedClientImpl(Window *window, KDecoration2::Decorated
|
||||||
, m_window(window)
|
, m_window(window)
|
||||||
, m_clientSize(window->clientSize().toSize())
|
, m_clientSize(window->clientSize().toSize())
|
||||||
{
|
{
|
||||||
window->setDecoratedClient(QPointer<DecoratedClientImpl>(this));
|
window->setDecoratedClient(this);
|
||||||
connect(window, &Window::activeChanged, this, [decoratedClient, window]() {
|
connect(window, &Window::activeChanged, this, [decoratedClient, window]() {
|
||||||
Q_EMIT decoratedClient->activeChanged(window->isActive());
|
Q_EMIT decoratedClient->activeChanged(window->isActive());
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include <KDecoration2/Private/DecorationSettingsPrivate>
|
#include <KDecoration2/Private/DecorationSettingsPrivate>
|
||||||
#include <QAbstractListModel>
|
#include <QAbstractListModel>
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
namespace KDecoration2
|
namespace KDecoration2
|
||||||
{
|
{
|
||||||
|
|
|
@ -348,14 +348,14 @@ void Decoration::init()
|
||||||
connect(m_extendedBorders, &KWin::Borders::bottomChanged, this, &Decoration::updateExtendedBorders);
|
connect(m_extendedBorders, &KWin::Borders::bottomChanged, this, &Decoration::updateExtendedBorders);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto decorationClient = clientPointer();
|
auto decorationClient = client();
|
||||||
connect(decorationClient, &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::updateBorders);
|
connect(decorationClient, &KDecoration2::DecoratedClient::maximizedChanged, this, &Decoration::updateBorders);
|
||||||
connect(decorationClient, &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::updateBorders);
|
connect(decorationClient, &KDecoration2::DecoratedClient::shadedChanged, this, &Decoration::updateBorders);
|
||||||
updateBorders();
|
updateBorders();
|
||||||
if (m_view) {
|
if (m_view) {
|
||||||
auto resizeWindow = [this] {
|
auto resizeWindow = [this] {
|
||||||
QRect rect(QPoint(0, 0), size());
|
QRect rect(QPoint(0, 0), size());
|
||||||
if (m_padding && !clientPointer()->isMaximized()) {
|
if (m_padding && !client()->isMaximized()) {
|
||||||
rect = rect.adjusted(-m_padding->left(), -m_padding->top(), m_padding->right(), m_padding->bottom());
|
rect = rect.adjusted(-m_padding->left(), -m_padding->top(), m_padding->right(), m_padding->bottom());
|
||||||
}
|
}
|
||||||
m_view->setGeometry(rect);
|
m_view->setGeometry(rect);
|
||||||
|
@ -396,7 +396,7 @@ void Decoration::setupBorders(QQuickItem *item)
|
||||||
void Decoration::updateBorders()
|
void Decoration::updateBorders()
|
||||||
{
|
{
|
||||||
KWin::Borders *b = m_borders;
|
KWin::Borders *b = m_borders;
|
||||||
if (clientPointer()->isMaximized() && m_maximizedBorders) {
|
if (client()->isMaximized() && m_maximizedBorders) {
|
||||||
b = m_maximizedBorders;
|
b = m_maximizedBorders;
|
||||||
}
|
}
|
||||||
if (!b) {
|
if (!b) {
|
||||||
|
@ -429,7 +429,7 @@ void Decoration::updateShadow()
|
||||||
}
|
}
|
||||||
bool updateShadow = false;
|
bool updateShadow = false;
|
||||||
const auto oldShadow = shadow();
|
const auto oldShadow = shadow();
|
||||||
if (m_padding && (m_padding->left() > 0 || m_padding->top() > 0 || m_padding->right() > 0 || m_padding->bottom() > 0) && !clientPointer()->isMaximized()) {
|
if (m_padding && (m_padding->left() > 0 || m_padding->top() > 0 || m_padding->right() > 0 || m_padding->bottom() > 0) && !client()->isMaximized()) {
|
||||||
if (oldShadow.isNull()) {
|
if (oldShadow.isNull()) {
|
||||||
updateShadow = true;
|
updateShadow = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -555,15 +555,15 @@ void Decoration::updateExtendedBorders()
|
||||||
int extBottom = m_extendedBorders->bottom();
|
int extBottom = m_extendedBorders->bottom();
|
||||||
|
|
||||||
if (settings()->borderSize() == KDecoration2::BorderSize::None) {
|
if (settings()->borderSize() == KDecoration2::BorderSize::None) {
|
||||||
if (!clientPointer()->isMaximizedHorizontally()) {
|
if (!client()->isMaximizedHorizontally()) {
|
||||||
extLeft = std::max(m_extendedBorders->left(), extSize);
|
extLeft = std::max(m_extendedBorders->left(), extSize);
|
||||||
extRight = std::max(m_extendedBorders->right(), extSize);
|
extRight = std::max(m_extendedBorders->right(), extSize);
|
||||||
}
|
}
|
||||||
if (!clientPointer()->isMaximizedVertically()) {
|
if (!client()->isMaximizedVertically()) {
|
||||||
extBottom = std::max(m_extendedBorders->bottom(), extSize);
|
extBottom = std::max(m_extendedBorders->bottom(), extSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (settings()->borderSize() == KDecoration2::BorderSize::NoSides && !clientPointer()->isMaximizedHorizontally()) {
|
} else if (settings()->borderSize() == KDecoration2::BorderSize::NoSides && !client()->isMaximizedHorizontally()) {
|
||||||
extLeft = std::max(m_extendedBorders->left(), extSize);
|
extLeft = std::max(m_extendedBorders->left(), extSize);
|
||||||
extRight = std::max(m_extendedBorders->right(), extSize);
|
extRight = std::max(m_extendedBorders->right(), extSize);
|
||||||
}
|
}
|
||||||
|
@ -579,7 +579,7 @@ void Decoration::updateBlur()
|
||||||
|
|
||||||
QRegion mask;
|
QRegion mask;
|
||||||
|
|
||||||
if (clientPointer() && clientPointer()->isMaximized()) {
|
if (client() && client()->isMaximized()) {
|
||||||
mask = QRect(0, 0, m_item->width(), m_item->height());
|
mask = QRect(0, 0, m_item->width(), m_item->height());
|
||||||
} else {
|
} else {
|
||||||
const QVariant maskProperty = m_item->property("decorationMask");
|
const QVariant maskProperty = m_item->property("decorationMask");
|
||||||
|
@ -606,7 +606,7 @@ void Decoration::updateBuffer()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_contentRect = QRect(QPoint(0, 0), m_view->contentItem()->size().toSize());
|
m_contentRect = QRect(QPoint(0, 0), m_view->contentItem()->size().toSize());
|
||||||
if (m_padding && (m_padding->left() > 0 || m_padding->top() > 0 || m_padding->right() > 0 || m_padding->bottom() > 0) && !clientPointer()->isMaximized()) {
|
if (m_padding && (m_padding->left() > 0 || m_padding->top() > 0 || m_padding->right() > 0 || m_padding->bottom() > 0) && !client()->isMaximized()) {
|
||||||
m_contentRect = m_contentRect.adjusted(m_padding->left(), m_padding->top(), -m_padding->right(), -m_padding->bottom());
|
m_contentRect = m_contentRect.adjusted(m_padding->left(), m_padding->top(), -m_padding->right(), -m_padding->bottom());
|
||||||
}
|
}
|
||||||
updateShadow();
|
updateShadow();
|
||||||
|
@ -614,11 +614,6 @@ void Decoration::updateBuffer()
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
KDecoration2::DecoratedClient *Decoration::clientPointer() const
|
|
||||||
{
|
|
||||||
return client().toStrongRef().data();
|
|
||||||
}
|
|
||||||
|
|
||||||
QQuickItem *Decoration::item() const
|
QQuickItem *Decoration::item() const
|
||||||
{
|
{
|
||||||
return m_item.get();
|
return m_item.get();
|
||||||
|
|
|
@ -32,7 +32,7 @@ namespace Aurorae
|
||||||
class Decoration : public KDecoration2::Decoration
|
class Decoration : public KDecoration2::Decoration
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(KDecoration2::DecoratedClient *client READ clientPointer CONSTANT)
|
Q_PROPERTY(KDecoration2::DecoratedClient *client READ client CONSTANT)
|
||||||
Q_PROPERTY(QQuickItem *item READ item)
|
Q_PROPERTY(QQuickItem *item READ item)
|
||||||
public:
|
public:
|
||||||
explicit Decoration(QObject *parent = nullptr, const QVariantList &args = QVariantList());
|
explicit Decoration(QObject *parent = nullptr, const QVariantList &args = QVariantList());
|
||||||
|
@ -42,7 +42,6 @@ public:
|
||||||
|
|
||||||
Q_INVOKABLE QVariant readConfig(const QString &key, const QVariant &defaultValue = QVariant());
|
Q_INVOKABLE QVariant readConfig(const QString &key, const QVariant &defaultValue = QVariant());
|
||||||
|
|
||||||
KDecoration2::DecoratedClient *clientPointer() const;
|
|
||||||
QQuickItem *item() const;
|
QQuickItem *item() const;
|
||||||
|
|
||||||
public Q_SLOTS:
|
public Q_SLOTS:
|
||||||
|
|
|
@ -155,7 +155,7 @@ void DecorationOptions::setDecoration(KDecoration2::Decoration *decoration)
|
||||||
}
|
}
|
||||||
if (m_decoration) {
|
if (m_decoration) {
|
||||||
// disconnect from existing decoration
|
// disconnect from existing decoration
|
||||||
disconnect(m_decoration->client().toStrongRef().data(), &KDecoration2::DecoratedClient::activeChanged, this, &DecorationOptions::slotActiveChanged);
|
disconnect(m_decoration->client(), &KDecoration2::DecoratedClient::activeChanged, this, &DecorationOptions::slotActiveChanged);
|
||||||
auto s = m_decoration->settings();
|
auto s = m_decoration->settings();
|
||||||
disconnect(s.data(), &KDecoration2::DecorationSettings::fontChanged, this, &DecorationOptions::fontChanged);
|
disconnect(s.data(), &KDecoration2::DecorationSettings::fontChanged, this, &DecorationOptions::fontChanged);
|
||||||
disconnect(s.data(), &KDecoration2::DecorationSettings::decorationButtonsLeftChanged, this, &DecorationOptions::titleButtonsChanged);
|
disconnect(s.data(), &KDecoration2::DecorationSettings::decorationButtonsLeftChanged, this, &DecorationOptions::titleButtonsChanged);
|
||||||
|
@ -163,8 +163,8 @@ void DecorationOptions::setDecoration(KDecoration2::Decoration *decoration)
|
||||||
disconnect(m_paletteConnection);
|
disconnect(m_paletteConnection);
|
||||||
}
|
}
|
||||||
m_decoration = decoration;
|
m_decoration = decoration;
|
||||||
connect(m_decoration->client().toStrongRef().data(), &KDecoration2::DecoratedClient::activeChanged, this, &DecorationOptions::slotActiveChanged);
|
connect(m_decoration->client(), &KDecoration2::DecoratedClient::activeChanged, this, &DecorationOptions::slotActiveChanged);
|
||||||
m_paletteConnection = connect(m_decoration->client().toStrongRef().data(), &KDecoration2::DecoratedClient::paletteChanged, this, [this](const QPalette &pal) {
|
m_paletteConnection = connect(m_decoration->client(), &KDecoration2::DecoratedClient::paletteChanged, this, [this](const QPalette &pal) {
|
||||||
m_colors.update(pal);
|
m_colors.update(pal);
|
||||||
Q_EMIT colorsChanged();
|
Q_EMIT colorsChanged();
|
||||||
});
|
});
|
||||||
|
@ -180,10 +180,10 @@ void DecorationOptions::slotActiveChanged()
|
||||||
if (!m_decoration) {
|
if (!m_decoration) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (m_active == m_decoration->client().toStrongRef().data()->isActive()) {
|
if (m_active == m_decoration->client()->isActive()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
m_active = m_decoration->client().toStrongRef().data()->isActive();
|
m_active = m_decoration->client()->isActive();
|
||||||
Q_EMIT colorsChanged();
|
Q_EMIT colorsChanged();
|
||||||
Q_EMIT fontChanged();
|
Q_EMIT fontChanged();
|
||||||
}
|
}
|
||||||
|
|
|
@ -3099,12 +3099,12 @@ void Window::showContextHelp()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
QPointer<Decoration::DecoratedClientImpl> Window::decoratedClient() const
|
Decoration::DecoratedClientImpl *Window::decoratedClient() const
|
||||||
{
|
{
|
||||||
return m_decoration.client;
|
return m_decoration.client;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::setDecoratedClient(QPointer<Decoration::DecoratedClientImpl> client)
|
void Window::setDecoratedClient(Decoration::DecoratedClientImpl *client)
|
||||||
{
|
{
|
||||||
m_decoration.client = client;
|
m_decoration.client = client;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1231,8 +1231,8 @@ public:
|
||||||
{
|
{
|
||||||
return m_decoration.decoration != nullptr;
|
return m_decoration.decoration != nullptr;
|
||||||
}
|
}
|
||||||
QPointer<Decoration::DecoratedClientImpl> decoratedClient() const;
|
Decoration::DecoratedClientImpl *decoratedClient() const;
|
||||||
void setDecoratedClient(QPointer<Decoration::DecoratedClientImpl> client);
|
void setDecoratedClient(Decoration::DecoratedClientImpl *client);
|
||||||
bool decorationHasAlpha() const;
|
bool decorationHasAlpha() const;
|
||||||
void triggerDecorationRepaint();
|
void triggerDecorationRepaint();
|
||||||
virtual void layoutDecorationRects(QRectF &left, QRectF &top, QRectF &right, QRectF &bottom) const;
|
virtual void layoutDecorationRects(QRectF &left, QRectF &top, QRectF &right, QRectF &bottom) const;
|
||||||
|
|
|
@ -4379,7 +4379,7 @@ void X11Window::maximize(MaximizeMode mode)
|
||||||
// call into decoration update borders
|
// call into decoration update borders
|
||||||
if (isDecorated() && decoration()->client() && !(options->borderlessMaximizedWindows() && max_mode == KWin::MaximizeFull)) {
|
if (isDecorated() && decoration()->client() && !(options->borderlessMaximizedWindows() && max_mode == KWin::MaximizeFull)) {
|
||||||
changeMaximizeRecursion = true;
|
changeMaximizeRecursion = true;
|
||||||
const auto c = decoration()->client().toStrongRef();
|
const auto c = decoration()->client();
|
||||||
if ((max_mode & MaximizeVertical) != (old_mode & MaximizeVertical)) {
|
if ((max_mode & MaximizeVertical) != (old_mode & MaximizeVertical)) {
|
||||||
Q_EMIT c->maximizedVerticallyChanged(max_mode & MaximizeVertical);
|
Q_EMIT c->maximizedVerticallyChanged(max_mode & MaximizeVertical);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1618,7 +1618,7 @@ void XdgToplevelWindow::maximize(MaximizeMode mode)
|
||||||
// call into decoration update borders
|
// call into decoration update borders
|
||||||
if (m_nextDecoration && !(options->borderlessMaximizedWindows() && m_requestedMaximizeMode == KWin::MaximizeFull)) {
|
if (m_nextDecoration && !(options->borderlessMaximizedWindows() && m_requestedMaximizeMode == KWin::MaximizeFull)) {
|
||||||
changeMaximizeRecursion = true;
|
changeMaximizeRecursion = true;
|
||||||
const auto c = m_nextDecoration->client().toStrongRef();
|
const auto c = m_nextDecoration->client();
|
||||||
if ((m_requestedMaximizeMode & MaximizeVertical) != (oldMode & MaximizeVertical)) {
|
if ((m_requestedMaximizeMode & MaximizeVertical) != (oldMode & MaximizeVertical)) {
|
||||||
Q_EMIT c->maximizedVerticallyChanged(m_requestedMaximizeMode & MaximizeVertical);
|
Q_EMIT c->maximizedVerticallyChanged(m_requestedMaximizeMode & MaximizeVertical);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue