1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-16 08:34:10 +02:00

Help for debugging of some event handling

This commit is contained in:
Paul Licameli 2016-05-11 13:23:33 -04:00
parent 2cd3a5d751
commit 9bfd66b06c
4 changed files with 22 additions and 9 deletions

View File

@ -2762,6 +2762,10 @@ void AudacityProject::NextFrame()
default: default:
break; 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() void AudacityProject::PrevFrame()
@ -2791,6 +2795,10 @@ void AudacityProject::PrevFrame()
default: default:
break; 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() void AudacityProject::NextWindow()

View File

@ -2147,14 +2147,8 @@ void AudacityProject::OnActivate(wxActivateEvent & event)
// remember which child had the focus. Then, when we receive the // remember which child had the focus. Then, when we receive the
// activate event, we restore that focus to the child or the track // activate event, we restore that focus to the child or the track
// panel if no child had the focus (which probably should never happen). // panel if no child had the focus (which probably should never happen).
if (!mActive) { if (!mActive)
// We only want to remember the last focused window if FindFocus() returns UpdateLastFocus();
// a window within the current project frame.
wxWindow *w = FindFocus();
if (wxGetTopLevelParent(w) ==this) {
mLastFocusedWindow = w;
}
}
else { else {
SetActiveProject(this); SetActiveProject(this);
if (mLastFocusedWindow) { if (mLastFocusedWindow) {
@ -2173,6 +2167,16 @@ void AudacityProject::OnActivate(wxActivateEvent & event)
event.Skip(); 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() bool AudacityProject::IsActive()
{ {
return mActive; return mActive;

View File

@ -312,6 +312,7 @@ class AUDACITY_DLL_API AudacityProject final : public wxFrame,
void OnUpdateUI(wxUpdateUIEvent & event); void OnUpdateUI(wxUpdateUIEvent & event);
void OnActivate(wxActivateEvent & event); void OnActivate(wxActivateEvent & event);
void UpdateLastFocus();
void OnMouseEvent(wxMouseEvent & event); void OnMouseEvent(wxMouseEvent & event);
void OnIconize(wxIconizeEvent &event); void OnIconize(wxIconizeEvent &event);
void OnSize(wxSizeEvent & event); void OnSize(wxSizeEvent & event);

View File

@ -178,7 +178,7 @@ public:
#endif #endif
} }
int FilterEvent(wxEvent& event) int FilterEvent(wxEvent& event) override
{ {
// Quickly bail if this isn't something we want. // Quickly bail if this isn't something we want.
wxEventType type = event.GetEventType(); wxEventType type = event.GetEventType();