From 702f2425345ea0ef05ce4e2c885c5e83992a5c3d Mon Sep 17 00:00:00 2001 From: Tobias Predel Date: Sun, 15 Oct 2023 22:23:23 +0200 Subject: [PATCH] Put check at the right place (#545) Only OnActivate needs to be checked for focus, not all events that lead to ReFocus being called. --- src/myframe.h | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/myframe.h b/src/myframe.h index c0b38b0d..96e064aa 100755 --- a/src/myframe.h +++ b/src/myframe.h @@ -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) { @@ -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(); }