Generate unshifted Unicode key codes in wxEVT_KEY_XXX events in wxGTK.

wxGTK generated wxEVT_KEY_XXX with key codes corresponding to the unshifted
state of the key (except for the letters) but Unicode key codes corresponding
to the current shift state. This was inconsistent with wxMSW and also with the
idea that key events, unlike char ones, don't depend on the modifiers states.

Change wxGTK to behave as wxMSW and use unshifted values for Unicode key codes
as well.

Remove the now unnecessary workaround for different key event Unicode codes
from test.

Also try to explain the difference between normal and Unicode keys and key and
char events even better and mention that the Unicode key codes for the key
events are also untranslated in the documentation.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65526 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-09-11 10:19:07 +00:00
parent 5844ad30dd
commit 7333c0ef82
3 changed files with 88 additions and 66 deletions

View File

@@ -686,16 +686,6 @@ static void wxFillOtherKeyEventFields(wxKeyEvent& event,
event.m_metaDown = (gdk_event->state & GDK_META_MASK) != 0;
event.m_rawCode = (wxUint32) 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;
@@ -800,6 +790,17 @@ wxTranslateGTKKeyEventToWx(wxKeyEvent& event,
event.m_keyCode = key_code;
#if wxUSE_UNICODE
event.m_uniChar = gdk_keyval_to_unicode(key_code ? key_code : keysym);
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
// now fill all the other fields
wxFillOtherKeyEventFields(event, win, gdk_event);