From 04c39985717d79b66aa0183faa9e18b34cedbbc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Thu, 9 Jun 2016 14:37:32 +0200 Subject: [PATCH] Emit the maximizedChanged and friends signals in ShellClient like in Client This is an update to c95ddb710215c2c15d35488ae76ce4e31fcbaca5 and implements the emit of maximized changed in deocration like on Client. Overall the code looks like it should be merge better together with Client. Reviewed-By: kbroulik --- decorations/decoratedclient.cpp | 8 -------- shell_client.cpp | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 8 deletions(-) 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