From c54937b2ad5afd02f7cfc19916f74e7fa8ab0bbb Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Wed, 9 Feb 2022 22:57:23 +0200 Subject: [PATCH] Avoid mixing current and next state Mixing of current and next state can create all sorts of undefined behavior, e.g. windows not moving to the desired location or experiencing issues when tiling a maximized window. BUG: 449541 --- src/abstract_client.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/abstract_client.cpp b/src/abstract_client.cpp index ac45f8bd12..46087282fa 100644 --- a/src/abstract_client.cpp +++ b/src/abstract_client.cpp @@ -2302,8 +2302,7 @@ void AbstractClient::setDecoration(QSharedPointer deco this, &AbstractClient::updateDecorationInputShape); connect(decoration.data(), &KDecoration2::Decoration::bordersChanged, this, [this]() { GeometryUpdatesBlocker blocker(this); - const QRect oldGeometry = frameGeometry(); - resize(implicitSize()); + const QRect oldGeometry = moveResizeGeometry(); if (!isShade()) { checkWorkspacePosition(oldGeometry); } @@ -3096,7 +3095,7 @@ void AbstractClient::setQuickTileMode(QuickTileMode mode, bool keyboard) GeometryUpdatesBlocker blocker(this); if (mode == QuickTileMode(QuickTileFlag::Maximize)) { - if (maximizeMode() == MaximizeFull) { + if (requestedMaximizeMode() == MaximizeFull) { m_quickTileMode = int(QuickTileFlag::None); setMaximize(false, false); } else { @@ -3117,7 +3116,7 @@ void AbstractClient::setQuickTileMode(QuickTileMode mode, bool keyboard) mode &= ~QuickTileMode(QuickTileFlag::Vertical); // restore from maximized so that it is possible to tile maximized windows with one hit or by dragging - if (maximizeMode() != MaximizeRestore) { + if (requestedMaximizeMode() != MaximizeRestore) { if (mode != QuickTileMode(QuickTileFlag::None)) { m_quickTileMode = int(QuickTileFlag::None); // Temporary, so the maximize code doesn't get all confused @@ -3327,13 +3326,13 @@ void AbstractClient::checkWorkspacePosition(QRect oldGeometry, const VirtualDesk if (!oldGeometry.isValid()) { oldGeometry = newGeom; } - if (isFullScreen()) { + if (isRequestedFullScreen()) { moveResize(workspace()->clientArea(FullScreenArea, this, newGeom.center())); updateGeometryRestoresForFullscreen(kwinApp()->platform()->outputAt(newGeom.center())); return; } - if (maximizeMode() != MaximizeRestore) { + if (requestedMaximizeMode() != MaximizeRestore) { changeMaximize(false, false, true); // adjust size QRect geom = moveResizeGeometry(); const QRect screenArea = workspace()->clientArea(ScreenArea, this, geom.center());