From d50905f7618df5f6fa54bdabcda7f69f54ffecf3 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 31 Jul 2012 11:29:00 +0000 Subject: [PATCH] Fix wxKeyEvent::m_uniChar for EVT_CHAR for native controls in wxGTK. It was mistakenly set to the same value as in EVT_KEY_DOWN event but, just as m_keyCode, it may be different for EVT_CHAR. Use gdk_keyval_to_unicode() to set it correctly instead of inheriting EVT_KEY_DOWN value. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72267 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/gtk/window.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index e8dc915..7dcf985 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -1012,10 +1012,9 @@ gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), // will only be sent if it is not in an accelerator table. if (!ret) { - long key_code; KeySym keysym = gdk_event->keyval; // Find key code for EVT_CHAR and EVT_CHAR_HOOK events - key_code = wxTranslateKeySymToWXKey(keysym, true /* isChar */); + long key_code = wxTranslateKeySymToWXKey(keysym, true /* isChar */); if ( !key_code ) { if ( wxIsAsciiKeysym(keysym) ) @@ -1037,6 +1036,9 @@ gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), wxLogTrace(TRACE_KEYS, wxT("Char event: %ld"), key_code); eventChar.m_keyCode = key_code; +#if wxUSE_UNICODE + eventChar.m_uniChar = gdk_keyval_to_unicode(key_code); +#endif // wxUSE_UNICODE AdjustCharEventKeyCodes(eventChar); -- 2.7.4