Skip to content

Commit

Permalink
Put check at the right place (#545)
Browse files Browse the repository at this point in the history
Only OnActivate needs to be checked for focus, not all events that lead to ReFocus being called.
  • Loading branch information
tobiolo authored Oct 15, 2023
1 parent 35c49a8 commit 702f242
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/myframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -1084,12 +1084,7 @@ struct MyFrame : wxFrame {
}

void ReFocus() {
#ifdef __WXGTK__
if (wxWindow::HasFocus())
#endif
{
if (GetCurTab()) GetCurTab()->SetFocus();
}
if (GetCurTab()) GetCurTab()->SetFocus();
}

void OnChangeColor(wxCommandEvent &ce) {
Expand All @@ -1110,6 +1105,9 @@ struct MyFrame : wxFrame {
void OnActivate(wxActivateEvent &ae) {
// This causes warnings in the debug log, but without it keyboard entry upon window select
// doesn't work.
#ifdef __WXGTK__
if (HasFocus())
#endif
ReFocus();
}

Expand Down

0 comments on commit 702f242

Please sign in to comment.