2024-04-24 16:45:59 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
#include <vector>
|
|
|
|
#include <unordered_map>
|
|
|
|
#include "WaylandProtocol.hpp"
|
|
|
|
#include "ext-foreign-toplevel-list-v1.hpp"
|
|
|
|
|
|
|
|
class CForeignToplevelHandle {
|
|
|
|
public:
|
2024-04-27 13:43:12 +02:00
|
|
|
CForeignToplevelHandle(SP<CExtForeignToplevelHandleV1> resource_, PHLWINDOW pWindow);
|
2024-04-24 16:45:59 +02:00
|
|
|
|
2024-04-27 13:43:12 +02:00
|
|
|
bool good();
|
|
|
|
PHLWINDOW window();
|
2024-04-24 16:45:59 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
SP<CExtForeignToplevelHandleV1> resource;
|
2024-04-27 13:43:12 +02:00
|
|
|
PHLWINDOWREF pWindow;
|
|
|
|
bool closed = false;
|
2024-04-24 16:45:59 +02:00
|
|
|
|
|
|
|
friend class CForeignToplevelList;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CForeignToplevelList {
|
|
|
|
public:
|
|
|
|
CForeignToplevelList(SP<CExtForeignToplevelListV1> resource_);
|
|
|
|
|
2024-04-27 13:43:12 +02:00
|
|
|
void onMap(PHLWINDOW pWindow);
|
|
|
|
void onTitle(PHLWINDOW pWindow);
|
|
|
|
void onClass(PHLWINDOW pWindow);
|
|
|
|
void onUnmap(PHLWINDOW pWindow);
|
2024-04-24 16:45:59 +02:00
|
|
|
|
|
|
|
bool good();
|
|
|
|
|
|
|
|
private:
|
|
|
|
SP<CExtForeignToplevelListV1> resource;
|
|
|
|
bool finished = false;
|
|
|
|
|
2024-04-27 13:43:12 +02:00
|
|
|
SP<CForeignToplevelHandle> handleForWindow(PHLWINDOW pWindow);
|
2024-04-24 16:45:59 +02:00
|
|
|
|
|
|
|
std::vector<WP<CForeignToplevelHandle>> handles;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CForeignToplevelProtocol : public IWaylandProtocol {
|
|
|
|
public:
|
|
|
|
CForeignToplevelProtocol(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);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void onManagerResourceDestroy(CForeignToplevelList* mgr);
|
|
|
|
void destroyHandle(CForeignToplevelHandle* handle);
|
|
|
|
|
|
|
|
//
|
|
|
|
std::vector<UP<CForeignToplevelList>> m_vManagers;
|
|
|
|
std::vector<SP<CForeignToplevelHandle>> m_vHandles;
|
|
|
|
|
|
|
|
friend class CForeignToplevelList;
|
|
|
|
friend class CForeignToplevelHandle;
|
|
|
|
};
|
|
|
|
|
|
|
|
namespace PROTO {
|
|
|
|
inline UP<CForeignToplevelProtocol> foreignToplevel;
|
|
|
|
};
|