summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/PluginAPI.cpp9
-rw-r--r--src/plugins/PluginAPI.hpp2
2 files changed, 5 insertions, 6 deletions
diff --git a/src/plugins/PluginAPI.cpp b/src/plugins/PluginAPI.cpp
index 1395728d..283472fa 100644
--- a/src/plugins/PluginAPI.cpp
+++ b/src/plugins/PluginAPI.cpp
@@ -111,7 +111,7 @@ APICALL bool HyprlandAPI::removeFunctionHook(HANDLE handle, CFunctionHook* hook)
return g_pFunctionHookSystem->removeHook(hook);
}
-APICALL bool HyprlandAPI::addWindowDecoration(HANDLE handle, CWindow* pWindow, IHyprWindowDecoration* pDecoration) {
+APICALL bool HyprlandAPI::addWindowDecoration(HANDLE handle, CWindow* pWindow, std::unique_ptr<IHyprWindowDecoration> pDecoration) {
auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle);
if (!PLUGIN)
@@ -120,11 +120,10 @@ APICALL bool HyprlandAPI::addWindowDecoration(HANDLE handle, CWindow* pWindow, I
if (!g_pCompositor->windowValidMapped(pWindow))
return false;
- PLUGIN->registeredDecorations.push_back(pDecoration);
+ PLUGIN->registeredDecorations.push_back(pDecoration.get());
- pWindow->m_dWindowDecorations.emplace_back(pDecoration);
+ pWindow->addWindowDeco(std::move(pDecoration));
- pWindow->updateWindowDecos();
g_pLayoutManager->getCurrentLayout()->recalculateWindow(pWindow);
return true;
@@ -139,7 +138,7 @@ APICALL bool HyprlandAPI::removeWindowDecoration(HANDLE handle, IHyprWindowDecor
for (auto& w : g_pCompositor->m_vWindows) {
for (auto& d : w->m_dWindowDecorations) {
if (d.get() == pDecoration) {
- std::erase(w->m_dWindowDecorations, d);
+ w->removeWindowDeco(pDecoration);
return true;
}
}
diff --git a/src/plugins/PluginAPI.hpp b/src/plugins/PluginAPI.hpp
index a3792fe9..12e7c128 100644
--- a/src/plugins/PluginAPI.hpp
+++ b/src/plugins/PluginAPI.hpp
@@ -221,7 +221,7 @@ namespace HyprlandAPI {
returns: true on success. False otherwise.
*/
- APICALL bool addWindowDecoration(HANDLE handle, CWindow* pWindow, IHyprWindowDecoration* pDecoration);
+ APICALL bool addWindowDecoration(HANDLE handle, CWindow* pWindow, std::unique_ptr<IHyprWindowDecoration> pDecoration);
/*
Removes a window decoration