1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-05-05 06:09:47 +02:00

Do not redundantly track focus in AButton...

... I suspect it goes wrong on Mac sometimes, fault is in wxWidgets 3, not
sending all the kill focus events that it should.
This commit is contained in:
Paul Licameli 2017-07-23 14:37:10 -04:00
parent a8ba5d567e
commit 9aea0d3967
2 changed files with 1 additions and 8 deletions

View File

@ -183,7 +183,6 @@ void AButton::Init(wxWindow * parent,
mAlternateIdx = 0;
mButtonIsFocused = false;
mFocusRect = GetClientRect().Deflate( 3, 3 );
mForceFocusRect = false;
@ -311,7 +310,7 @@ void AButton::OnPaint(wxPaintEvent & WXUNUSED(event))
mImages[mAlternateIdx].mArr[buttonState].Draw(dc, GetClientRect());
if( mButtonIsFocused )
if( this == wxWindow::FindFocus() )
{
AColor::DrawFocus( dc, mFocusRect );
}
@ -466,13 +465,11 @@ void AButton::OnKeyDown(wxKeyEvent & event)
void AButton::OnSetFocus(wxFocusEvent & WXUNUSED(event))
{
mButtonIsFocused = true;
Refresh( false );
}
void AButton::OnKillFocus(wxFocusEvent & WXUNUSED(event))
{
mButtonIsFocused = false;
Refresh( false );
}
@ -739,8 +736,6 @@ wxAccStatus AButtonAx::GetState(int WXUNUSED(childId), long* state)
break;
}
// Do not use mButtonIsFocused is not set until after this method
// is called.
*state |= ( ab == wxWindow::FindFocus() ? wxACC_STATE_SYSTEM_FOCUSED : 0 );
return wxACC_OK;

View File

@ -2303,8 +2303,6 @@ wxAccStatus MeterAx::GetState(int WXUNUSED(childId), long* state)
*state = wxACC_STATE_SYSTEM_FOCUSABLE;
// Do not use mButtonIsFocused is not set until after this method
// is called.
*state |= ( m == wxWindow::FindFocus() ? wxACC_STATE_SYSTEM_FOCUSED : 0 );
return wxACC_OK;