File indexing completed on 2024-07-21 04:58:22

0001 /*
0002  *   SPDX-FileCopyrightText: 2021 Aleix Pol Gonzalez <aleixpol@blue-systems.com>
0003  *   SPDX-FileCopyrightText: 2018 Drew DeVault <sir@cmpwn.com>
0004  *
0005  *   SPDX-License-Identifier: LGPL-3.0-or-later
0006  */
0007 
0008 #ifndef _LAYERSURFACE_H
0009 #define _LAYERSURFACE_H
0010 
0011 #include <wayland-client.h>
0012 
0013 #include "qwaylandlayershellintegration_p.h"
0014 
0015 #include "layershellqt_export.h"
0016 #include <QtWaylandClient/private/qwaylandshellsurface_p.h>
0017 #include <qwayland-wlr-layer-shell-unstable-v1.h>
0018 
0019 namespace LayerShellQt
0020 {
0021 
0022 class Window;
0023 
0024 class LAYERSHELLQT_EXPORT QWaylandLayerSurface : public QtWaylandClient::QWaylandShellSurface, public QtWayland::zwlr_layer_surface_v1
0025 {
0026     Q_OBJECT
0027 public:
0028     QWaylandLayerSurface(QWaylandLayerShellIntegration *shell, QtWaylandClient::QWaylandWindow *window);
0029     ~QWaylandLayerSurface() override;
0030 
0031     bool isExposed() const override
0032     {
0033         return m_configured;
0034     }
0035     void attachPopup(QtWaylandClient::QWaylandShellSurface *popup) override;
0036 
0037     void setAnchor(uint32_t anchor);
0038     void setExclusiveZone(int32_t zone);
0039     void setExclusiveEdge(uint32_t edge);
0040     void setMargins(const QMargins &margins);
0041     void setKeyboardInteractivity(uint32_t interactivity);
0042     void setLayer(uint32_t layer);
0043 
0044     void applyConfigure() override;
0045     void setWindowGeometry(const QRect &geometry) override;
0046 
0047     bool requestActivate() override;
0048     void setXdgActivationToken(const QString &token) override;
0049     void requestXdgActivationToken(quint32 serial) override;
0050 
0051 private:
0052     void zwlr_layer_surface_v1_configure(uint32_t serial, uint32_t width, uint32_t height) override;
0053     void zwlr_layer_surface_v1_closed() override;
0054 
0055     QWaylandLayerShellIntegration *m_shell;
0056     LayerShellQt::Window *m_interface;
0057     QSize m_pendingSize;
0058     QString m_activationToken;
0059     bool m_configured = false;
0060 };
0061 
0062 }
0063 
0064 #endif