From 03ec02008553f637a370d978184785fa24935a0b Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Wed, 11 May 2016 13:46:32 -0400 Subject: [PATCH] Revert "Help for debugging of some event handling" This reverts commit 9bfd66b06ca908efe9bd3adfd7f78cf143d18688. --- src/Menus.cpp | 8 -------- src/Project.cpp | 20 ++++++++------------ src/Project.h | 1 - src/commands/CommandManager.cpp | 2 +- 4 files changed, 9 insertions(+), 22 deletions(-) diff --git a/src/Menus.cpp b/src/Menus.cpp index 1e8902059..a7110fe45 100644 --- a/src/Menus.cpp +++ b/src/Menus.cpp @@ -2762,10 +2762,6 @@ void AudacityProject::NextFrame() default: break; } - - // This is not strictly needed, except when trying to debug focus changes themselves, - // and therefore the main window misses the deactivation event - UpdateLastFocus(); } void AudacityProject::PrevFrame() @@ -2795,10 +2791,6 @@ void AudacityProject::PrevFrame() default: break; } - - // This is not strictly needed, except when trying to debug focus changes themselves, - // and therefore the main window misses the deactivation event - UpdateLastFocus(); } void AudacityProject::NextWindow() diff --git a/src/Project.cpp b/src/Project.cpp index b6fbddb64..df65fc3c8 100644 --- a/src/Project.cpp +++ b/src/Project.cpp @@ -2147,8 +2147,14 @@ void AudacityProject::OnActivate(wxActivateEvent & event) // remember which child had the focus. Then, when we receive the // activate event, we restore that focus to the child or the track // panel if no child had the focus (which probably should never happen). - if (!mActive) - UpdateLastFocus(); + if (!mActive) { + // We only want to remember the last focused window if FindFocus() returns + // a window within the current project frame. + wxWindow *w = FindFocus(); + if (wxGetTopLevelParent(w) ==this) { + mLastFocusedWindow = w; + } + } else { SetActiveProject(this); if (mLastFocusedWindow) { @@ -2167,16 +2173,6 @@ void AudacityProject::OnActivate(wxActivateEvent & event) event.Skip(); } -void AudacityProject::UpdateLastFocus() -{ - // We only want to remember the last focused window if FindFocus() returns - // a window within the current project frame. - wxWindow *w = FindFocus(); - if (wxGetTopLevelParent(w) ==this) { - mLastFocusedWindow = w; - } -} - bool AudacityProject::IsActive() { return mActive; diff --git a/src/Project.h b/src/Project.h index 6bda75f16..e7e3d613e 100644 --- a/src/Project.h +++ b/src/Project.h @@ -312,7 +312,6 @@ class AUDACITY_DLL_API AudacityProject final : public wxFrame, void OnUpdateUI(wxUpdateUIEvent & event); void OnActivate(wxActivateEvent & event); - void UpdateLastFocus(); void OnMouseEvent(wxMouseEvent & event); void OnIconize(wxIconizeEvent &event); void OnSize(wxSizeEvent & event); diff --git a/src/commands/CommandManager.cpp b/src/commands/CommandManager.cpp index 2a86720e9..fc9b28164 100644 --- a/src/commands/CommandManager.cpp +++ b/src/commands/CommandManager.cpp @@ -178,7 +178,7 @@ public: #endif } - int FilterEvent(wxEvent& event) override + int FilterEvent(wxEvent& event) { // Quickly bail if this isn't something we want. wxEventType type = event.GetEventType();