Skip to content

Commit

Permalink
WUPSButtonAPI: Check the button combo status after potentially updati…
Browse files Browse the repository at this point in the history
…ng the combo
  • Loading branch information
Maschell committed Jan 5, 2025
1 parent 94ce09a commit bb6ed34
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions libraries/libwups/WUPSConfigItemButtonCombo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,11 +139,6 @@ namespace {
int32_t getCurrentValueDisplayGeneric(void *context, bool isSelected, char *out_buf, int32_t out_size) {
auto *item = static_cast<ConfigItemButtonCombo *>(context);

WUPSButtonCombo_ComboStatus comboStatus = WUPS_BUTTON_COMBO_COMBO_STATUS_INVALID_STATUS;
if (const auto res = WUPSButtonComboAPI_GetButtonComboStatus(item->comboHandle, &comboStatus); res != WUPS_BUTTON_COMBO_ERROR_SUCCESS) {
OSReport("WUPSConfigItemButtonCombo_getCurrentValueDisplayGeneric: GetButtonComboStatus returned %s\n", WUPSButtonComboAPI_GetStatusStr(res));
}

switch (item->itemState) {
case WUPS_CONFIG_ITEM_BUTTON_COMBO_STATE_INVALID_HANDLE: {
snprintf(out_buf, out_size, "ERROR: Invalid combo handle");
Expand Down Expand Up @@ -174,6 +169,11 @@ namespace {
break;
}

WUPSButtonCombo_ComboStatus comboStatus = WUPS_BUTTON_COMBO_COMBO_STATUS_INVALID_STATUS;
if (const auto res = WUPSButtonComboAPI_GetButtonComboStatus(item->comboHandle, &comboStatus); res != WUPS_BUTTON_COMBO_ERROR_SUCCESS) {
OSReport("WUPSConfigItemButtonCombo_getCurrentValueDisplayGeneric: GetButtonComboStatus returned %s\n", WUPSButtonComboAPI_GetStatusStr(res));
}

if (isSelected) {
snprintf(out_buf, out_size, "(Press \ue000 to change) %s%s", comboStatus == WUPS_BUTTON_COMBO_COMBO_STATUS_VALID ? "" : "[CONFLICT] ", getComboAsString(item->currentButtonCombo).c_str());
} else {
Expand Down

0 comments on commit bb6ed34

Please sign in to comment.