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

View file

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