]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied [ 1613294 ] wxGetMouseState/wxIsKeyDown bug
authorJulian Smart <julian@anthemion.co.uk>
Wed, 21 Feb 2007 15:07:26 +0000 (15:07 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Wed, 21 Feb 2007 15:07:26 +0000 (15:07 +0000)
(troelsk - allow for left-handed mouse)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44544 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/window.cpp

index 00465394809251ea48d2cd48bbbf5cefab636f4c..7d80f8dd6bee78f2c07526acc91f7be1d36c5231 100644 (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