Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
From 720df2595e65185d9ebea505beb709dd1145a6d5 Mon Sep 17 00:00:00 2001
From: lfdevs <lfdevs@lfdevs.com>
Date: Thu, 23 Jul 2026 13:49:32 +0800
Subject: [PATCH] Fix popup attachment with libc++

Avoid using std::any_cast to retrieve the xdg_popup role, as libc++
RTTI comparison can fail across shared modules loaded with RTLD_LOCAL.

Retrieve the popup through Qt's platform native interface instead,
preventing Plasma context menus from causing a Wayland protocol error.

Related URLs:
* https://bugs.kde.org/show_bug.cgi?id=479679
* https://github.com/llvm/llvm-project/issues/36746
* https://github.com/freebsd/freebsd-ports/pull/431
---
src/qwaylandlayersurface.cpp | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/qwaylandlayersurface.cpp b/src/qwaylandlayersurface.cpp
index 1d12b05..dbca343 100644
--- a/src/qwaylandlayersurface.cpp
+++ b/src/qwaylandlayersurface.cpp
@@ -16,6 +16,7 @@
#include <QtWaylandClient/private/qwaylandwindow_p.h>

#include <QGuiApplication>
+#include <qpa/qplatformnativeinterface.h>

namespace LayerShellQt
{
@@ -119,10 +120,13 @@ void QWaylandLayerSurface::zwlr_layer_surface_v1_configure(uint32_t serial, uint

void QWaylandLayerSurface::attachPopup(QtWaylandClient::QWaylandShellSurface *popup)
{
- std::any anyRole = popup->surfaceRole();
+ auto *nativeInterface = QGuiApplication::platformNativeInterface();
+ void *role = nativeInterface
+ ? nativeInterface->nativeResourceForWindow("xdg_popup", popup->window()->window())
+ : nullptr;

- if (auto role = std::any_cast<::xdg_popup *>(&anyRole)) {
- get_popup(*role);
+ if (role) {
+ get_popup(static_cast<::xdg_popup *>(role));
} else {
qCWarning(LAYERSHELLQT) << "Cannot attach popup of unknown type";
}
--
2.47.3

1 change: 1 addition & 0 deletions x11-packages/layer-shell-qt/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ TERMUX_PKG_DESCRIPTION="Qt component to allow applications to make use of the Wa
TERMUX_PKG_LICENSE="LGPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="6.7.3"
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://download.kde.org/stable/plasma/${TERMUX_PKG_VERSION}/layer-shell-qt-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=51924fa14d05320eacef8defea51895c96117bc89dd709e74536dd8ecdfb4581
TERMUX_PKG_AUTO_UPDATE=true
Expand Down