mirror of
https://github.com/WarmUpTill/SceneSwitcher.git
synced 2026-03-21 17:34:57 -05:00
Enable detection of user holding down hotkey
Previously only the key down event would trigger the condition
This commit is contained in:
parent
f3e5fb59f3
commit
c07ef3c699
|
|
@ -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<MacroConditionHotkey *>(data);
|
||||
auto macro = c->GetMacro();
|
||||
if (!macro) {
|
||||
c->SetPressed();
|
||||
}
|
||||
if (macro && !macro->Paused()) {
|
||||
c->SetPressed();
|
||||
}
|
||||
auto hotkeyCondition = static_cast<MacroConditionHotkey *>(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)
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public:
|
|||
{
|
||||
return std::make_shared<MacroConditionHotkey>(m);
|
||||
}
|
||||
void SetPressed() { _pressed = true; }
|
||||
void SetPressed(bool value) { _pressed = value; }
|
||||
|
||||
std::string _name;
|
||||
obs_hotkey_id _hotkeyID = OBS_INVALID_HOTKEY_ID;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user