forked from quickshell/quickshell
fix(wayland): layershell windows are recreated if attach fails
Usually this happens if the namespace changes
This commit is contained in:
parent
c2930783ea
commit
13c5d7c7a9
5 changed files with 41 additions and 13 deletions
|
@ -28,14 +28,7 @@ ProxyWindowBase::~ProxyWindowBase() {
|
|||
}
|
||||
|
||||
void ProxyWindowBase::onReload(QObject* oldInstance) {
|
||||
auto* old = qobject_cast<ProxyWindowBase*>(oldInstance);
|
||||
|
||||
if (old == nullptr || old->window == nullptr) {
|
||||
this->window = new QQuickWindow();
|
||||
} else {
|
||||
this->window = old->disownWindow();
|
||||
}
|
||||
|
||||
this->window = this->createWindow(oldInstance);
|
||||
this->setupWindow();
|
||||
|
||||
Reloadable::reloadRecursive(this->mContentItem, oldInstance);
|
||||
|
@ -52,6 +45,16 @@ void ProxyWindowBase::onReload(QObject* oldInstance) {
|
|||
this->window->setVisible(this->mVisible);
|
||||
}
|
||||
|
||||
QQuickWindow* ProxyWindowBase::createWindow(QObject* oldInstance) {
|
||||
auto* old = qobject_cast<ProxyWindowBase*>(oldInstance);
|
||||
|
||||
if (old == nullptr || old->window == nullptr) {
|
||||
return new QQuickWindow();
|
||||
} else {
|
||||
return old->disownWindow();
|
||||
}
|
||||
}
|
||||
|
||||
void ProxyWindowBase::setupWindow() {
|
||||
// clang-format off
|
||||
QObject::connect(this->window, &QWindow::visibilityChanged, this, &ProxyWindowBase::visibleChanged);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue