Skip to content

Commit

Permalink
Explicity check for window focus before refocusing (#265)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tobiolo authored Sep 18, 2022
1 parent af7a5d7 commit 8896666
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/myframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -1046,7 +1046,9 @@ struct MyFrame : wxFrame {
}

void ReFocus() {
if (GetCurTab()) GetCurTab()->SetFocus();
if (wxWindow::HasFocus()) {
if (GetCurTab()) GetCurTab()->SetFocus();
}
}

void OnCellColor(wxCommandEvent &ce) {
Expand Down

0 comments on commit 8896666

Please sign in to comment.