pluginAPI: add register dispatcher v2
This commit is contained in:
parent
fd67ee9ecd
commit
71dc9f6128
4 changed files with 30 additions and 7 deletions
|
|
@ -202,6 +202,19 @@ APICALL bool HyprlandAPI::addDispatcher(HANDLE handle, const std::string& name,
|
|||
return true;
|
||||
}
|
||||
|
||||
APICALL bool HyprlandAPI::addDispatcherV2(HANDLE handle, const std::string& name, std::function<SDispatchResult(std::string)> handler) {
|
||||
auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle);
|
||||
|
||||
if (!PLUGIN)
|
||||
return false;
|
||||
|
||||
PLUGIN->registeredDispatchers.push_back(name);
|
||||
|
||||
g_pKeybindManager->m_mDispatchers[name] = handler;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
APICALL bool HyprlandAPI::removeDispatcher(HANDLE handle, const std::string& name) {
|
||||
auto* const PLUGIN = g_pPluginSystem->getPluginByHandle(handle);
|
||||
|
||||
|
|
|
|||
|
|
@ -236,8 +236,17 @@ namespace HyprlandAPI {
|
|||
Adds a keybind dispatcher.
|
||||
|
||||
returns: true on success. False otherwise.
|
||||
|
||||
DEPRECATED: use addDispatcherV2
|
||||
*/
|
||||
APICALL bool addDispatcher(HANDLE handle, const std::string& name, std::function<void(std::string)> handler);
|
||||
APICALL [[deprecated]] bool addDispatcher(HANDLE handle, const std::string& name, std::function<void(std::string)> handler);
|
||||
|
||||
/*
|
||||
Adds a keybind dispatcher.
|
||||
|
||||
returns: true on success. False otherwise.
|
||||
*/
|
||||
APICALL bool addDispatcherV2(HANDLE handle, const std::string& name, std::function<SDispatchResult(std::string)> handler);
|
||||
|
||||
/*
|
||||
Removes a keybind dispatcher.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue