2024-05-25 22:43:51 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
#include <cstdint>
|
|
|
|
#include "WaylandProtocol.hpp"
|
|
|
|
#include "xwayland-shell-v1.hpp"
|
|
|
|
#include "../helpers/signal/Signal.hpp"
|
|
|
|
|
2024-06-08 10:07:59 +02:00
|
|
|
class CWLSurfaceResource;
|
|
|
|
|
2024-05-25 22:43:51 +02:00
|
|
|
class CXWaylandSurfaceResource {
|
|
|
|
public:
|
2024-06-08 10:07:59 +02:00
|
|
|
CXWaylandSurfaceResource(SP<CXwaylandSurfaceV1> resource_, SP<CWLSurfaceResource> surface_);
|
2024-05-25 22:43:51 +02:00
|
|
|
~CXWaylandSurfaceResource();
|
|
|
|
|
|
|
|
bool good();
|
|
|
|
wl_client* client();
|
|
|
|
|
|
|
|
struct {
|
|
|
|
CSignal destroy;
|
|
|
|
} events;
|
|
|
|
|
2024-06-08 10:07:59 +02:00
|
|
|
uint64_t serial = 0;
|
|
|
|
WP<CWLSurfaceResource> surface;
|
2024-05-25 22:43:51 +02:00
|
|
|
|
|
|
|
WP<CXWaylandSurfaceResource> self;
|
|
|
|
|
|
|
|
private:
|
|
|
|
SP<CXwaylandSurfaceV1> resource;
|
|
|
|
wl_client* pClient = nullptr;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CXWaylandShellResource {
|
|
|
|
public:
|
|
|
|
CXWaylandShellResource(SP<CXwaylandShellV1> resource_);
|
|
|
|
|
|
|
|
bool good();
|
|
|
|
|
|
|
|
private:
|
|
|
|
SP<CXwaylandShellV1> resource;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CXWaylandShellProtocol : public IWaylandProtocol {
|
|
|
|
public:
|
|
|
|
CXWaylandShellProtocol(const wl_interface* iface, const int& ver, const std::string& name);
|
|
|
|
|
|
|
|
virtual void bindManager(wl_client* client, void* data, uint32_t ver, uint32_t id);
|
|
|
|
|
|
|
|
struct {
|
|
|
|
CSignal newSurface; // SP<CXWaylandSurfaceResource>. Fired when it sets a serial, otherwise it's useless
|
|
|
|
} events;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void destroyResource(CXWaylandSurfaceResource* resource);
|
|
|
|
void destroyResource(CXWaylandShellResource* resource);
|
|
|
|
|
|
|
|
//
|
|
|
|
std::vector<SP<CXWaylandShellResource>> m_vManagers;
|
|
|
|
std::vector<SP<CXWaylandSurfaceResource>> m_vSurfaces;
|
|
|
|
|
|
|
|
friend class CXWaylandSurfaceResource;
|
|
|
|
friend class CXWaylandShellResource;
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace PROTO {
|
|
|
|
inline UP<CXWaylandShellProtocol> xwaylandShell;
|
|
|
|
};
|