diff --git a/decorations/decoratedclient.cpp b/decorations/decoratedclient.cpp index 083c23ecf8..f8c2426604 100644 --- a/decorations/decoratedclient.cpp +++ b/decorations/decoratedclient.cpp @@ -99,14 +99,6 @@ DecoratedClientImpl::DecoratedClientImpl(AbstractClient *client, KDecoration2::D connect(client, &AbstractClient::minimizeableChanged, decoratedClient, &KDecoration2::DecoratedClient::minimizeableChanged); connect(client, &AbstractClient::maximizeableChanged, decoratedClient, &KDecoration2::DecoratedClient::maximizeableChanged); - auto signalMaximizeChanged = static_cast(&AbstractClient::clientMaximizedStateChanged); - connect(client, signalMaximizeChanged, decoratedClient, - [this, decoratedClient] (AbstractClient *client, MaximizeMode mode) { - Q_UNUSED(client) - emit decoratedClient->maximizedChanged(mode == MaximizeMode::MaximizeFull); - } - ); - connect(client, &AbstractClient::paletteChanged, decoratedClient, &KDecoration2::DecoratedClient::paletteChanged); } diff --git a/shell_client.cpp b/shell_client.cpp index a627400c4d..25ec5b8bee 100644 --- a/shell_client.cpp +++ b/shell_client.cpp @@ -554,8 +554,13 @@ void ShellClient::hideClient(bool hide) Q_UNUSED(hide) } +static bool changeMaximizeRecursion = false; void ShellClient::changeMaximize(bool horizontal, bool vertical, bool adjust) { + if (changeMaximizeRecursion) { + return; + } + MaximizeMode oldMode = m_maximizeMode; StackingUpdatesBlocker blocker(workspace()); // 'adjust == true' means to update the size only, e.g. after changing workspace size if (!adjust) { @@ -578,6 +583,22 @@ void ShellClient::changeMaximize(bool horizontal, bool vertical, bool adjust) } } // TODO: add more checks as in Client + + // call into decoration update borders + if (isDecorated() && decoration()->client() && !(options->borderlessMaximizedWindows() && m_maximizeMode == KWin::MaximizeFull)) { + changeMaximizeRecursion = true; + const auto c = decoration()->client().data(); + if ((m_maximizeMode & MaximizeVertical) != (oldMode & MaximizeVertical)) { + emit c->maximizedVerticallyChanged(m_maximizeMode & MaximizeVertical); + } + if ((m_maximizeMode & MaximizeHorizontal) != (oldMode & MaximizeHorizontal)) { + emit c->maximizedHorizontallyChanged(m_maximizeMode & MaximizeHorizontal); + } + if ((m_maximizeMode == MaximizeFull) != (oldMode == MaximizeFull)) { + emit c->maximizedChanged(m_maximizeMode & MaximizeFull); + } + changeMaximizeRecursion = false; + } } MaximizeMode ShellClient::maximizeMode() const