aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/plugins
diff options
context:
space:
mode:
authorVaxry <[email protected]>2024-04-27 12:43:12 +0100
committerGitHub <[email protected]>2024-04-27 12:43:12 +0100
commitbca7804bb6e1bf5ce5a99b9ae4806be25e36993c (patch)
treeebd3a578de1dfe11b54f9440cfc3a408ffa6a620 /src/plugins
parent25aec3ac8ce65ed224f025f8f6dfef73780577a4 (diff)
downloadHyprland-bca7804bb6e1bf5ce5a99b9ae4806be25e36993c.tar.gz
Hyprland-bca7804bb6e1bf5ce5a99b9ae4806be25e36993c.zip
internal: Window storage rework - part 1 (#5762)
* Window storage rework - part 1 * format * remove useless include * fix pch * format * fix crash in dwindle * fix vram leak * prefer .expired() for bool checks
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/PluginAPI.cpp4
-rw-r--r--src/plugins/PluginAPI.hpp6
-rw-r--r--src/plugins/PluginSystem.cpp4
3 files changed, 9 insertions, 5 deletions
diff --git a/src/plugins/PluginAPI.cpp b/src/plugins/PluginAPI.cpp
index 4f40694c..3266579b 100644
--- a/src/plugins/PluginAPI.cpp
+++ b/src/plugins/PluginAPI.cpp
@@ -99,13 +99,13 @@ APICALL bool HyprlandAPI::removeFunctionHook(HANDLE handle, CFunctionHook* hook)
return g_pFunctionHookSystem->removeHook(hook);
}
-APICALL bool HyprlandAPI::addWindowDecoration(HANDLE handle, CWindow* pWindow, std::unique_ptr<IHyprWindowDecoration> pDecoration) {
+APICALL bool HyprlandAPI::addWindowDecoration(HANDLE handle, PHLWINDOW pWindow, std::unique_ptr<IHyprWindowDecoration> pDecoration) {
auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle);
if (!PLUGIN)
return false;
- if (!g_pCompositor->windowValidMapped(pWindow))
+ if (!validMapped(pWindow))
return false;
PLUGIN->registeredDecorations.push_back(pDecoration.get());
diff --git a/src/plugins/PluginAPI.hpp b/src/plugins/PluginAPI.hpp
index 78f88c21..df04efbe 100644
--- a/src/plugins/PluginAPI.hpp
+++ b/src/plugins/PluginAPI.hpp
@@ -61,6 +61,10 @@ class IHyprLayout;
class CWindow;
class IHyprWindowDecoration;
struct SConfigValue;
+class CWindow;
+
+typedef std::shared_ptr<CWindow> PHLWINDOW;
+typedef std::weak_ptr<CWindow> PHLWINDOWREF;
/*
These methods are for the plugin to implement
@@ -219,7 +223,7 @@ namespace HyprlandAPI {
returns: true on success. False otherwise.
*/
- APICALL bool addWindowDecoration(HANDLE handle, CWindow* pWindow, std::unique_ptr<IHyprWindowDecoration> pDecoration);
+ APICALL bool addWindowDecoration(HANDLE handle, PHLWINDOW pWindow, std::unique_ptr<IHyprWindowDecoration> pDecoration);
/*
Removes a window decoration
diff --git a/src/plugins/PluginSystem.cpp b/src/plugins/PluginSystem.cpp
index 1703222b..d813a32e 100644
--- a/src/plugins/PluginSystem.cpp
+++ b/src/plugins/PluginSystem.cpp
@@ -97,8 +97,8 @@ void CPluginSystem::unloadPlugin(const CPlugin* plugin, bool eject) {
}
for (auto& [k, v] : plugin->registeredCallbacks) {
- if (const auto SP = v.lock())
- g_pHookSystem->unhook(SP);
+ if (const auto SHP = v.lock())
+ g_pHookSystem->unhook(SHP);
}
const auto ls = plugin->registeredLayouts;