The keyboard keys not corresponding to real characters, such as cursor arrows
or function keys, must generate wxKeyEvents with WXK_NONE as Unicode key code
to make it possible to distinguish them from the printable characters but
wxOSX generated events with valid Unicode key codes for them instead.
Avoid this by excluding Unicode key codes corresponding to code points in the
Unicode private use area: while this doesn't seem to be documented anywhere,
all non-printable characters seem to have their Unicode representation inside
it.
This change brings wxOSX keyboard event generation in line with the other
ports and, as a side effect, also closes #12423.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68467
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
}
#if wxUSE_UNICODE
- wxevent.m_uniChar = aunichar;
+ // OS X generates events with key codes in Unicode private use area for
+ // unprintable symbols such as cursor arrows (WXK_UP is mapped to U+F700)
+ // and function keys (WXK_F2 is U+F705). We don't want to use them as the
+ // result of wxKeyEvent::GetUnicodeKey() however as it's supposed to return
+ // WXK_NONE for "non characters" so explicitly exclude them.
+ //
+ // We only exclude the private use area inside the Basic Multilingual Plane
+ // as key codes beyond it don't seem to be currently used.
+ if ( !(aunichar >= 0xe000 && aunichar < 0xf900) )
+ wxevent.m_uniChar = aunichar;
#endif
wxevent.m_keyCode = keyval;