diff options
| author | Vaxry <43317083+vaxerski@users.noreply.github.com> | 2026-02-21 21:30:39 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-02-21 21:30:39 +0000 |
| commit | 723870337f299d4c80aa0048144f3a1ca1c885bd (patch) | |
| tree | ca3279ae5dbc841f676c64d2f58f895de13cd3bf /src/plugins/PluginAPI.cpp | |
| parent | 51f8849e541f0a8150ac3a43fa928c1e299daf18 (diff) | |
layout: rethonk layouts from the ground up (#12890)
Rewrites layouts to be much smaller, and deal with much less annoying
BS. Improves the overall architecture, unifies handling of pseudotiling,
and various other improvements.
Diffstat (limited to 'src/plugins/PluginAPI.cpp')
| -rw-r--r-- | src/plugins/PluginAPI.cpp | 34 |
1 files changed, 27 insertions, 7 deletions
diff --git a/src/plugins/PluginAPI.cpp b/src/plugins/PluginAPI.cpp index 2abddc90..57081183 100644 --- a/src/plugins/PluginAPI.cpp +++ b/src/plugins/PluginAPI.cpp @@ -3,10 +3,11 @@ #include "../debug/HyprCtl.hpp" #include "../plugins/PluginSystem.hpp" #include "../managers/HookSystemManager.hpp" -#include "../managers/LayoutManager.hpp" #include "../managers/eventLoop/EventLoopManager.hpp" #include "../config/ConfigManager.hpp" #include "../debug/HyprNotificationOverlay.hpp" +#include "../layout/target/Target.hpp" +#include "../layout/supplementary/WorkspaceAlgoMatcher.hpp" #include <dlfcn.h> #include <filesystem> @@ -62,25 +63,44 @@ APICALL std::string HyprlandAPI::invokeHyprctlCommand(const std::string& call, c } APICALL bool HyprlandAPI::addLayout(HANDLE handle, const std::string& name, IHyprLayout* layout) { + return false; +} + +APICALL bool HyprlandAPI::removeLayout(HANDLE handle, IHyprLayout* layout) { + return false; +} + +APICALL bool HyprlandAPI::addTiledAlgo(HANDLE handle, const std::string& name, const std::type_info* typeInfo, std::function<UP<Layout::ITiledAlgorithm>()>&& factory) { auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle); if (!PLUGIN) return false; - PLUGIN->m_registeredLayouts.push_back(layout); + PLUGIN->m_registeredAlgos.emplace_back(name); - return g_pLayoutManager->addLayout(name, layout); + return Layout::Supplementary::algoMatcher()->registerTiledAlgo(name, typeInfo, std::move(factory)); } -APICALL bool HyprlandAPI::removeLayout(HANDLE handle, IHyprLayout* layout) { +APICALL bool HyprlandAPI::addFloatingAlgo(HANDLE handle, const std::string& name, const std::type_info* typeInfo, std::function<UP<Layout::IFloatingAlgorithm>()>&& factory) { + auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle); + + if (!PLUGIN) + return false; + + PLUGIN->m_registeredAlgos.emplace_back(name); + + return Layout::Supplementary::algoMatcher()->registerFloatingAlgo(name, typeInfo, std::move(factory)); +} + +APICALL bool HyprlandAPI::removeAlgo(HANDLE handle, const std::string& name) { auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle); if (!PLUGIN) return false; - std::erase(PLUGIN->m_registeredLayouts, layout); + std::erase(PLUGIN->m_registeredAlgos, name); - return g_pLayoutManager->removeLayout(layout); + return Layout::Supplementary::algoMatcher()->unregisterAlgo(name); } APICALL bool HyprlandAPI::reloadConfig() { @@ -130,7 +150,7 @@ APICALL bool HyprlandAPI::addWindowDecoration(HANDLE handle, PHLWINDOW pWindow, pWindow->addWindowDeco(std::move(pDecoration)); - g_pLayoutManager->getCurrentLayout()->recalculateWindow(pWindow); + pWindow->layoutTarget()->recalc(); return true; } |
