From be55d891dbd15ec9c54ad04ef65219c351ddd952 Mon Sep 17 00:00:00 2001 From: David Bailes Date: Fri, 17 May 2019 09:56:01 +0100 Subject: [PATCH] Trackpanel accessibility: incorrect focus can be read Problem: If the initial focus is a control in a toolbar, then after applying an effect such as amplify, then the focus is read as being a track, not the control in the toolbar. TrackPanelAx::SetFocus() can be called when the TrackPanel is not the focus, and send a focus event. Fix: In TrackPanelAx::SetFocus(), only send a focus event if the TrackPanel is the focus. --- src/TrackPanelAx.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/TrackPanelAx.cpp b/src/TrackPanelAx.cpp index a27d4cb9d..8d5391c3a 100644 --- a/src/TrackPanelAx.cpp +++ b/src/TrackPanelAx.cpp @@ -108,10 +108,13 @@ std::shared_ptr TrackPanelAx::SetFocus( std::shared_ptr track ) #if wxUSE_ACCESSIBILITY if( track ) { - NotifyEvent( wxACC_EVENT_OBJECT_FOCUS, - mTrackPanel, - wxOBJID_CLIENT, - mNumFocusedTrack ); + if (mTrackPanel == wxWindow::FindFocus()) + { + NotifyEvent( wxACC_EVENT_OBJECT_FOCUS, + mTrackPanel, + wxOBJID_CLIENT, + mNumFocusedTrack ); + } if( track->GetSelected() ) {