Fix geometryRestore() handling with maximize quick tile mode
geometryRestore() is no longer updated after mapping the window, so setQuickTileMode() has to update geometryRestore() explicitly to the correct value. With this change, geometryRestore() will be updated as follows: * if the window is tiled, geometryRestore() is valid, nothing to do * the window has been dragged to the top edge, set geometryRestore() to the geometry that the window had when starting move * otherwise, use the current move resize geometry
This commit is contained in:
parent
ef3ba9b4e8
commit
ab824959f6
2 changed files with 16 additions and 8 deletions
|
@ -262,7 +262,7 @@ void QuickTilingTest::testQuickMaximizing()
|
||||||
QCOMPARE(c->frameGeometry(), QRect(0, 0, 100, 50));
|
QCOMPARE(c->frameGeometry(), QRect(0, 0, 100, 50));
|
||||||
// but quick tile mode already changed
|
// but quick tile mode already changed
|
||||||
QCOMPARE(c->quickTileMode(), QuickTileFlag::Maximize);
|
QCOMPARE(c->quickTileMode(), QuickTileFlag::Maximize);
|
||||||
QCOMPARE(c->geometryRestore(), QRect());
|
QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50));
|
||||||
|
|
||||||
// but we got requested a new geometry
|
// but we got requested a new geometry
|
||||||
QVERIFY(surfaceConfigureRequestedSpy.wait());
|
QVERIFY(surfaceConfigureRequestedSpy.wait());
|
||||||
|
@ -276,7 +276,7 @@ void QuickTilingTest::testQuickMaximizing()
|
||||||
QVERIFY(frameGeometryChangedSpy.wait());
|
QVERIFY(frameGeometryChangedSpy.wait());
|
||||||
QCOMPARE(frameGeometryChangedSpy.count(), 1);
|
QCOMPARE(frameGeometryChangedSpy.count(), 1);
|
||||||
QCOMPARE(c->frameGeometry(), QRect(0, 0, 1280, 1024));
|
QCOMPARE(c->frameGeometry(), QRect(0, 0, 1280, 1024));
|
||||||
QCOMPARE(c->geometryRestore(), QRect());
|
QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50));
|
||||||
|
|
||||||
// client is now set to maximised
|
// client is now set to maximised
|
||||||
QCOMPARE(maximizeChangedSpy1.count(), 1);
|
QCOMPARE(maximizeChangedSpy1.count(), 1);
|
||||||
|
@ -295,11 +295,11 @@ void QuickTilingTest::testQuickMaximizing()
|
||||||
QCOMPARE(quickTileChangedSpy.count(), 2);
|
QCOMPARE(quickTileChangedSpy.count(), 2);
|
||||||
// geometry not yet changed
|
// geometry not yet changed
|
||||||
QCOMPARE(c->frameGeometry(), QRect(0, 0, 1280, 1024));
|
QCOMPARE(c->frameGeometry(), QRect(0, 0, 1280, 1024));
|
||||||
QCOMPARE(c->geometryRestore(), QRect());
|
QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50));
|
||||||
// we got requested a new geometry
|
// we got requested a new geometry
|
||||||
QVERIFY(surfaceConfigureRequestedSpy.wait());
|
QVERIFY(surfaceConfigureRequestedSpy.wait());
|
||||||
QCOMPARE(surfaceConfigureRequestedSpy.count(), 3);
|
QCOMPARE(surfaceConfigureRequestedSpy.count(), 3);
|
||||||
QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).toSize(), QSize(0, 0));
|
QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).toSize(), QSize(100, 50));
|
||||||
|
|
||||||
// render again
|
// render again
|
||||||
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
|
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
|
||||||
|
@ -308,7 +308,7 @@ void QuickTilingTest::testQuickMaximizing()
|
||||||
QVERIFY(frameGeometryChangedSpy.wait());
|
QVERIFY(frameGeometryChangedSpy.wait());
|
||||||
QCOMPARE(frameGeometryChangedSpy.count(), 2);
|
QCOMPARE(frameGeometryChangedSpy.count(), 2);
|
||||||
QCOMPARE(c->frameGeometry(), QRect(0, 0, 100, 50));
|
QCOMPARE(c->frameGeometry(), QRect(0, 0, 100, 50));
|
||||||
QCOMPARE(c->geometryRestore(), QRect());
|
QCOMPARE(c->geometryRestore(), QRect(0, 0, 100, 50));
|
||||||
QCOMPARE(maximizeChangedSpy1.count(), 2);
|
QCOMPARE(maximizeChangedSpy1.count(), 2);
|
||||||
QCOMPARE(maximizeChangedSpy1.last().first().value<KWin::AbstractClient*>(), c);
|
QCOMPARE(maximizeChangedSpy1.last().first().value<KWin::AbstractClient*>(), c);
|
||||||
QCOMPARE(maximizeChangedSpy1.last().last().value<KWin::MaximizeMode>(), MaximizeRestore);
|
QCOMPARE(maximizeChangedSpy1.last().last().value<KWin::MaximizeMode>(), MaximizeRestore);
|
||||||
|
|
|
@ -3080,14 +3080,22 @@ void AbstractClient::setQuickTileMode(QuickTileMode mode, bool keyboard)
|
||||||
GeometryUpdatesBlocker blocker(this);
|
GeometryUpdatesBlocker blocker(this);
|
||||||
|
|
||||||
if (mode == QuickTileMode(QuickTileFlag::Maximize)) {
|
if (mode == QuickTileMode(QuickTileFlag::Maximize)) {
|
||||||
m_quickTileMode = int(QuickTileFlag::None);
|
|
||||||
if (maximizeMode() == MaximizeFull) {
|
if (maximizeMode() == MaximizeFull) {
|
||||||
|
m_quickTileMode = int(QuickTileFlag::None);
|
||||||
setMaximize(false, false);
|
setMaximize(false, false);
|
||||||
} else {
|
} else {
|
||||||
QRect prev_geom_restore = geometryRestore(); // setMaximize() would set moveResizeGeom as geom_restore
|
// If the window is tiled, geometryRestore() already has a good value.
|
||||||
|
QRect effectiveGeometryRestore = geometryRestore();
|
||||||
|
if (m_quickTileMode == QuickTileMode(QuickTileFlag::None)) {
|
||||||
|
if (isElectricBorderMaximizing()) {
|
||||||
|
effectiveGeometryRestore = initialInteractiveMoveResizeGeometry();
|
||||||
|
} else {
|
||||||
|
effectiveGeometryRestore = moveResizeGeometry();
|
||||||
|
}
|
||||||
|
}
|
||||||
m_quickTileMode = int(QuickTileFlag::Maximize);
|
m_quickTileMode = int(QuickTileFlag::Maximize);
|
||||||
setMaximize(true, true);
|
setMaximize(true, true);
|
||||||
setGeometryRestore(prev_geom_restore);
|
setGeometryRestore(effectiveGeometryRestore);
|
||||||
}
|
}
|
||||||
doSetQuickTileMode();
|
doSetQuickTileMode();
|
||||||
Q_EMIT quickTileModeChanged();
|
Q_EMIT quickTileModeChanged();
|
||||||
|
|
Loading…
Reference in a new issue