Commit 8a2796d2 authored by Martin Flöser's avatar Martin Flöser

Fix regression from KWin 5.9 regarding quick tiling

Summary:
The regression got introduced with 9934f5b5.
The order when setMaximize(false, false) was called changed in regard to
when the quick tiling mode was adjusted. But just changing the ordering
back was no solution as that would cause regressions in other areas
(unit tests fail).

This change builds up on the support for geometry update blocker on
Wayland to be able to better support this situation without causing
further regressions.

Also this change rethinks the code area. There is an idea behind
temporarily setting the quick tile mode to none and that is even
documented in a comment: it should not confuse maximize. So let's do
exactly that: call the maximize in the block where the quick tile
mode is temporarily wrong. As that is only one branch the else branch
performs the same steps.

BUG: 376104
FIXED-IN: 5.12.0

Test Plan: Confirmation in bug report that patch fixes issue

Reviewers: #kwin, #plasma

Subscribers: plasma-devel, kwin

Tags: #kwin

Differential Revision: https://phabricator.kde.org/D9178
parent a8be959b
......@@ -584,23 +584,7 @@ void QuickTilingTest::testX11QuickTilingAfterVertMaximize()
QVERIFY(quickTileChangedSpy.isValid());
QFETCH(QuickTileMode, mode);
client->setQuickTileMode(mode, true);
QEXPECT_FAIL("left", "Quick tiling not working", Continue);
QEXPECT_FAIL("right", "Quick tiling not working", Continue);
QEXPECT_FAIL("top", "Quick tiling not working", Continue);
QEXPECT_FAIL("bottom", "Quick tiling not working", Continue);
QEXPECT_FAIL("top left", "Quick tiling not working", Continue);
QEXPECT_FAIL("top right", "Quick tiling not working", Continue);
QEXPECT_FAIL("bottom left", "Quick tiling not working", Continue);
QEXPECT_FAIL("bottom right", "Quick tiling not working", Continue);
QCOMPARE(client->quickTileMode(), mode);
QEXPECT_FAIL("left", "Quick tiling not working", Continue);
QEXPECT_FAIL("right", "Quick tiling not working", Continue);
QEXPECT_FAIL("top", "Quick tiling not working", Continue);
QEXPECT_FAIL("bottom", "Quick tiling not working", Continue);
QEXPECT_FAIL("top left", "Quick tiling not working", Continue);
QEXPECT_FAIL("top right", "Quick tiling not working", Continue);
QEXPECT_FAIL("bottom left", "Quick tiling not working", Continue);
QEXPECT_FAIL("bottom right", "Quick tiling not working", Continue);
QTEST(client->geometry(), "expectedGeometry");
QEXPECT_FAIL("", "We get two changed events", Continue);
QCOMPARE(quickTileChangedSpy.count(), 1);
......
......@@ -3360,16 +3360,19 @@ void AbstractClient::setQuickTileMode(QuickTileMode mode, bool keyboard)
TabSynchronizer syncer(this, TabGroup::QuickTile|TabGroup::Geometry|TabGroup::Maximized);
if (mode != QuickTileMode(QuickTileFlag::None)) {
m_quickTileMode = mode;
// decorations may turn off some borders when tiled
const ForceGeometry_t geom_mode = isDecorated() ? ForceGeometrySet : NormalGeometrySet;
m_quickTileMode = int(QuickTileFlag::None); // Temporary, so the maximize code doesn't get all confused
setMaximize(false, false);
setGeometry(electricBorderMaximizeGeometry(keyboard ? geometry().center() : Cursor::pos(), desktop()), geom_mode);
// Store the mode change
m_quickTileMode = mode;
} else {
m_quickTileMode = mode;
setMaximize(false, false);
}
// Store the mode change
m_quickTileMode = mode;
setMaximize(false, false);
emit quickTileModeChanged();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment