From 2262713fe95a05ad4cb28d4daca6cba5acfa0dff Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Fri, 21 Oct 2022 12:35:15 +0300 Subject: Client: Improve handling of 0xH and Wx0 xdg_toplevel configure events The compositor can send a configure event with 0xH and Wx0 when it wants the window to have some concrete size along one dimension but wants the client to pick the size along the other dimension. Change-Id: I2e72017d4a71b19a930da24fa5c58b6ce672fb94 Reviewed-by: David Edmundson --- tests/auto/client/xdgshell/tst_xdgshell.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'tests/auto/client/xdgshell/tst_xdgshell.cpp') diff --git a/tests/auto/client/xdgshell/tst_xdgshell.cpp b/tests/auto/client/xdgshell/tst_xdgshell.cpp index e560784e9..efaa6a8f1 100644 --- a/tests/auto/client/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/client/xdgshell/tst_xdgshell.cpp @@ -19,6 +19,7 @@ private slots: void basicConfigure(); void configureSize(); void configureStates(); + void configureBounds(); void popup(); void tooltipOnPopup(); void tooltipAndSiblingPopup(); @@ -170,6 +171,30 @@ void tst_xdgshell::configureStates() QVERIFY(qunsetenv("QT_WAYLAND_FRAME_CALLBACK_TIMEOUT")); } +void tst_xdgshell::configureBounds() +{ + QRasterWindow window; + window.resize(1280, 1024); + window.show(); + QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); + + // Take xdg_toplevel.configure_bounds into account only if the configure event has 0x0 size. + const uint serial1 = exec([=] { + xdgToplevel()->sendConfigureBounds(QSize(800, 600)); + return xdgToplevel()->sendCompleteConfigure(QSize(0, 0), { XdgToplevel::state_activated }); + }); + QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, serial1); + QCOMPARE(window.frameGeometry().size(), QSize(800, 600)); + + // Window size in xdg_toplevel configure events takes precedence over the configure bounds. + const uint serial2 = exec([=] { + xdgToplevel()->sendConfigureBounds(QSize(800, 600)); + return xdgToplevel()->sendCompleteConfigure(QSize(1600, 900), { XdgToplevel::state_activated }); + }); + QCOMPOSITOR_TRY_COMPARE(xdgSurface()->m_committedConfigureSerial, serial2); + QCOMPARE(window.frameGeometry().size(), QSize(1600, 900)); +} + void tst_xdgshell::popup() { class Window : public QRasterWindow { -- cgit v1.2.3