core: move all shared_ptrs from the STL to hyprutils (#9143)
This commit is contained in:
parent
ae403e6a05
commit
0a1ae48a9f
152 changed files with 297 additions and 349 deletions
|
|
@ -253,7 +253,7 @@ bool CFunctionHook::unhook() {
|
|||
}
|
||||
|
||||
CFunctionHook* CHookSystem::initHook(HANDLE owner, void* source, void* destination) {
|
||||
return m_vHooks.emplace_back(std::make_unique<CFunctionHook>(owner, source, destination)).get();
|
||||
return m_vHooks.emplace_back(makeUnique<CFunctionHook>(owner, source, destination)).get();
|
||||
}
|
||||
|
||||
bool CHookSystem::removeHook(CFunctionHook* hook) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include "../helpers/memory/Memory.hpp"
|
||||
|
||||
#define HANDLE void*
|
||||
#define HOOK_TRAMPOLINE_MAX_SIZE 64
|
||||
|
|
@ -60,9 +60,9 @@ class CHookSystem {
|
|||
void removeAllHooksFrom(HANDLE handle);
|
||||
|
||||
private:
|
||||
std::vector<std::unique_ptr<CFunctionHook>> m_vHooks;
|
||||
std::vector<UP<CFunctionHook>> m_vHooks;
|
||||
|
||||
uint64_t getAddressForTrampo();
|
||||
uint64_t getAddressForTrampo();
|
||||
|
||||
struct SAllocatedPage {
|
||||
uint64_t addr = 0;
|
||||
|
|
@ -75,4 +75,4 @@ class CHookSystem {
|
|||
friend class CFunctionHook;
|
||||
};
|
||||
|
||||
inline std::unique_ptr<CHookSystem> g_pFunctionHookSystem;
|
||||
inline UP<CHookSystem> g_pFunctionHookSystem;
|
||||
|
|
@ -106,7 +106,7 @@ APICALL bool HyprlandAPI::removeFunctionHook(HANDLE handle, CFunctionHook* hook)
|
|||
return g_pFunctionHookSystem->removeHook(hook);
|
||||
}
|
||||
|
||||
APICALL bool HyprlandAPI::addWindowDecoration(HANDLE handle, PHLWINDOW pWindow, std::unique_ptr<IHyprWindowDecoration> pDecoration) {
|
||||
APICALL bool HyprlandAPI::addWindowDecoration(HANDLE handle, PHLWINDOW pWindow, UP<IHyprWindowDecoration> pDecoration) {
|
||||
auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle);
|
||||
|
||||
if (!PLUGIN)
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ namespace HyprlandAPI {
|
|||
|
||||
returns: true on success. False otherwise.
|
||||
*/
|
||||
APICALL bool addWindowDecoration(HANDLE handle, PHLWINDOW pWindow, std::unique_ptr<IHyprWindowDecoration> pDecoration);
|
||||
APICALL bool addWindowDecoration(HANDLE handle, PHLWINDOW pWindow, UP<IHyprWindowDecoration> pDecoration);
|
||||
|
||||
/*
|
||||
Removes a window decoration
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@
|
|||
#include "../managers/eventLoop/EventLoopManager.hpp"
|
||||
|
||||
CPluginSystem::CPluginSystem() {
|
||||
g_pFunctionHookSystem = std::make_unique<CHookSystem>();
|
||||
g_pFunctionHookSystem = makeUnique<CHookSystem>();
|
||||
}
|
||||
|
||||
CPlugin* CPluginSystem::loadPlugin(const std::string& path) {
|
||||
|
|
@ -21,7 +21,7 @@ CPlugin* CPluginSystem::loadPlugin(const std::string& path) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
auto* const PLUGIN = m_vLoadedPlugins.emplace_back(std::make_unique<CPlugin>()).get();
|
||||
auto* const PLUGIN = m_vLoadedPlugins.emplace_back(makeUnique<CPlugin>()).get();
|
||||
|
||||
PLUGIN->path = path;
|
||||
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ class CPluginSystem {
|
|||
std::string m_szLastError = "";
|
||||
|
||||
private:
|
||||
std::vector<std::unique_ptr<CPlugin>> m_vLoadedPlugins;
|
||||
std::vector<UP<CPlugin>> m_vLoadedPlugins;
|
||||
|
||||
jmp_buf m_jbPluginFaultJumpBuf;
|
||||
jmp_buf m_jbPluginFaultJumpBuf;
|
||||
};
|
||||
|
||||
inline std::unique_ptr<CPluginSystem> g_pPluginSystem;
|
||||
inline UP<CPluginSystem> g_pPluginSystem;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue