diff --git a/src/macro-core/macro-condition-hotkey.cpp b/src/macro-core/macro-condition-hotkey.cpp index 5becfd26..0aed7239 100644 --- a/src/macro-core/macro-condition-hotkey.cpp +++ b/src/macro-core/macro-condition-hotkey.cpp @@ -12,15 +12,12 @@ bool MacroConditionHotkey::_registered = MacroConditionFactory::Register( static void hotkeyCB(void *data, obs_hotkey_id, obs_hotkey_t *, bool pressed) { - if (pressed) { - auto c = static_cast(data); - auto macro = c->GetMacro(); - if (!macro) { - c->SetPressed(); - } - if (macro && !macro->Paused()) { - c->SetPressed(); - } + auto hotkeyCondition = static_cast(data); + auto macro = hotkeyCondition->GetMacro(); + if (macro) { + hotkeyCondition->SetPressed(pressed && !macro->Paused()); + } else { + hotkeyCondition->SetPressed(pressed); } } @@ -49,11 +46,7 @@ MacroConditionHotkey::~MacroConditionHotkey() bool MacroConditionHotkey::CheckCondition() { - if (_pressed) { - _pressed = false; - return true; - } - return false; + return _pressed; } bool MacroConditionHotkey::Save(obs_data_t *obj) diff --git a/src/macro-core/macro-condition-hotkey.hpp b/src/macro-core/macro-condition-hotkey.hpp index 463e3f9c..d13f8d96 100644 --- a/src/macro-core/macro-condition-hotkey.hpp +++ b/src/macro-core/macro-condition-hotkey.hpp @@ -15,7 +15,7 @@ public: { return std::make_shared(m); } - void SetPressed() { _pressed = true; } + void SetPressed(bool value) { _pressed = value; } std::string _name; obs_hotkey_id _hotkeyID = OBS_INVALID_HOTKEY_ID;