From 80a3cd2db9cd24fad5b830244eab837261abc027 Mon Sep 17 00:00:00 2001 From: Artur Sochirca Date: Thu, 8 Oct 2020 18:56:21 +0300 Subject: [PATCH] Avoid using non-ASCII key codes in key up/down events in wxOSX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Generating such events could result in mishandling some key presses as special keys, e.g. the Turkish "ş" characters was mistakenly processed as F12 because F12 corresponds to its Unicode character code (U+015F). Avoid this by only setting wxKeyEvent::m_keyCode for printable characters (while still making the actual key available in m_uniChar). This makes wxOSX consistent with wxGTK and documented behaviour. Closes https://github.com/wxWidgets/wxWidgets/pull/2081 --- src/osx/cocoa/window.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osx/cocoa/window.mm b/src/osx/cocoa/window.mm index 813bb1face..7f26b8585e 100644 --- a/src/osx/cocoa/window.mm +++ b/src/osx/cocoa/window.mm @@ -518,7 +518,7 @@ void wxWidgetCocoaImpl::SetupKeyEvent(wxKeyEvent &wxevent , NSEvent * nsEvent, N } } - if ( !keyval ) + if ( !keyval && aunichar < 256 ) // only for ASCII characters { if ( wxevent.GetEventType() == wxEVT_KEY_UP || wxevent.GetEventType() == wxEVT_KEY_DOWN ) keyval = wxToupper( aunichar ) ;