From 10a22a848473b93614c2a6d39d92cf98d2199010 Mon Sep 17 00:00:00 2001 From: lkn Date: Sun, 7 Jun 2026 13:38:46 +0200 Subject: [PATCH] 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. --- WINGs/wpopupbutton.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/WINGs/wpopupbutton.c b/WINGs/wpopupbutton.c index 01e210f..012e076 100644 --- a/WINGs/wpopupbutton.c +++ b/WINGs/wpopupbutton.c @@ -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: