From 8b81f41e52b55835aaaa7e4962af23a00188cbdc Mon Sep 17 00:00:00 2001 From: Vaxry <43317083+vaxerski@users.noreply.github.com> Date: Mon, 27 Feb 2023 12:32:38 +0000 Subject: Plugin System (#1590) --------- Co-authored-by: Mihai Fufezan --- src/plugins/PluginSystem.hpp | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 src/plugins/PluginSystem.hpp (limited to 'src/plugins/PluginSystem.hpp') diff --git a/src/plugins/PluginSystem.hpp b/src/plugins/PluginSystem.hpp new file mode 100644 index 00000000..041ee47e --- /dev/null +++ b/src/plugins/PluginSystem.hpp @@ -0,0 +1,44 @@ +#pragma once + +#include "../defines.hpp" +#include "PluginAPI.hpp" +#include + +class IHyprWindowDecoration; + +class CPlugin { + public: + std::string name = ""; + std::string description = ""; + std::string author = ""; + std::string version = ""; + + std::string path = ""; + + HANDLE m_pHandle = nullptr; + + std::vector registeredLayouts; + std::vector registeredDecorations; + std::vector> registeredCallbacks; + std::vector registeredDispatchers; +}; + +class CPluginSystem { + public: + CPluginSystem(); + + CPlugin* loadPlugin(const std::string& path); + void unloadPlugin(const CPlugin* plugin, bool eject = false); + CPlugin* getPluginByPath(const std::string& path); + CPlugin* getPluginByHandle(HANDLE handle); + std::vector getAllPlugins(); + + bool m_bAllowConfigVars = false; + + private: + std::vector> m_vLoadedPlugins; + + jmp_buf m_jbPluginFaultJumpBuf; +}; + +inline std::unique_ptr g_pPluginSystem; \ No newline at end of file -- cgit v1.2.3