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
This commit is contained in:
Vlad Zahorodnii 2022-02-09 22:57:23 +02:00
parent 3fb6901646
commit c54937b2ad

View file

@ -2302,8 +2302,7 @@ void AbstractClient::setDecoration(QSharedPointer<KDecoration2::Decoration> 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());