popDownMenu: reset insideMenu and highlightedItem to prevent stale state on reopen

This commit is contained in:
lkn 2026-06-07 16:42:25 +02:00
parent 230eefd8d3
commit 6b5b015cd8
1 changed files with 7 additions and 0 deletions

View File

@ -516,6 +516,13 @@ static void popUpMenu(PopUpButton * bPtr)
static void popDownMenu(PopUpButton * bPtr)
{
W_UnmapView(bPtr->menuView);
/* Clear interactive state so the next open starts from a clean
* slate. insideMenu and highlightedItem must be reset here;
* relying on WME_LEAVE from the NULL/1x1 unmap is unreliable.
* Stale highlightedItem causes the next BUTTON_RELEASE to
* immediately close the popup. */
bPtr->flags.insideMenu = 0;
bPtr->highlightedItem = -1;
}
static void autoScroll(void *data)