Applied [ 1613294 ] wxGetMouseState/wxIsKeyDown bug
(troelsk - allow for left-handed mouse) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44544 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -5769,13 +5769,26 @@ WXWORD wxCharCodeWXToMSW(int wxk, bool *isVirtual)
|
||||
return vk;
|
||||
}
|
||||
|
||||
#ifndef SM_SWAPBUTTON
|
||||
#define SM_SWAPBUTTON 23
|
||||
#endif
|
||||
|
||||
// small helper for wxGetKeyState() and wxGetMouseState()
|
||||
static inline bool wxIsKeyDown(WXWORD vk)
|
||||
{
|
||||
switch (vk)
|
||||
{
|
||||
case VK_LBUTTON:
|
||||
if (GetSystemMetrics(SM_SWAPBUTTON)) vk = VK_RBUTTON;
|
||||
break;
|
||||
case VK_RBUTTON:
|
||||
if (GetSystemMetrics(SM_SWAPBUTTON)) vk = VK_LBUTTON;
|
||||
break;
|
||||
}
|
||||
// the low order bit indicates whether the key was pressed since the last
|
||||
// call and the high order one indicates whether it is down right now and
|
||||
// we only want that one
|
||||
return (::GetAsyncKeyState(vk) & (1<<15)) != 0;
|
||||
return (GetAsyncKeyState(vk) & (1<<15)) != 0;
|
||||
}
|
||||
|
||||
bool wxGetKeyState(wxKeyCode key)
|
||||
@@ -5795,7 +5808,7 @@ bool wxGetKeyState(wxKeyCode key)
|
||||
// low order bit means LED is highlighted and high order one means the
|
||||
// key is down; for compatibility with the other ports return true if
|
||||
// either one is set
|
||||
return ::GetKeyState(vk) != 0;
|
||||
return GetKeyState(vk) != 0;
|
||||
|
||||
}
|
||||
else // normal key
|
||||
|
Reference in New Issue
Block a user