fixed an issue that FilamentGroupPopup dialog didn't dismiss on macOS (#13574)

On macOS, PopupWindow::OnMouseEvent2 synthesizes a wxEVT_ENTER_WINDOW on
`this` whenever the hovered target transitions from a child back to the
popup itself. wxPopupTransientWindow's OnIdle re-acquires mouse capture
once the cursor leaves the popup, so the next MOTION (with the cursor
already outside) hits OnMouseEvent2 with no child and synthesizes ENTER
on the popup — which would otherwise cancel the dismissal timer started
by OnLeaveWindow. Verify the cursor is actually inside before resetting.
This commit is contained in:
SoftFever
2026-05-12 00:44:14 +08:00
committed by GitHub
parent 2c259307a5
commit 797ee70b0b

View File

@@ -353,7 +353,13 @@ void FilamentGroupPopup::OnLeaveWindow(wxMouseEvent &)
StartTimer();
}
void FilamentGroupPopup::OnEnterWindow(wxMouseEvent &) { ResetTimer(); }
void FilamentGroupPopup::OnEnterWindow(wxMouseEvent &)
{
// Ignore spurious ENTER synthesized by PopupWindow::OnMouseEvent2 on macOS.
wxPoint pos = this->ScreenToClient(wxGetMousePosition());
if (!this->GetClientRect().Contains(pos)) return;
ResetTimer();
}
void FilamentGroupPopup::UpdateButtonStatus(int hover_idx)
{