No real changes, just some small cleanup in wxMSW keyboard code.
No changes, just use more clear variable name ("keycode" instead of "id") and anonymous namespace instead of static keyword. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65513 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -5643,18 +5643,18 @@ wxKeyEvent wxWindowMSW::CreateKeyEvent(wxEventType evType,
|
|||||||
// WM_KEYDOWN one
|
// WM_KEYDOWN one
|
||||||
bool wxWindowMSW::HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII)
|
bool wxWindowMSW::HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII)
|
||||||
{
|
{
|
||||||
int id;
|
int keycode;
|
||||||
if ( isASCII )
|
if ( isASCII )
|
||||||
{
|
{
|
||||||
id = wParam;
|
keycode = wParam;
|
||||||
}
|
}
|
||||||
else // we're called from WM_KEYDOWN
|
else // we're called from WM_KEYDOWN
|
||||||
{
|
{
|
||||||
// don't pass lParam to wxCharCodeMSWToWX() here because we don't want
|
// don't pass lParam to wxCharCodeMSWToWX() here because we don't want
|
||||||
// to get numpad key codes: CHAR events should use the logical keys
|
// to get numpad key codes: CHAR events should use the logical keys
|
||||||
// such as WXK_HOME instead of WXK_NUMPAD_HOME which is for KEY events
|
// such as WXK_HOME instead of WXK_NUMPAD_HOME which is for KEY events
|
||||||
id = wxCharCodeMSWToWX(wParam);
|
keycode = wxCharCodeMSWToWX(wParam);
|
||||||
if ( id == 0 )
|
if ( keycode == 0 )
|
||||||
{
|
{
|
||||||
// it's ASCII and will be processed here only when called from
|
// it's ASCII and will be processed here only when called from
|
||||||
// WM_CHAR (i.e. when isASCII = true), don't process it now
|
// WM_CHAR (i.e. when isASCII = true), don't process it now
|
||||||
@@ -5662,7 +5662,7 @@ bool wxWindowMSW::HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxKeyEvent event(CreateKeyEvent(wxEVT_CHAR, id, lParam, wParam));
|
wxKeyEvent event(CreateKeyEvent(wxEVT_CHAR, keycode, lParam, wParam));
|
||||||
|
|
||||||
// the alphanumeric keys produced by pressing AltGr+something on European
|
// the alphanumeric keys produced by pressing AltGr+something on European
|
||||||
// keyboards have both Ctrl and Alt modifiers which may confuse the user
|
// keyboards have both Ctrl and Alt modifiers which may confuse the user
|
||||||
@@ -5671,7 +5671,7 @@ bool wxWindowMSW::HandleChar(WXWPARAM wParam, WXLPARAM lParam, bool isASCII)
|
|||||||
// KEY_DOWN event would still have the correct modifiers if they're really
|
// KEY_DOWN event would still have the correct modifiers if they're really
|
||||||
// needed)
|
// needed)
|
||||||
if ( event.m_controlDown && event.m_altDown &&
|
if ( event.m_controlDown && event.m_altDown &&
|
||||||
(id >= 32 && id < 256) )
|
(keycode >= 32 && keycode < 256) )
|
||||||
{
|
{
|
||||||
event.m_controlDown =
|
event.m_controlDown =
|
||||||
event.m_altDown = false;
|
event.m_altDown = false;
|
||||||
@@ -6020,9 +6020,12 @@ void wxGetCharSize(WXHWND wnd, int *x, int *y, const wxFont& the_font)
|
|||||||
// the_font.ReleaseResource();
|
// the_font.ReleaseResource();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
|
||||||
// use the "extended" bit (24) of lParam to distinguish extended keys
|
// use the "extended" bit (24) of lParam to distinguish extended keys
|
||||||
// from normal keys as the same key is sent
|
// from normal keys as the same key is sent
|
||||||
static inline
|
inline
|
||||||
int ChooseNormalOrExtended(int lParam, int keyNormal, int keyExtended)
|
int ChooseNormalOrExtended(int lParam, int keyNormal, int keyExtended)
|
||||||
{
|
{
|
||||||
// except that if lParam is 0, it means we don't have real lParam from
|
// except that if lParam is 0, it means we don't have real lParam from
|
||||||
@@ -6037,7 +6040,7 @@ int ChooseNormalOrExtended(int lParam, int keyNormal, int keyExtended)
|
|||||||
//
|
//
|
||||||
// note that keys having a normal and numpad version (e.g. WXK_HOME and
|
// note that keys having a normal and numpad version (e.g. WXK_HOME and
|
||||||
// WXK_NUMPAD_HOME) are not included in this table as the mapping is not 1-to-1
|
// WXK_NUMPAD_HOME) are not included in this table as the mapping is not 1-to-1
|
||||||
static const struct wxKeyMapping
|
const struct wxKeyMapping
|
||||||
{
|
{
|
||||||
int vk;
|
int vk;
|
||||||
wxKeyCode wxk;
|
wxKeyCode wxk;
|
||||||
@@ -6111,6 +6114,8 @@ static const struct wxKeyMapping
|
|||||||
#endif // VK_APPS defined
|
#endif // VK_APPS defined
|
||||||
};
|
};
|
||||||
|
|
||||||
|
} // anonymous namespace
|
||||||
|
|
||||||
// Returns 0 if was a normal ASCII value, not a special key. This indicates that
|
// Returns 0 if was a normal ASCII value, not a special key. This indicates that
|
||||||
// the key should be ignored by WM_KEYDOWN and processed by WM_CHAR instead.
|
// the key should be ignored by WM_KEYDOWN and processed by WM_CHAR instead.
|
||||||
int wxCharCodeMSWToWX(int vk, WXLPARAM lParam)
|
int wxCharCodeMSWToWX(int vk, WXLPARAM lParam)
|
||||||
|
Reference in New Issue
Block a user