1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-03 22:19:07 +02:00

Bug1325: A better fix that avoids platform dependent code and still ...

... distinguishes button state as we wanted to.
This commit is contained in:
Paul Licameli 2016-05-03 14:46:24 -04:00
parent 1910c9eda1
commit b4763d2608

View File

@ -5901,26 +5901,33 @@ void TrackPanel::OnMouseEvent(wxMouseEvent & event)
ReleaseMouse();
}
if (event.Leaving() && !event.ButtonIsDown(wxMOUSE_BTN_ANY))
if (event.Leaving())
{
// PRL: was this test really needed? It interfered with my refactoring
// that tried to eliminate those enum values.
// I think it was never true, that mouse capture was pan or gain sliding,
// but no mouse button was down.
// if (mMouseCapture != IsPanSliding && mMouseCapture != IsGainSliding)
auto buttons =
// Bug 1325: button state in Leaving events is unreliable on Mac.
// Poll the global state instead.
// event.ButtonIsDown(wxMOUSE_BTN_ANY);
::wxGetMouseState().ButtonIsDown(wxMOUSE_BTN_ANY);
if(!buttons) {
SetCapturedTrack(NULL);
#if defined(__WXMAC__)
// We must install the cursor ourselves since the window under
// the mouse is no longer this one and wx2.8.12 makes that check.
// Should re-evaluate with wx3.
wxSTANDARD_CURSOR->MacInstall();
// Bug 1325: It appears wxWidgets 3 always says no buttons are down
// in Leaving events, incorrectly. So don't do this:
// SetCapturedTrack(NULL);
#else
SetCapturedTrack(NULL);
#endif
}
}
switch( mMouseCapture )
{