[Shortcut Guide] Activate with Windows key press (#13342)

* [Shortcut Guide] Activate with Windows key press

* fix spellchecker

* pr comments: fix search and add lock

* Add activation method combo box

* fix spellchecker issue for customized

* Standardize centralized hotkeys file names

* Add warning when using the long win key method

* Address PR feedback on text

* More PR feedback
This commit is contained in:
Jaime Bernardo
2021-09-23 14:23:22 +01:00
committed by GitHub
parent a0ebe5ed54
commit f647223e94
15 changed files with 308 additions and 20 deletions

View File

@@ -0,0 +1,45 @@
#pragma once
#include <Windows.h>
#include <functional>
namespace CentralizedHotkeys
{
struct Action
{
std::wstring moduleName;
std::function<void(WORD, WORD)> action;
Action(std::wstring moduleName = L"", std::function<void(WORD, WORD)> action = ([](WORD modifiersMask, WORD vkCode) {}))
{
this->moduleName = moduleName;
this->action = action;
}
};
struct Shortcut
{
WORD modifiersMask;
WORD vkCode;
Shortcut(WORD modifiersMask = 0, WORD vkCode = 0)
{
this->modifiersMask = modifiersMask;
this->vkCode = vkCode;
}
bool operator<(const Shortcut& key) const
{
return std::pair<WORD, WORD>{ this->modifiersMask, this->vkCode } < std::pair<WORD, WORD>{ key.modifiersMask, key.vkCode };
}
};
std::wstring ToWstring(const Shortcut& shortcut);
bool AddHotkeyAction(Shortcut shortcut, Action action);
void UnregisterHotkeysForModule(std::wstring moduleName);
void PopulateHotkey(Shortcut shortcut);
void RegisterWindow(HWND hwnd);
}