autotests: Make wl-subsurface factory function return a std::unique_ptr

This commit is contained in:
Vlad Zahorodnii 2024-03-10 21:41:15 +02:00
parent f723b11a9a
commit 98f0af0bc1
2 changed files with 4 additions and 5 deletions

View file

@ -679,8 +679,8 @@ void flushWaylandConnection();
bool waylandSync();
std::unique_ptr<KWayland::Client::Surface> createSurface();
KWayland::Client::SubSurface *createSubSurface(KWayland::Client::Surface *surface,
KWayland::Client::Surface *parentSurface, QObject *parent = nullptr);
std::unique_ptr<KWayland::Client::SubSurface> createSubSurface(KWayland::Client::Surface *surface,
KWayland::Client::Surface *parentSurface);
std::unique_ptr<LayerSurfaceV1> createLayerSurfaceV1(KWayland::Client::Surface *surface,
const QString &scope,

View file

@ -905,14 +905,13 @@ std::unique_ptr<KWayland::Client::Surface> createSurface()
return s->isValid() ? std::move(s) : nullptr;
}
KWayland::Client::SubSurface *createSubSurface(KWayland::Client::Surface *surface, KWayland::Client::Surface *parentSurface, QObject *parent)
std::unique_ptr<KWayland::Client::SubSurface> createSubSurface(KWayland::Client::Surface *surface, KWayland::Client::Surface *parentSurface)
{
if (!s_waylandConnection.subCompositor) {
return nullptr;
}
auto s = s_waylandConnection.subCompositor->createSubSurface(surface, parentSurface, parent);
std::unique_ptr<KWayland::Client::SubSurface> s(s_waylandConnection.subCompositor->createSubSurface(surface, parentSurface));
if (!s->isValid()) {
delete s;
return nullptr;
}
return s;