From 7a15495e3fc30befb871760f7a0022ecc72161c2 Mon Sep 17 00:00:00 2001 From: outfoxxed Date: Sun, 10 Mar 2024 03:02:40 -0700 Subject: [PATCH] layershell: fix protocol error on popup attachment --- default.nix | 2 +- docs | 2 +- src/wayland/wlr_layershell/surface.cpp | 12 ++++++++++++ src/wayland/wlr_layershell/surface.hpp | 2 ++ 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/default.nix b/default.nix index 4fa9326..a265540 100644 --- a/default.nix +++ b/default.nix @@ -26,7 +26,7 @@ }: stdenv.mkDerivation { pname = "quickshell${lib.optionalString debug "-debug"}"; version = "0.1.0"; - src = nix-gitignore.gitignoreSource [] ./.; + src = nix-gitignore.gitignoreSource "/docs\n/examples\n" ./.; nativeBuildInputs = with pkgs; [ cmake diff --git a/docs b/docs index 70989dc..b218d3e 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 70989dc619bcdc29dc4880b4ff5257d6ad188a18 +Subproject commit b218d3ec30f8ff2c51d4caf17509b9d21cf0c088 diff --git a/src/wayland/wlr_layershell/surface.cpp b/src/wayland/wlr_layershell/surface.cpp index d9a6040..b07c831 100644 --- a/src/wayland/wlr_layershell/surface.cpp +++ b/src/wayland/wlr_layershell/surface.cpp @@ -1,4 +1,5 @@ #include "surface.hpp" +#include #include #include @@ -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."; + } +} diff --git a/src/wayland/wlr_layershell/surface.hpp b/src/wayland/wlr_layershell/surface.hpp index e3a8d9b..c58e349 100644 --- a/src/wayland/wlr_layershell/surface.hpp +++ b/src/wayland/wlr_layershell/surface.hpp @@ -27,6 +27,8 @@ public: void applyConfigure() override; void setWindowGeometry(const QRect& geometry) override; + void attachPopup(QtWaylandClient::QWaylandShellSurface* popup) override; + private: void zwlr_layer_surface_v1_configure(quint32 serial, quint32 width, quint32 height) override; void zwlr_layer_surface_v1_closed() override;