Commit 083437d4 authored by Arjen Hiemstra's avatar Arjen Hiemstra Committed by David Edmundson
Browse files

Don't use QRect::bottom when applying virtual keyboard geometry

Bottom is unreliable because of "historical reasons" in Qt. So don't use
bottom, instead calculate the proper height and top manually.
parent 36f7bae3
......@@ -906,7 +906,7 @@ void MoveResizeWindowTest::testResizeForVirtualKeyboard()
Test::render(surface.data(), toplevelConfigureRequestedSpy.last().first().toSize(), Qt::blue);
QVERIFY(frameGeometryChangedSpy.wait());
QCOMPARE(window->frameGeometry(), QRect(100, 0, 500, 101));
QCOMPARE(window->frameGeometry(), QRect(100, 0, 500, 100));
window->setVirtualKeyboardGeometry(QRect());
QVERIFY(surfaceConfigureRequestedSpy.wait());
......@@ -950,7 +950,7 @@ void MoveResizeWindowTest::testResizeForVirtualKeyboardWithMaximize()
// render at the new size
Test::render(surface.data(), toplevelConfigureRequestedSpy.last().first().toSize(), Qt::blue);
QVERIFY(frameGeometryChangedSpy.wait());
QCOMPARE(window->frameGeometry(), QRect(100, 0, 500, 101));
QCOMPARE(window->frameGeometry(), QRect(100, 0, 500, 100));
window->setMaximize(true, true);
QVERIFY(surfaceConfigureRequestedSpy.wait());
......@@ -1003,7 +1003,7 @@ void MoveResizeWindowTest::testResizeForVirtualKeyboardWithFullScreen()
// render at the new size
Test::render(surface.data(), toplevelConfigureRequestedSpy.last().first().toSize(), Qt::blue);
QVERIFY(frameGeometryChangedSpy.wait());
QCOMPARE(window->frameGeometry(), QRect(100, 0, 500, 101));
QCOMPARE(window->frameGeometry(), QRect(100, 0, 500, 100));
window->setFullScreen(true, true);
QVERIFY(surfaceConfigureRequestedSpy.wait());
......
......@@ -3264,8 +3264,9 @@ void Window::setVirtualKeyboardGeometry(const QRect &geo)
const QRect availableArea = workspace()->clientArea(MaximizeArea, this);
QRect newWindowGeometry = (maximizeMode() & MaximizeHorizontal) ? availableArea : m_keyboardGeometryRestore;
newWindowGeometry.moveBottom(geo.top());
newWindowGeometry.setTop(qMax(newWindowGeometry.top(), availableArea.top()));
newWindowGeometry.setHeight(std::min(newWindowGeometry.height(), geo.top() - availableArea.top()));
newWindowGeometry.moveTop(std::max(geo.top() - newWindowGeometry.height(), availableArea.top()));
newWindowGeometry = newWindowGeometry.intersected(availableArea);
moveResize(newWindowGeometry);
}
......
Supports Markdown
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