From fbef52ec33a3d7b0f7e577c6eaf751cb165f3e88 Mon Sep 17 00:00:00 2001 From: Jon Evans Date: Fri, 29 May 2020 21:20:03 -0400 Subject: [PATCH] Don't process hotkeys on text entries Thanks @jeffyoung for the suggestion Fixes https://gitlab.com/kicad/code/kicad/-/issues/4463 Fixes https://gitlab.com/kicad/code/kicad/-/issues/1941 --- common/eda_draw_frame.cpp | 4 ++++ common/tool/tool_dispatcher.cpp | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/common/eda_draw_frame.cpp b/common/eda_draw_frame.cpp index 7fc5538747..a76ee32c52 100644 --- a/common/eda_draw_frame.cpp +++ b/common/eda_draw_frame.cpp @@ -196,6 +196,10 @@ void EDA_DRAW_FRAME::unitsChangeRefresh() bool EDA_DRAW_FRAME::DispatchBehindModalDialog( wxKeyEvent& aEvent ) { + // Never process hotkeys when a text entry field is focused + if( dynamic_cast( FindFocus() ) ) + return false; + static std::set whiteList = { &ACTIONS::toggleUnits, &ACTIONS::imperialUnits, &ACTIONS::metricUnits }; diff --git a/common/tool/tool_dispatcher.cpp b/common/tool/tool_dispatcher.cpp index 3ef788a253..910f92e967 100644 --- a/common/tool/tool_dispatcher.cpp +++ b/common/tool/tool_dispatcher.cpp @@ -483,7 +483,10 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent ) wxKeyEvent* ke = static_cast( &aEvent ); keyIsEscape = ( ke->GetKeyCode() == WXK_ESCAPE ); - evt = GetToolEvent( ke, &keyIsSpecial ); + + // Never process key events for tools when a text entry has focus + if( !dynamic_cast( wxWindow::FindFocus() ) ) + evt = GetToolEvent( ke, &keyIsSpecial ); } else if( type == wxEVT_MENU_OPEN || type == wxEVT_MENU_CLOSE || type == wxEVT_MENU_HIGHLIGHT ) {