diff --git a/lib/macro/macro-helpers.hpp b/lib/macro/macro-helpers.hpp index 642febf6..e247d102 100644 --- a/lib/macro/macro-helpers.hpp +++ b/lib/macro/macro-helpers.hpp @@ -48,7 +48,8 @@ EXPORT int64_t MillisecondsSinceMacroConditionCheck(Macro *); EXPORT bool MacroIsStopped(Macro *); EXPORT bool MacroIsPaused(Macro *); EXPORT bool -MacroWasPausedSince(Macro *, const std::chrono::high_resolution_clock::time_point &); +MacroWasPausedSince(Macro *, + const std::chrono::high_resolution_clock::time_point &); EXPORT void AddMacroHelperThread(Macro *, std::thread &&); diff --git a/plugins/base/macro-condition-hotkey.cpp b/plugins/base/macro-condition-hotkey.cpp index 76a5ebc1..b145a85e 100644 --- a/plugins/base/macro-condition-hotkey.cpp +++ b/plugins/base/macro-condition-hotkey.cpp @@ -1,5 +1,6 @@ #include "macro-condition-hotkey.hpp" #include "layout-helpers.hpp" +#include "macro-helpers.hpp" namespace advss { @@ -22,8 +23,14 @@ MacroConditionHotkey::MacroConditionHotkey(Macro *m) : MacroCondition(m) bool MacroConditionHotkey::CheckCondition() { - bool ret = _hotkey->GetPressed() || - _hotkey->GetLastPressed() > _lastCheck; + const bool hotkeyIsCurrentlyPressed = _hotkey->GetPressed(); + const bool hotkeyWasPressedSinceLastCheck = _hotkey->GetLastPressed() > + _lastCheck; + const bool macroWasPausedSinceLastCheck = + MacroWasPausedSince(GetMacro(), _lastCheck); + bool ret = hotkeyIsCurrentlyPressed || + (hotkeyWasPressedSinceLastCheck && + !macroWasPausedSinceLastCheck); _lastCheck = std::chrono::high_resolution_clock::now(); return ret; }