]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix wxKeyEvent::m_uniChar for EVT_CHAR for native controls in wxGTK.
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 31 Jul 2012 11:29:00 +0000 (11:29 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 31 Jul 2012 11:29:00 +0000 (11:29 +0000)
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

index e8dc9150ebfb1bd40033eb35f4b691423045b9ae..7dcf9853c2fb6e8bcdb2a46cc8932d176beaa425 100644 (file)
@@ -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);