Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion source/ButtonComboInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,12 @@ bool ButtonComboInfoIF::conflictsWith(const ButtonComboModule_ButtonComboOptions
if ((mControllerMask & other.controllerMask) == 0) {
return false;
}

// No conflicts when either button combo is empty.
if (!other.combo || !mCombo) {
return false;
}

if ((other.combo & mCombo) == mCombo || (other.combo & mCombo) == other.combo) {
return true;
}
Expand Down Expand Up @@ -141,4 +147,4 @@ int32_t ButtonComboInfoIF::ControllerTypeToChanIndex(const ButtonComboModule_Con
}

return -1;
}
}
9 changes: 2 additions & 7 deletions source/ButtonComboManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -288,11 +288,6 @@ std::optional<std::shared_ptr<ButtonComboInfoIF>> ButtonComboManager::CreateComb
err = BUTTON_COMBO_MODULE_ERROR_INCOMPATIBLE_OPTIONS_VERSION;
return std::nullopt;
}
if (options.buttonComboOptions.basicCombo.combo == 0 ||
options.buttonComboOptions.basicCombo.controllerMask == BUTTON_COMBO_MODULE_CONTROLLER_NONE) {
err = BUTTON_COMBO_MODULE_ERROR_INVALID_COMBO;
return std::nullopt;
}
if (options.callbackOptions.callback == nullptr) {
err = BUTTON_COMBO_MODULE_ERROR_INVALID_ARGUMENT;
return std::nullopt;
Expand All @@ -302,7 +297,7 @@ std::optional<std::shared_ptr<ButtonComboInfoIF>> ButtonComboManager::CreateComb
switch (options.buttonComboOptions.type) {
case BUTTON_COMBO_MODULE_COMBO_TYPE_HOLD_OBSERVER:
observer = true;
__attribute__((fallthrough));
[[fallthrough]];
case BUTTON_COMBO_MODULE_COMBO_TYPE_HOLD: {
if (options.buttonComboOptions.optionalHoldForXMs == 0) {
err = BUTTON_COMBO_MODULE_ERROR_DURATION_MISSING;
Expand All @@ -319,7 +314,7 @@ std::optional<std::shared_ptr<ButtonComboInfoIF>> ButtonComboManager::CreateComb
}
case BUTTON_COMBO_MODULE_COMBO_TYPE_PRESS_DOWN_OBSERVER:
observer = true;
__attribute__((fallthrough));
[[fallthrough]];
case BUTTON_COMBO_MODULE_COMBO_TYPE_PRESS_DOWN: {
err = BUTTON_COMBO_MODULE_ERROR_SUCCESS;
return std::make_shared<ButtonComboInfoDown>(options.metaOptions.label,
Expand Down