Clicking an already-open menu bar entry now closes the popup.

This commit is contained in:
Scott Duensing 2026-03-18 00:00:50 -05:00
parent e4b44d08c1
commit 6a4044d0d7

View file

@ -983,7 +983,10 @@ static void dispatchEvents(AppContextT *ctx) {
MenuT *menu = &win->menuBar->menus[i]; MenuT *menu = &win->menuBar->menus[i];
if (relX >= menu->barX && relX < menu->barX + menu->barW) { if (relX >= menu->barX && relX < menu->barX + menu->barW) {
if (i != ctx->popup.menuIdx || ctx->popup.depth > 0) { if ((buttons & 1) && !(prevBtn & 1) && i == ctx->popup.menuIdx && ctx->popup.depth == 0) {
// Clicking the same menu bar entry closes the menu
closeAllPopups(ctx);
} else if (i != ctx->popup.menuIdx || ctx->popup.depth > 0) {
openPopupAtMenu(ctx, win, i); openPopupAtMenu(ctx, win, i);
} }