Emit signals from Client when allowed actions change

This commit is contained in:
Martin Gräßlin 2014-07-25 14:01:47 +02:00
parent 7154cfee42
commit 689a3a1c5e
3 changed files with 23 additions and 9 deletions

View file

@ -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()

View file

@ -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;

View file

@ -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;