Emit the maximizedChanged and friends signals in ShellClient like in Client
This is an update to c95ddb7102
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
This commit is contained in:
parent
c95ddb7102
commit
04c3998571
2 changed files with 21 additions and 8 deletions
|
@ -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<void (AbstractClient::*)(KWin::AbstractClient*, MaximizeMode)>(&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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue