#pragma once #include #include #include #include "WaylandProtocol.hpp" #include "ext-foreign-toplevel-list-v1.hpp" class CForeignToplevelHandle { public: CForeignToplevelHandle(SP resource_, PHLWINDOW pWindow); bool good(); PHLWINDOW window(); private: SP resource; PHLWINDOWREF pWindow; bool closed = false; friend class CForeignToplevelList; }; class CForeignToplevelList { public: CForeignToplevelList(SP resource_); void onMap(PHLWINDOW pWindow); void onTitle(PHLWINDOW pWindow); void onClass(PHLWINDOW pWindow); void onUnmap(PHLWINDOW pWindow); bool good(); private: SP resource; bool finished = false; SP handleForWindow(PHLWINDOW pWindow); std::vector> 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); bool windowValidForForeign(PHLWINDOW pWindow); // std::vector> m_vManagers; std::vector> m_vHandles; friend class CForeignToplevelList; friend class CForeignToplevelHandle; }; namespace PROTO { inline UP foreignToplevel; };