Request the resize of ShellSurface after Decoration updated the borders when maximizing
Summary: This ensures that we don't send a size request with the borders still added. Test Plan: Verified that a maximized window is properly sized and doesn't have empty borders Reviewers: #kwin, #plasma_on_wayland Subscribers: plasma-devel, kwin Tags: #plasma_on_wayland, #kwin Differential Revision: https://phabricator.kde.org/D1807
This commit is contained in:
parent
c7828eab8f
commit
53a3740082
2 changed files with 29 additions and 13 deletions
|
@ -176,6 +176,9 @@ void TestMaximized::testMaximizedPassedToDeco()
|
|||
surface->damage(QRect(0, 0, 100, 50));
|
||||
surface->commit(Surface::CommitFlag::None);
|
||||
|
||||
QSignalSpy sizeChangedSpy(shellSurface.data(), &ShellSurface::sizeChanged);
|
||||
QVERIFY(sizeChangedSpy.isValid());
|
||||
|
||||
QVERIFY(clientAddedSpy.isEmpty());
|
||||
QVERIFY(clientAddedSpy.wait());
|
||||
auto client = clientAddedSpy.first().first().value<ShellClient*>();
|
||||
|
@ -186,12 +189,25 @@ void TestMaximized::testMaximizedPassedToDeco()
|
|||
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeRestore);
|
||||
|
||||
// now maximize
|
||||
QVERIFY(sizeChangedSpy.isEmpty());
|
||||
QSignalSpy bordersChangedSpy(decoration, &KDecoration2::Decoration::bordersChanged);
|
||||
QVERIFY(bordersChangedSpy.isValid());
|
||||
QSignalSpy maximizedChangedSpy(decoration->client().data(), &KDecoration2::DecoratedClient::maximizedChanged);
|
||||
QVERIFY(maximizedChangedSpy.isValid());
|
||||
workspace()->slotWindowMaximize();
|
||||
QCOMPARE(client->maximizeMode(), MaximizeMode::MaximizeFull);
|
||||
QCOMPARE(maximizedChangedSpy.count(), 1);
|
||||
QCOMPARE(maximizedChangedSpy.last().first().toBool(), true);
|
||||
QCOMPARE(bordersChangedSpy.count(), 1);
|
||||
QCOMPARE(decoration->borderLeft(), 0);
|
||||
QCOMPARE(decoration->borderBottom(), 0);
|
||||
QCOMPARE(decoration->borderRight(), 0);
|
||||
QVERIFY(decoration->borderTop() != 0);
|
||||
|
||||
QVERIFY(sizeChangedSpy.isEmpty());
|
||||
QVERIFY(sizeChangedSpy.wait());
|
||||
QCOMPARE(sizeChangedSpy.count(), 1);
|
||||
QCOMPARE(sizeChangedSpy.first().first().toSize(), QSize(1280, 1024 - decoration->borderTop()));
|
||||
|
||||
// now unmaximize again
|
||||
workspace()->slotWindowMaximize();
|
||||
|
|
|
@ -572,19 +572,6 @@ void ShellClient::changeMaximize(bool horizontal, bool vertical, bool adjust)
|
|||
if (horizontal)
|
||||
m_maximizeMode = MaximizeMode(m_maximizeMode ^ MaximizeHorizontal);
|
||||
}
|
||||
|
||||
// TODO: check rules
|
||||
if (m_maximizeMode == MaximizeFull) {
|
||||
m_geomMaximizeRestore = geometry();
|
||||
requestGeometry(workspace()->clientArea(MaximizeArea, this));
|
||||
workspace()->raiseClient(this);
|
||||
} else {
|
||||
if (m_geomMaximizeRestore.isValid()) {
|
||||
requestGeometry(m_geomMaximizeRestore);
|
||||
} else {
|
||||
requestGeometry(workspace()->clientArea(PlacementArea, this));
|
||||
}
|
||||
}
|
||||
// TODO: add more checks as in Client
|
||||
|
||||
// call into decoration update borders
|
||||
|
@ -602,6 +589,19 @@ void ShellClient::changeMaximize(bool horizontal, bool vertical, bool adjust)
|
|||
}
|
||||
changeMaximizeRecursion = false;
|
||||
}
|
||||
|
||||
// TODO: check rules
|
||||
if (m_maximizeMode == MaximizeFull) {
|
||||
m_geomMaximizeRestore = geometry();
|
||||
requestGeometry(workspace()->clientArea(MaximizeArea, this));
|
||||
workspace()->raiseClient(this);
|
||||
} else {
|
||||
if (m_geomMaximizeRestore.isValid()) {
|
||||
requestGeometry(m_geomMaximizeRestore);
|
||||
} else {
|
||||
requestGeometry(workspace()->clientArea(PlacementArea, this));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MaximizeMode ShellClient::maximizeMode() const
|
||||
|
|
Loading…
Reference in a new issue