diff --git a/client.cpp b/client.cpp index 6fd2a11a3d..65880a726b 100644 --- a/client.cpp +++ b/client.cpp @@ -1963,10 +1963,9 @@ void Client::getMotifHints() motif_may_close = mclose; // Motif apps like to crash when they set this hint and WM closes them anyway if (isManaged()) updateDecoration(true); // Check if noborder state has changed -#if 0 - if (decoration && closabilityChanged) - emit decoration->decorationButtonsChanged(); -#endif + if (closabilityChanged) { + emit closeableChanged(isCloseable()); + } } void Client::getIcons() @@ -2251,10 +2250,17 @@ void Client::updateAllowedActions(bool force) // ONLY if relevant features have changed (and the window didn't just get/loose moveresize for maximization state changes) const NET::Actions relevant = ~(NET::ActionMove|NET::ActionResize); -#if 0 - if (decoration && (allowed_actions & relevant) != (old_allowed_actions & relevant)) - emit decoration->decorationButtonsChanged(); -#endif + if ((allowed_actions & relevant) != (old_allowed_actions & relevant)) { + if ((allowed_actions & NET::ActionMinimize) != (old_allowed_actions & NET::ActionMinimize)) { + emit minimizeableChanged(allowed_actions & NET::ActionMinimize); + } + if ((allowed_actions & NET::ActionShade) != (old_allowed_actions & NET::ActionShade)) { + emit shadeableChanged(allowed_actions & NET::ActionShade); + } + if ((allowed_actions & NET::ActionMax) != (old_allowed_actions & NET::ActionMax)) { + emit maximizeableChanged(allowed_actions & NET::ActionMax); + } + } } void Client::autoRaise() diff --git a/client.h b/client.h index cd3654174f..0ac40392a1 100644 --- a/client.h +++ b/client.h @@ -772,6 +772,11 @@ Q_SIGNALS: void clientSideDecoratedChanged(); void quickTileModeChanged(); + void closeableChanged(bool); + void minimizeableChanged(bool); + void shadeableChanged(bool); + void maximizeableChanged(bool); + private: int borderLeft() const; int borderRight() const; diff --git a/decorations/decoratedclient.cpp b/decorations/decoratedclient.cpp index e155925ba7..1abc0f21db 100644 --- a/decorations/decoratedclient.cpp +++ b/decorations/decoratedclient.cpp @@ -77,7 +77,6 @@ DecoratedClientImpl::DecoratedClientImpl(Client *client, KDecoration2::Decorated ); connect(client, &Client::keepAboveChanged, decoratedClient, &KDecoration2::DecoratedClient::keepAboveChanged); connect(client, &Client::keepBelowChanged, decoratedClient, &KDecoration2::DecoratedClient::keepBelowChanged); - // closeable, etc. connect(Compositor::self(), &Compositor::compositingToggled, this, [this, decoration]() { delete m_renderer; @@ -91,6 +90,10 @@ DecoratedClientImpl::DecoratedClientImpl(Client *client, KDecoration2::Decorated emit decoratedClient->borderingScreenEdgesChanged(borderingScreenEdges()); } ); + connect(client, &Client::closeableChanged, decoratedClient, &KDecoration2::DecoratedClient::closeableChanged); + connect(client, &Client::shadeableChanged, decoratedClient, &KDecoration2::DecoratedClient::shadeableChanged); + connect(client, &Client::minimizeableChanged, decoratedClient, &KDecoration2::DecoratedClient::minimizableChanged); + connect(client, &Client::maximizeableChanged, decoratedClient, &KDecoration2::DecoratedClient::maximizableChanged); } DecoratedClientImpl::~DecoratedClientImpl() = default;