wayland: Make initial commit for surface state opt-in

After setting up the shell surface we setup the initial state and have
to commit the surface to apply the surface role in order to get a
configure event from the compositor.

This is not a requirement for subsurfaces, and can be skipped.

It is also problematic for some 3rd party shells, such as
ext-session-lock-v1, which has a different setup behaviour.

Task-number: QTBUG-136337
Change-Id: I9e7874ec2f4150e24eb4790384eacc4123f9552b
Reviewed-by: Vlad Zahorodnii <vlad.zahorodnii@kde.org>
This commit is contained in:
David Edmundson 2025-04-29 11:52:35 +02:00
parent 854d7021b8
commit 27283b02ca
3 changed files with 14 additions and 1 deletions

View File

@ -85,6 +85,16 @@ void QWaylandShellSurface::requestXdgActivationToken(quint32 serial)
Q_UNUSED(serial);
Q_EMIT m_window->xdgActivationTokenCreated({});
}
/*!
Determines whether the client should commit the surface with no buffer
after creating the role and performing initial setup
*/
bool QWaylandShellSurface::commitSurfaceRole() const
{
return true;
}
}
QT_END_NAMESPACE

View File

@ -92,6 +92,8 @@ public:
virtual void setIcon(const QIcon &icon) { Q_UNUSED(icon); }
virtual bool commitSurfaceRole() const;
protected:
void resizeFromApplyConfigure(const QSize &sizeWithMargins, const QPoint &offset = {0, 0});
void repositionFromApplyConfigure(const QPoint &position);

View File

@ -203,7 +203,8 @@ void QWaylandWindow::initWindow()
handleContentOrientationChange(window()->contentOrientation());
mFlags = window()->flags();
mSurface->commit();
if (mShellSurface && mShellSurface->commitSurfaceRole())
mSurface->commit();
}
void QWaylandWindow::setPendingImageDescription()