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: outfoxxed
GPG key ID: 4C88A185FB89301E
4 changed files with 16 additions and 2 deletions

View file

@ -26,7 +26,7 @@
}: stdenv.mkDerivation { }: stdenv.mkDerivation {
pname = "quickshell${lib.optionalString debug "-debug"}"; pname = "quickshell${lib.optionalString debug "-debug"}";
version = "0.1.0"; version = "0.1.0";
src = nix-gitignore.gitignoreSource [] ./.; src = nix-gitignore.gitignoreSource "/docs\n/examples\n" ./.;
nativeBuildInputs = with pkgs; [ nativeBuildInputs = with pkgs; [
cmake cmake

2
docs

@ -1 +1 @@
Subproject commit 70989dc619bcdc29dc4880b4ff5257d6ad188a18 Subproject commit b218d3ec30f8ff2c51d4caf17509b9d21cf0c088

View file

@ -1,4 +1,5 @@
#include "surface.hpp" #include "surface.hpp"
#include <any>
#include <private/qwaylanddisplay_p.h> #include <private/qwaylanddisplay_p.h>
#include <private/qwaylandscreen_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() 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.";
}
}

View file

@ -27,6 +27,8 @@ public:
void applyConfigure() override; void applyConfigure() override;
void setWindowGeometry(const QRect& geometry) override; void setWindowGeometry(const QRect& geometry) override;
void attachPopup(QtWaylandClient::QWaylandShellSurface* popup) override;
private: private:
void zwlr_layer_surface_v1_configure(quint32 serial, quint32 width, quint32 height) override; void zwlr_layer_surface_v1_configure(quint32 serial, quint32 width, quint32 height) override;
void zwlr_layer_surface_v1_closed() override; void zwlr_layer_surface_v1_closed() override;