wpopupbutton: only clear menu state on leave from menuView, not on bPtr->view

When the pointer leaves the main button view to enter the popup surface,
the WME_LEAVE event fires for bPtr->view (which shares the same
handleActionEvents handler). This unconditionally cleared insideMenu=0
and highlightedItem=-1, causing the subsequent button release to fail
the selection check and not fire the action.

Fix: guard the leave handler with event->window == bPtr->menuView->window
so that clearing only happens when the pointer actually leaves the menu
view, not when it just leaves the main button on its way to the popup.
This commit is contained in:
lkn 2026-06-07 13:38:46 +02:00
parent d43ceae081
commit 10a22a8484
1 changed files with 9 additions and 4 deletions

View File

@ -622,10 +622,15 @@ static void handleActionEvents(WMEvent * event, void *data)
break;
case WME_LEAVE:
bPtr->flags.insideMenu = 0;
if (bPtr->menuView->flags.mapped)
paintMenuEntry(bPtr, bPtr->highlightedItem, False);
bPtr->highlightedItem = -1;
/* Only clear menu state on leave from the menu view itself.
* Leave from the main button view is just the pointer moving
* to the popup — don't cancel the active drag-selection. */
if (event->window == bPtr->menuView->window) {
bPtr->flags.insideMenu = 0;
if (bPtr->menuView->flags.mapped)
paintMenuEntry(bPtr, bPtr->highlightedItem, False);
bPtr->highlightedItem = -1;
}
break;
case WME_ENTER: