wayland/lock: fix post-reload lockscreen creation

This broke due to the changes that ensure onReload always runs.
This commit is contained in:
outfoxxed 2024-04-25 14:18:25 -07:00
parent ce4e697667
commit 1f49c55711
Signed by: outfoxxed
GPG Key ID: 4C88A185FB89301E
2 changed files with 6 additions and 4 deletions

View File

@ -91,6 +91,7 @@ void WlSessionLock::updateSurfaces(WlSessionLock* old) {
auto* oldInstance = old == nullptr ? nullptr : old->surfaces.value(screen, nullptr);
instance->reload(oldInstance);
instance->attach();
this->surfaces[screen] = instance;
}
@ -198,15 +199,15 @@ void WlSessionLockSurface::onReload(QObject* oldInstance) {
QObject::connect(this->window, &QWindow::screenChanged, this, &WlSessionLockSurface::screenChanged);
QObject::connect(this->window, &QQuickWindow::colorChanged, this, &WlSessionLockSurface::colorChanged);
// clang-format on
}
void WlSessionLockSurface::attach() {
if (auto* parent = qobject_cast<WlSessionLock*>(this->parent())) {
if (!this->ext->attach(this->window, parent->manager)) {
qWarning(
) << "Failed to attach LockWindowExtension to window. Surface will not behave correctly.";
qFatal() << "Failed to attach WlSessionLockSurface";
}
} else {
qWarning(
) << "WlSessionLockSurface parent is not a WlSessionLock. Surface will not behave correctly.";
qFatal() << "Tried to attach a WlSessionLockSurface whose parent is not a WlSessionLock";
}
}

View File

@ -153,6 +153,7 @@ public:
void onReload(QObject* oldInstance) override;
QQuickWindow* disownWindow();
void attach();
void show();
[[nodiscard]] QQuickItem* contentItem() const;