X11Client: emit isCloseableChanged when updated

This allows the decoration buttons to be updated accordingly
when the status changes.

We also need to explicitely update allowed actions when rules
are applied, as `isCloseable` is not a settable property, but
an allowed action

BUG: 424370
FIXED-IN: 5.22.90
This commit is contained in:
Ismael Asensio 2021-09-04 14:43:44 +02:00
parent bb0f749ee7
commit 436011e0ec

View file

@ -2162,7 +2162,7 @@ void X11Client::setClientShown(bool shown)
void X11Client::getMotifHints()
{
const bool wasClosable = m_motif.close();
const bool wasClosable = isCloseable();
const bool wasNoBorder = m_motif.noBorder();
if (m_managed) // only on property change, initial read is prefetched
m_motif.fetch();
@ -2179,7 +2179,7 @@ void X11Client::getMotifHints()
// mminimize; - Ignore, bogus - E.g. shading or sending to another desktop is "minimizing" too
// mmaximize; - Ignore, bogus - Maximizing is basically just resizing
const bool closabilityChanged = wasClosable != m_motif.close();
const bool closabilityChanged = wasClosable != isCloseable();
if (isManaged())
updateDecoration(true); // Check if noborder state has changed
if (closabilityChanged) {
@ -2396,6 +2396,9 @@ void X11Client::updateAllowedActions(bool force)
if ((allowed_actions & NET::ActionMax) != (old_allowed_actions & NET::ActionMax)) {
Q_EMIT maximizeableChanged(allowed_actions & NET::ActionMax);
}
if ((allowed_actions & NET::ActionClose) != (old_allowed_actions & NET::ActionClose)) {
Q_EMIT closeableChanged(allowed_actions & NET::ActionClose);
}
}
}
@ -4701,6 +4704,7 @@ bool X11Client::hasStrut() const
void X11Client::applyWindowRules()
{
AbstractClient::applyWindowRules();
updateAllowedActions();
setBlockingCompositing(info->isBlockingCompositing());
}