From 511b92f4ab2a26441100de1ef3f5ec80f314d91c Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sat, 22 Apr 2023 11:32:15 +0300 Subject: [PATCH] Port to QWaylandShellSurface::attachPopup() --- src/qwaylandlayersurface.cpp | 13 +++++++++++++ src/qwaylandlayersurface_p.h | 3 +++ 2 files changed, 16 insertions(+) diff --git a/src/qwaylandlayersurface.cpp b/src/qwaylandlayersurface.cpp index 8a9d295..96c7c0c 100644 --- a/src/qwaylandlayersurface.cpp +++ b/src/qwaylandlayersurface.cpp @@ -97,6 +97,19 @@ void QWaylandLayerSurface::zwlr_layer_surface_v1_configure(uint32_t serial, uint } } +#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0) +void QWaylandLayerSurface::attachPopup(QtWaylandClient::QWaylandShellSurface *popup) +{ + std::any anyRole = popup->surfaceRole(); + + if (auto role = std::any_cast<::xdg_popup *>(&anyRole)) { + get_popup(*role); + } else { + qCWarning(LAYERSHELLQT) << "Cannot attach popup of unknown type"; + } +} +#endif + void QWaylandLayerSurface::applyConfigure() { window()->resizeFromApplyConfigure(m_pendingSize); diff --git a/src/qwaylandlayersurface_p.h b/src/qwaylandlayersurface_p.h index 2539a05..9e3e8ed 100644 --- a/src/qwaylandlayersurface_p.h +++ b/src/qwaylandlayersurface_p.h @@ -28,6 +28,9 @@ public: { return m_configured; } +#if QT_VERSION >= QT_VERSION_CHECK(6, 6, 0) + void attachPopup(QtWaylandClient::QWaylandShellSurface *popup) override; +#endif void setAnchor(uint32_t anchor); void setExclusiveZone(int32_t zone);