From 1dd92b1bb13c1f15519e8fd8b1c12206981b1ae0 Mon Sep 17 00:00:00 2001 From: Ian McInerney Date: Tue, 8 Aug 2023 14:02:54 +0100 Subject: [PATCH] Assign focus to the notebook in the ERC/DRC window after running After running the ERC/DRC, the window would not get focus returned to it on GTK naturally unless the user pressed the arrow key. This prevented the ESC key from closing the window after the run was complete and nothing else was clicked/pressed. Instead of pulling focus to the dataview with the errors in it (which would cause problems in GTK, such as moving the viewport to the first marker (https://gitlab.com/kicad/code/kicad/-/issues/11925), give focus to the notebook container instead. This will not select the marker, but still allow the ESC to propagate into the dialog immediately. --- eeschema/dialogs/dialog_erc.cpp | 4 +--- pcbnew/dialogs/dialog_drc.cpp | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/eeschema/dialogs/dialog_erc.cpp b/eeschema/dialogs/dialog_erc.cpp index e8ea48bb69..e281972fc0 100644 --- a/eeschema/dialogs/dialog_erc.cpp +++ b/eeschema/dialogs/dialog_erc.cpp @@ -451,9 +451,7 @@ void DIALOG_ERC::OnRunERCClick( wxCommandEvent& event ) { wxMilliSleep( 500 ); m_runningResultsBook->ChangeSelection( 1 ); -#ifndef __WXGTK__ - KIPLATFORM::UI::ForceFocus( m_markerDataView ); -#endif + KIPLATFORM::UI::ForceFocus( m_notebook ); } m_ercRun = true; diff --git a/pcbnew/dialogs/dialog_drc.cpp b/pcbnew/dialogs/dialog_drc.cpp index eb776032b5..106121d235 100644 --- a/pcbnew/dialogs/dialog_drc.cpp +++ b/pcbnew/dialogs/dialog_drc.cpp @@ -325,9 +325,7 @@ void DIALOG_DRC::OnRunDRCClick( wxCommandEvent& aEvent ) { wxMilliSleep( 500 ); m_runningResultsBook->ChangeSelection( 1 ); -#ifndef __WXGTK__ - KIPLATFORM::UI::ForceFocus( m_markerDataView ); -#endif + KIPLATFORM::UI::ForceFocus( m_Notebook ); } refreshEditor();