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 <qt@david-redondo.de>
This commit is contained in:
David Edmundson 2025-05-30 11:20:23 +03:00
parent ca27a661bd
commit 602fa3f337
2 changed files with 12 additions and 6 deletions

View File

@ -725,8 +725,11 @@ void QWaylandWindow::applyConfigure()
mShellSurface->applyConfigure(); mShellSurface->applyConfigure();
mWaitingToApplyConfigure = false; mWaitingToApplyConfigure = false;
QRect exposeGeometry(QPoint(), geometry().size()); if (mExposed)
sendExposeEvent(exposeGeometry); 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) void QWaylandWindow::attach(QWaylandBuffer *buffer, int x, int y)

View File

@ -845,15 +845,18 @@ void tst_xdgshell::suspended()
QVERIFY(!window.isExposed()); // not exposed until we're configured QVERIFY(!window.isExposed()); // not exposed until we're configured
QCOMPOSITOR_TRY_VERIFY(xdgToplevel()); QCOMPOSITOR_TRY_VERIFY(xdgToplevel());
exec([&] { xdgToplevel()->sendCompleteConfigure(); }); uint serial = 0;
QCOMPOSITOR_TRY_VERIFY(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial); exec([&] { serial = xdgToplevel()->sendCompleteConfigure(); });
QTRY_VERIFY(window.isExposed()); 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()); 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()); QTRY_VERIFY(window.isExposed());
QCOMPOSITOR_TRY_COMPARE(xdgToplevel()->m_xdgSurface->m_committedConfigureSerial, serial);
} }
void tst_xdgshell::initiallySuspended() void tst_xdgshell::initiallySuspended()