Avoid using non-ASCII key codes in key up/down events in wxOSX

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
This commit is contained in:
Artur Sochirca 2020-10-08 18:56:21 +03:00 committed by Vadim Zeitlin
parent 952e5f32cd
commit 80a3cd2db9

View File

@ -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 ) ;