From dc88fe84d91da52399ad49c387c68e5c50ce670d Mon Sep 17 00:00:00 2001 From: David Bailes Date: Fri, 5 Jul 2019 15:18:16 +0100 Subject: [PATCH] TrackPanel: fix when it is set as keyboard handler. Problem: Currently KeyboardCapture::Capture(this) is called in TrackPanel::OnTrackFocusChange(). So the keyboard handler is not automatically set when the track panel becomes the focus. Example of a symptom: A project contains a label track, and is the focus, and type to create a label is enabled. Move to focus to another window, and then back to the Audacity window. Type a character. A label is not created. Fix: Move the call KeyboardCapture::Capture(this) to TrackPanel::SetFocusedCell(), so that it gets called when the TrackPanel becomes the focus. --- src/TrackPanel.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TrackPanel.cpp b/src/TrackPanel.cpp index 533644ddd..cf38a50b6 100644 --- a/src/TrackPanel.cpp +++ b/src/TrackPanel.cpp @@ -1323,6 +1323,7 @@ void TrackPanel::SetFocusedCell() { // This may have a side-effet of assigning a focus if there was none TrackFocus::Get( *GetProject() ).Get(); + KeyboardCapture::Capture(this); } void TrackPanel::OnTrackFocusChange( wxCommandEvent &event ) @@ -1331,7 +1332,6 @@ void TrackPanel::OnTrackFocusChange( wxCommandEvent &event ) auto cell = GetFocusedCell(); if (cell) { - KeyboardCapture::Capture(this); Refresh( false ); } }