fixed keypresses handling to correctly translate Unicode characters to current locale's charset in GTK2+ANSI build

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@28009 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2004-06-24 19:51:39 +00:00
parent 93d23d8faf
commit cf82b73a0a
2 changed files with 16 additions and 8 deletions

View File

@ -1274,11 +1274,15 @@ static void gtk_wxwindow_commit_cb (GtkIMContext *context,
if (event.m_uniChar < 256)
event.m_keyCode = event.m_uniChar;
#else
gunichar uniChar = g_utf8_get_char( str );
// We cannot handle Unicode in non-Unicode mode
if (uniChar > 255) return;
wchar_t unistr[2];
unistr[0] = g_utf8_get_char(str);
unistr[1] = 0;
wxCharBuffer ansistr(wxConvLocal.cWC2MB(unistr));
// We cannot handle characters that cannot be represented in
// current locale's charset in non-Unicode mode:
if (ansistr.data() == NULL) return;
event.m_keyCode = uniChar;
event.m_keyCode = ansistr[0u];
#endif

View File

@ -1274,11 +1274,15 @@ static void gtk_wxwindow_commit_cb (GtkIMContext *context,
if (event.m_uniChar < 256)
event.m_keyCode = event.m_uniChar;
#else
gunichar uniChar = g_utf8_get_char( str );
// We cannot handle Unicode in non-Unicode mode
if (uniChar > 255) return;
wchar_t unistr[2];
unistr[0] = g_utf8_get_char(str);
unistr[1] = 0;
wxCharBuffer ansistr(wxConvLocal.cWC2MB(unistr));
// We cannot handle characters that cannot be represented in
// current locale's charset in non-Unicode mode:
if (ansistr.data() == NULL) return;
event.m_keyCode = uniChar;
event.m_keyCode = ansistr[0u];
#endif