xdgshellwindow: enforce a minimum size for clients

It doesn't make sense for a window to become 1x1 pixels small. When we have
server side decorations we also know that the decoration takes a lot of
space, so this commit enforces a bigger minimum size for decorated windows

BUG: 469237
This commit is contained in:
Xaver Hugl 2023-08-23 21:51:18 +02:00
parent d0a9e90716
commit 28c27609a4
2 changed files with 6 additions and 5 deletions

View file

@ -370,12 +370,12 @@ void TestXdgShellWindow::testFullscreen()
QVERIFY(surfaceConfigureRequestedSpy.wait());
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
auto window = Test::renderAndWaitForShown(surface.get(), QSize(100, 50), Qt::blue);
auto window = Test::renderAndWaitForShown(surface.get(), QSize(500, 250), Qt::blue);
QVERIFY(window);
QVERIFY(window->isActive());
QCOMPARE(window->layer(), NormalLayer);
QVERIFY(!window->isFullScreen());
QCOMPARE(window->clientSize(), QSize(100, 50));
QCOMPARE(window->clientSize(), QSize(500, 250));
QCOMPARE(window->isDecorated(), decoMode == Test::XdgToplevelDecorationV1::mode_server_side);
QCOMPARE(window->clientSizeToFrameSize(window->clientSize()), window->size());
@ -412,14 +412,14 @@ void TestXdgShellWindow::testFullscreen()
QCOMPARE(surfaceConfigureRequestedSpy.count(), 4);
states = toplevelConfigureRequestedSpy.last().at(1).value<Test::XdgToplevel::States>();
QVERIFY(!(states & Test::XdgToplevel::State::Fullscreen));
QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value<QSize>(), QSize(100, 50));
QCOMPARE(toplevelConfigureRequestedSpy.last().at(0).value<QSize>(), QSize(500, 250));
shellSurface->xdgSurface()->ack_configure(surfaceConfigureRequestedSpy.last().at(0).value<quint32>());
Test::render(surface.get(), toplevelConfigureRequestedSpy.last().at(0).value<QSize>(), Qt::blue);
QVERIFY(fullScreenChangedSpy.wait());
QCOMPARE(fullScreenChangedSpy.count(), 2);
QCOMPARE(window->clientSize(), QSize(100, 50));
QCOMPARE(window->clientSize(), QSize(500, 250));
QVERIFY(!window->isFullScreen());
QCOMPARE(window->isDecorated(), decoMode == Test::XdgToplevelDecorationV1::mode_server_side);
QCOMPARE(window->layer(), NormalLayer);

View file

@ -497,7 +497,8 @@ MaximizeMode XdgToplevelWindow::requestedMaximizeMode() const
QSizeF XdgToplevelWindow::minSize() const
{
return rules()->checkMinSize(m_shellSurface->minimumSize());
const int enforcedMinimum = m_nextDecoration ? 150 : 20;
return rules()->checkMinSize(QSize(std::max(enforcedMinimum, m_shellSurface->minimumSize().width()), std::max(enforcedMinimum, m_shellSurface->minimumSize().height())));
}
QSizeF XdgToplevelWindow::maxSize() const