Generate correct wxEVT_CHAR for non-BMP characters in wxOSX.

Since [NSString characterAtIndex:] return UTF-16 values, it can't be used as a
"character", convert the entire NSString to wxString and iterate over it to
obtain the real characters that should be sent in wxEVT_CHAR events.

Closes #16979.
This commit is contained in:
ARATA Mizuki 2015-05-06 20:26:55 +09:00 committed by Vadim Zeitlin
parent 6c20d775c4
commit a266a0a446

View File

@ -2730,7 +2730,10 @@ bool wxWidgetCocoaImpl::DoHandleCharEvent(NSEvent *event, NSString *text)
int length = [text length];
if ( peer )
{
for (NSUInteger i = 0; i < length; ++i)
const wxString str = wxCFStringRef([text retain]).AsString();
for ( wxString::const_iterator it = str.begin();
it != str.end();
++it )
{
wxKeyEvent wxevent(wxEVT_CHAR);
@ -2749,7 +2752,7 @@ bool wxWidgetCocoaImpl::DoHandleCharEvent(NSEvent *event, NSString *text)
wxevent.m_rawCode = 0;
wxevent.m_rawFlags = 0;
unichar aunichar = [text characterAtIndex:i];
const wxChar aunichar = *it;
#if wxUSE_UNICODE
wxevent.m_uniChar = aunichar;
#endif