// default if lParam == 0.
//
// Returns WXK_NONE if translation couldn't be done at all (this happens e.g.
-// for dead keys) or if the key corresponds to a non-ASCII character in which
-// case uc is filled with its Unicode value.
+// for dead keys and in this case uc will be WXK_NONE too) or if the key
+// corresponds to a non-Latin-1 character in which case uc is filled with its
+// Unicode value.
WXDLLIMPEXP_CORE int VKToWX(WXWORD vk, WXLPARAM lParam = 0, wchar_t *uc = NULL);
// Translate wxKeyCode enum element (passed as int for compatibility reasons)
wParam,
lParam | (KF_EXTENDED << 16)
);
- processed = HandleWindowEvent(event);
+
+ // Don't produce events without any valid character
+ // code (even if this shouldn't normally happen...).
+ if ( event.m_keyCode != WXK_NONE )
+ processed = HandleWindowEvent(event);
}
}
if (message == WM_SYSKEYDOWN) // Let Windows still handle the SYSKEYs
// good idea.
wxk = WXK_NONE;
}
- else // Not a dead key.
- {
- // In any case return this as a Unicode character value.
- if ( uc )
- *uc = wxk;
- // For compatibility with the old non-Unicode code we continue
- // returning key codes for Latin-1 characters directly
- // (normally it would really only make sense to do it for the
- // ASCII characters, not Latin-1 ones).
- if ( wxk > 255 )
- {
- // But for anything beyond this we can only return the key
- // value as a real Unicode character, not a wxKeyCode
- // because this enum values clash with Unicode characters
- // (e.g. WXK_LBUTTON also happens to be U+012C a.k.a.
- // "LATIN CAPITAL LETTER I WITH BREVE").
- wxk = WXK_NONE;
- }
- //
+ // In any case return this as a Unicode character value.
+ if ( uc )
+ *uc = wxk;
+
+ // For compatibility with the old non-Unicode code we continue
+ // returning key codes for Latin-1 characters directly
+ // (normally it would really only make sense to do it for the
+ // ASCII characters, not Latin-1 ones).
+ if ( wxk > 255 )
+ {
+ // But for anything beyond this we can only return the key
+ // value as a real Unicode character, not a wxKeyCode
+ // because this enum values clash with Unicode characters
+ // (e.g. WXK_LBUTTON also happens to be U+012C a.k.a.
+ // "LATIN CAPITAL LETTER I WITH BREVE").
+ wxk = WXK_NONE;
}
break;
// A simple alphanumeric key and the values of them coincide in
// Windows and wx for both ASCII and Unicode codes.
wxk = vk;
-
- if ( uc )
- *uc = vk;
}
else // Something we simply don't know about at all.
{
wxk = WXK_NONE;
}
+
+ if ( uc )
+ *uc = vk;
}
return wxk;
{
wchar_t uc;
int id = wxMSWKeyboard::VKToWX(wParam, lParam, &uc);
- if ( id != WXK_NONE )
+ if ( id != WXK_NONE
+#if wxUSE_UNICODE
+ || uc != WXK_NONE
+#endif // wxUSE_UNICODE
+ )
{
const wxWindow * const win = wxGetActiveWindow();