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:
@@ -188,27 +188,16 @@ void TestEvent(int line, const wxKeyEvent& ev, const KeyDesc& desc)
|
||||
ev.GetKeyCode() );
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
if ( desc.m_keycode < 0x80 )
|
||||
if ( desc.m_keycode < WXK_START )
|
||||
{
|
||||
// FIXME: Currently wxMSW generates 'A' key code for key down/up events
|
||||
// for the 'a' physical key while wxGTK and wxOSX/Cocoa generate them
|
||||
// with 'a' and it's not clear which behaviour is more correct so don't
|
||||
// test this for those events, only test it for EVT_CHAR where the
|
||||
// correct behaviour is clear.
|
||||
|
||||
if ( t == wxEVT_CHAR )
|
||||
{
|
||||
// For 7-bit ASCII Unicode keys are the same as normal key codes.
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE( "wrong Unicode key in " + msg,
|
||||
(char)desc.m_keycode,
|
||||
(char)ev.GetUnicodeKey() );
|
||||
}
|
||||
// For Latin-1 our key code is the same as Unicode character value.
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE( "wrong Unicode key in " + msg,
|
||||
(char)desc.m_keycode,
|
||||
(char)ev.GetUnicodeKey() );
|
||||
}
|
||||
else
|
||||
else // Special key
|
||||
{
|
||||
// In this test we don't use any really Unicode characters so far so
|
||||
// anything above 0x80 must be special keys (e.g. WXK_CONTROL &c) which
|
||||
// don't have any Unicode equivalent.
|
||||
// Key codes above WXK_START don't correspond to printable characters.
|
||||
CPPUNIT_ASSERT_EQUAL_MESSAGE( "wrong non-zero Unicode key in " + msg,
|
||||
0,
|
||||
(int)ev.GetUnicodeKey() );
|
||||
|
Reference in New Issue
Block a user