From bd85421daacf215afbf8deedbfd9896c6054aca1 Mon Sep 17 00:00:00 2001 From: Jeff Young Date: Mon, 19 Nov 2018 11:24:14 +0000 Subject: [PATCH] Don't map low-order keyCodes unless they really are Ctrl-Letter codes. Fixes: lp:1803730 * https://bugs.launchpad.net/kicad/+bug/1803730 --- common/tool/tool_dispatcher.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/common/tool/tool_dispatcher.cpp b/common/tool/tool_dispatcher.cpp index ba9c870ec8..9901c6bb7f 100644 --- a/common/tool/tool_dispatcher.cpp +++ b/common/tool/tool_dispatcher.cpp @@ -312,6 +312,7 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent ) bool motion = false, buttonEvents = false; OPT evt; int key = 0; // key = 0 if the event is not a key event + int unicode = 0; bool keyIsSpecial = false; // True if the key is a special key code int type = aEvent.GetEventType(); @@ -369,6 +370,7 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent ) wxKeyEvent* ke = static_cast( &aEvent ); key = ke->GetKeyCode(); keyIsSpecial = isKeySpecialCode( key ); + unicode = ke->GetUnicodeKey(); wxLogTrace( kicadTraceKeyEvent, "TOOL_DISPATCHER::DispatchWxEvent %s", dump( *ke ) ); @@ -395,7 +397,7 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent ) // char events for ASCII letters in this case carry codes corresponding to the ASCII // value of Ctrl-Latter, i.e. 1 for Ctrl-A, 2 for Ctrl-B and so on until 26 for Ctrl-Z. // They are remapped here to be more easy to handle in code - if( key >= WXK_CONTROL_A && key <= WXK_CONTROL_Z ) + if( unicode >= 'A' && unicode <= 'Z' && key >= WXK_CONTROL_A && key <= WXK_CONTROL_Z ) key += 'A' - 1; }