mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-05 14:18:53 +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:
parent
a8ba5d567e
commit
9aea0d3967
@ -183,7 +183,6 @@ void AButton::Init(wxWindow * parent,
|
|||||||
|
|
||||||
mAlternateIdx = 0;
|
mAlternateIdx = 0;
|
||||||
|
|
||||||
mButtonIsFocused = false;
|
|
||||||
mFocusRect = GetClientRect().Deflate( 3, 3 );
|
mFocusRect = GetClientRect().Deflate( 3, 3 );
|
||||||
mForceFocusRect = false;
|
mForceFocusRect = false;
|
||||||
|
|
||||||
@ -311,7 +310,7 @@ void AButton::OnPaint(wxPaintEvent & WXUNUSED(event))
|
|||||||
|
|
||||||
mImages[mAlternateIdx].mArr[buttonState].Draw(dc, GetClientRect());
|
mImages[mAlternateIdx].mArr[buttonState].Draw(dc, GetClientRect());
|
||||||
|
|
||||||
if( mButtonIsFocused )
|
if( this == wxWindow::FindFocus() )
|
||||||
{
|
{
|
||||||
AColor::DrawFocus( dc, mFocusRect );
|
AColor::DrawFocus( dc, mFocusRect );
|
||||||
}
|
}
|
||||||
@ -466,13 +465,11 @@ void AButton::OnKeyDown(wxKeyEvent & event)
|
|||||||
|
|
||||||
void AButton::OnSetFocus(wxFocusEvent & WXUNUSED(event))
|
void AButton::OnSetFocus(wxFocusEvent & WXUNUSED(event))
|
||||||
{
|
{
|
||||||
mButtonIsFocused = true;
|
|
||||||
Refresh( false );
|
Refresh( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
void AButton::OnKillFocus(wxFocusEvent & WXUNUSED(event))
|
void AButton::OnKillFocus(wxFocusEvent & WXUNUSED(event))
|
||||||
{
|
{
|
||||||
mButtonIsFocused = false;
|
|
||||||
Refresh( false );
|
Refresh( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -739,8 +736,6 @@ wxAccStatus AButtonAx::GetState(int WXUNUSED(childId), long* state)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not use mButtonIsFocused is not set until after this method
|
|
||||||
// is called.
|
|
||||||
*state |= ( ab == wxWindow::FindFocus() ? wxACC_STATE_SYSTEM_FOCUSED : 0 );
|
*state |= ( ab == wxWindow::FindFocus() ? wxACC_STATE_SYSTEM_FOCUSED : 0 );
|
||||||
|
|
||||||
return wxACC_OK;
|
return wxACC_OK;
|
||||||
|
@ -2303,8 +2303,6 @@ wxAccStatus MeterAx::GetState(int WXUNUSED(childId), long* state)
|
|||||||
|
|
||||||
*state = wxACC_STATE_SYSTEM_FOCUSABLE;
|
*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 );
|
*state |= ( m == wxWindow::FindFocus() ? wxACC_STATE_SYSTEM_FOCUSED : 0 );
|
||||||
|
|
||||||
return wxACC_OK;
|
return wxACC_OK;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user