Only assign the wx key code wxKeyEvent::m_uniChar if it's a key corresponding
to an ASCII symbol, don't do it for the values outside of ASCII range such as
all the special WXK_ constants. It doesn't make sense to generate Unicode key
codes for e.g. cursor key presses.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65240
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
event.m_rawFlags = 0;
#if wxUSE_UNICODE
event.m_uniChar = gdk_keyval_to_unicode(gdk_event->keyval);
event.m_rawFlags = 0;
#if wxUSE_UNICODE
event.m_uniChar = gdk_keyval_to_unicode(gdk_event->keyval);
+ if ( !event.m_uniChar && event.m_keyCode <= WXK_DELETE )
+ {
+ // Set Unicode key code to the ASCII equivalent for compatibility. E.g.
+ // let RETURN generate the key event with both key and Unicode key
+ // codes of 13.
+ event.m_uniChar = event.m_keyCode;
+ }
+#endif // wxUSE_UNICODE
wxGetMousePosition( &x, &y );
win->ScreenToClient( &x, &y );
event.m_x = x;
wxGetMousePosition( &x, &y );
win->ScreenToClient( &x, &y );
event.m_x = x;
if ( !key_code )
return false;
if ( !key_code )
return false;
+ event.m_keyCode = key_code;
+
// now fill all the other fields
wxFillOtherKeyEventFields(event, win, gdk_event);
// now fill all the other fields
wxFillOtherKeyEventFields(event, win, gdk_event);
- event.m_keyCode = key_code;
-#if wxUSE_UNICODE
- if ( gdk_event->type == GDK_KEY_PRESS || gdk_event->type == GDK_KEY_RELEASE )
- {
- event.m_uniChar = key_code;
- }
-#endif
-