diff --git a/sc2/ChangeLog b/sc2/ChangeLog index 144e38cf6..54dc90a58 100644 --- a/sc2/ChangeLog +++ b/sc2/ChangeLog @@ -1,4 +1,5 @@ Changes towards version 0.5: +- CANCEL now behaves as expected in setup menu - Michael - Only SELECT and CANCEL trigger the fade-to-black at the end of a Super Melee, solving the issue in bug #547 - Michael - Admiral ZEX is no longer referred to as "Commander" or "Zex" (bug diff --git a/sc2/src/sc2code/libs/graphics/widgets.c b/sc2/src/sc2code/libs/graphics/widgets.c index 021af3420..7dbce104a 100644 --- a/sc2/src/sc2code/libs/graphics/widgets.c +++ b/sc2/src/sc2code/libs/graphics/widgets.c @@ -494,6 +494,11 @@ Widget_HandleEventMenuScreen (WIDGET *_self, int event) case WIDGET_EVENT_DOWN: dx = 1; break; + case WIDGET_EVENT_CANCEL: + /* On cancel, shift focus to last element and send a SELECT. */ + self->highlighted = self->num_children - 1; + widget_focus = self->child[self->highlighted]; + return (widget_focus->handleEvent)(widget_focus, WIDGET_EVENT_SELECT); default: return FALSE; } diff --git a/sc2/src/sc2code/setupmenu.c b/sc2/src/sc2code/setupmenu.c index fffd2cc94..4b3ea0115 100644 --- a/sc2/src/sc2code/setupmenu.c +++ b/sc2/src/sc2code/setupmenu.c @@ -731,11 +731,15 @@ DoSetupMenu (PSETUP_MENU_STATE pInputState) { Widget_Event (WIDGET_EVENT_SELECT); } + if (PulsedInputState.key[KEY_MENU_CANCEL]) + { + Widget_Event (WIDGET_EVENT_CANCEL); + } SleepThreadUntil (pInputState->NextTime + MENU_FRAME_RATE); pInputState->NextTime = GetTimeCounter (); return !((GLOBAL (CurrentActivity) & CHECK_ABORT) || - PulsedInputState.key[KEY_MENU_CANCEL] || (next == NULL)); + (next == NULL)); } void