layershell: fix protocol error on popup attachment

This commit is contained in:
outfoxxed 2024-03-10 03:02:40 -07:00
parent 5f9bb9b46c
commit 7a15495e3f
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
4 changed files with 16 additions and 2 deletions

View file

@ -1,4 +1,5 @@
#include "surface.hpp"
#include <any>
#include <private/qwaylanddisplay_p.h>
#include <private/qwaylandscreen_p.h>
@ -165,3 +166,14 @@ QSize constrainedSize(const Anchors& anchors, const QSize& size) noexcept {
anchors.verticalConstraint() ? 0 : size.height()
);
}
void QSWaylandLayerSurface::attachPopup(QtWaylandClient::QWaylandShellSurface* popup) {
std::any role = popup->surfaceRole();
if (auto* popupRole = std::any_cast<::xdg_popup*>(&role)) { // NOLINT
this->get_popup(*popupRole);
} else {
qWarning() << "Cannot attach popup" << popup << "to shell surface" << this
<< "as the popup is not an xdg_popup.";
}
}