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:
Julian Smart
2007-02-21 15:07:26 +00:00
parent d7330233fd
commit b8f434e731

View File

@@ -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