From 602fa3f3370690f6d197dfe37e57aa3648ea751b Mon Sep 17 00:00:00 2001 From: David Edmundson Date: Fri, 30 May 2025 11:20:23 +0300 Subject: [PATCH] wayland: Ack configure events when suspended All configure events should be acked, and that acknowledgement is double buffered with the surface commit. If a window is not exposed, for example being in a suspended state, us sending an expose event is semantically wrong. It also ends up not resulting in a commit as at some point it no-ops, we have to commit manually. Change-Id: I020b06f04030c1209f2fc768adc8bd66d57975b1 Reviewed-by: David Redondo --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 7 +++++-- tests/auto/wayland/xdgshell/tst_xdgshell.cpp | 11 +++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 5b0f2b15f82..f40496d0e30 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -725,8 +725,11 @@ void QWaylandWindow::applyConfigure() mShellSurface->applyConfigure(); mWaitingToApplyConfigure = false; - QRect exposeGeometry(QPoint(), geometry().size()); - sendExposeEvent(exposeGeometry); + if (mExposed) + sendExposeEvent(QRect(QPoint(), geometry().size())); + else + // we still need to commit the configured ack for a hidden surface + commit(); } void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y) diff --git a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp index 3a7e001e1d9..72200ce72b6 100644 --- a/tests/auto/wayland/xdgshell/tst_xdgshell.cpp +++ b/tests/auto/wayland/xdgshell/tst_xdgshell.cpp @@ -845,15 +845,18 @@ void tst_xdgshell::suspended() QVERIFY(!window.isExposed()); // not exposed until we're configured QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); - exec([&] { xdgToplevel()->sendCompleteConfigure(); }); - QCOMPOSITOR_TRY_VERIFY(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial); + uint serial = 0; + exec([&] { serial = xdgToplevel()->sendCompleteConfigure(); }); QTRY_VERIFY(window.isExposed()); + QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial, serial); - exec([&] { xdgToplevel()->sendCompleteConfigure(QSize(), {XdgToplevel::state_suspended}); }); + exec([&] { serial = xdgToplevel()->sendCompleteConfigure(QSize(), {XdgToplevel::state_suspended}); }); QTRY_VERIFY(!window.isExposed()); + QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial, serial); - exec([&] { xdgToplevel()->sendCompleteConfigure(QSize(), {}); }); + exec([&] { serial = xdgToplevel()->sendCompleteConfigure(QSize(), {}); }); QTRY_VERIFY(window.isExposed()); + QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial, serial); } void tst_xdgshell::initiallySuspended()