From: Julian Smart Date: Wed, 21 Feb 2007 15:07:26 +0000 (+0000) Subject: Applied [ 1613294 ] wxGetMouseState/wxIsKeyDown bug X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/b8f434e731d0f6153a87988777baa4c2fbe629c6 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 --- diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 0046539480..7d80f8dd6b 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -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