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

Refer to bug #294 for details.

This commit is contained in:
lllucius 2011-03-08 14:09:26 +00:00
parent e1923bc07f
commit d1d5a1e3a9
2 changed files with 36 additions and 0 deletions

View File

@ -1728,6 +1728,31 @@ void AudacityProject::OnUpdateUI(wxUpdateUIEvent & event)
UpdateMenus();
}
#if defined(__WXGTK__)
// Under wxGTK, we seem to experience focus issues related to improper "buffering" of active focus. This causes
// the normal SetFocus() to be ignored if it thinks the target window already has focus, even though it may not
// really have it.
//
// Thus the reason for this hackage. It basically, forces focus to another, known to exist, window before
// forcing focus to the TrackPanel. This is not at all a perfect solution, but until wxGTK is fixed, this
// may provide some relief from focus not returning to the TrackPanel after modal dialogs are closed.
//
// This also means that it may not work the same way on different versions of wxGTK other than 2.8.11, which
// is the version this was tested on.
void AudacityProject::SetFocus()
{
if (mTrackPanel) {
wxWindow *w = GetSelectionBar();
if (w)
{
w->SetFocus();
OnInternalIdle();
}
mTrackPanel->SetFocus();
}
}
#endif
void AudacityProject::OnActivate(wxActivateEvent & event)
{
// Activate events can fire during window teardown, so just
@ -1738,6 +1763,12 @@ void AudacityProject::OnActivate(wxActivateEvent & event)
mActive = event.GetActive();
#if defined(__WXGTK__)
// See AudacityProject::SetFocus() above for further wxGTK handling
event.Skip();
return;
#endif
// Under Windows, focus can be "lost" when returning to
// Audacity from a different application.
//

View File

@ -127,6 +127,11 @@ class AUDACITY_DLL_API AudacityProject: public wxFrame,
const wxPoint & pos, const wxSize & size);
virtual ~AudacityProject();
#if defined(__WXGTK__)
// See comments in Project.cpp/AudacityProject::SetFocus()
virtual void SetFocus();
#endif
TrackList *GetTracks() { return mTracks; };
UndoManager *GetUndoManager() { return &mUndoManager; }