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
This commit is contained in:
Vadim Zeitlin 2012-07-31 11:29:00 +00:00
parent 7c8bfa876a
commit d50905f761

View 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);