diff --git a/src/plasmaquick/dialog.h b/src/plasmaquick/dialog.h --- a/src/plasmaquick/dialog.h +++ b/src/plasmaquick/dialog.h @@ -221,6 +221,11 @@ * window that is neither a parent dialog to nor a child dialog of this dialog. */ void windowDeactivated(); + /** + * Emitted when the popup is about to show + * it's still not visible, but geometry already adjusted + */ + void aboutToShow(); protected: /** diff --git a/src/plasmaquick/dialog.cpp b/src/plasmaquick/dialog.cpp --- a/src/plasmaquick/dialog.cpp +++ b/src/plasmaquick/dialog.cpp @@ -304,6 +304,12 @@ if (mainItemLayout) { updateLayoutParameters(); } + + //if is a wayland window that was hidden, we need + //to set its position again as there won't be any move event to sync QWindow::position and shellsurface::position + if (shellSurface) { + shellSurface->setPosition(q->position()); + } } } @@ -481,7 +487,7 @@ void DialogPrivate::updateLayoutParameters() { - if (!componentComplete || !mainItem || !q->isVisible() || !mainItemLayout) { + if (!componentComplete || !mainItem || !mainItemLayout) { return; } @@ -598,7 +604,7 @@ { Q_ASSERT(mainItem); - if (!componentComplete || !q->isVisible()) { + if (!componentComplete) { return; } if (mainItem->width() <= 0 || mainItem->height() <= 0) { @@ -1164,7 +1170,9 @@ * see https://phabricator.kde.org/T6064 */ #if HAVE_KWAYLAND - if (!d->shellSurface) { + //sometimes non null regions arrive even for non visible windows + //for which surface creation would fail + if (!d->shellSurface && isVisible()) { KWindowSystem::setState(winId(), NET::SkipTaskbar | NET::SkipPager); d->setupWaylandIntegration(); d->updateVisibility(true); @@ -1356,6 +1364,17 @@ d->visible = visible; if (d->componentComplete) { + if (visible) { + if (d->mainItem) { + d->mainItem->setVisible(true); + d->syncToMainItemSize(); + } + if (d->mainItemLayout) { + d->updateLayoutParameters(); + } + + emit aboutToShow(); + } if (visible && d->visualParent) { setPosition(popupPosition(d->visualParent, size())); }