From 88966662d47db5d7f41711daa53c5bfa546cc217 Mon Sep 17 00:00:00 2001 From: Tobias Predel Date: Sun, 18 Sep 2022 07:23:14 +0200 Subject: [PATCH] Explicity check for window focus before refocusing (#265) Under some certain circumstances in a desktop environment running on a Xorg server, the Treesheets window catches all input events - even those that are not intended for Treesheets. This leads Treesheets to set the focus on its current tab and thus on its window each time an input event is detected - even if the window had no focus. Explicitly check whether the Treesheets window has focus and only if it has focus, refocus on the Treesheets current tab and window. --- src/myframe.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/myframe.h b/src/myframe.h index 8facaeef..93e8ed7f 100755 --- a/src/myframe.h +++ b/src/myframe.h @@ -1046,7 +1046,9 @@ struct MyFrame : wxFrame { } void ReFocus() { - if (GetCurTab()) GetCurTab()->SetFocus(); + if (wxWindow::HasFocus()) { + if (GetCurTab()) GetCurTab()->SetFocus(); + } } void OnCellColor(wxCommandEvent &ce) {