]> git.saurik.com Git - wxWidgets.git/commitdiff
restore checks for SM_SWAPBUTTON, it is not defined in WinCE SDK
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 24 Feb 2008 22:59:07 +0000 (22:59 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 24 Feb 2008 22:59:07 +0000 (22:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52055 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/settings.cpp
src/msw/window.cpp

index 280c8dd87c0ce9647c1df580229ff7654b4fd735..476873b4af9ef8cf45a4ece9d83a85041c7198a3 100644 (file)
@@ -377,7 +377,13 @@ static const int gs_metricsMap[] =
 #else
     -1,
 #endif
+    // SM_SWAPBUTTON is not available under CE and it doesn't make sense to ask
+    // for it there
+#ifdef SM_SWAPBUTTON
     SM_SWAPBUTTON,
+#else
+    -1,
+#endif
     -1   // wxSYS_DCLICK_MSEC - not available as system metric
 };
 
index 35e6934ecb611dadd954af7be7950e78f4c78447..53eefe26edec236bb145e7ba44b762e616a30d97 100644 (file)
@@ -6084,6 +6084,9 @@ WXWORD wxCharCodeWXToMSW(int wxk, bool *isVirtual)
             break;
 
         default:
+            // no VkKeyScan() under CE unfortunately, we need to test how does
+            // it handle OEM keys
+#ifndef __WXWINCE__
             // check to see if its one of the OEM key codes.
             BYTE vks = LOBYTE(VkKeyScan(wxk));
             if ( vks != 0xff )
@@ -6091,6 +6094,7 @@ WXWORD wxCharCodeWXToMSW(int wxk, bool *isVirtual)
                 vk = vks;
             }
             else
+#endif // !__WXWINCE__
             {
                 if ( isVirtual )
                     *isVirtual = false;
@@ -6104,15 +6108,20 @@ WXWORD wxCharCodeWXToMSW(int wxk, bool *isVirtual)
 // small helper for wxGetKeyState() and wxGetMouseState()
 static inline bool wxIsKeyDown(WXWORD vk)
 {
-    switch (vk)
+    // SM_SWAPBUTTON is not available under CE, so don't swap buttons there
+#ifdef SM_SWAPBUTTON
+    if ( vk == VK_LBUTTON || vk == VK_RBUTTON )
     {
-        case VK_LBUTTON:
-            if (GetSystemMetrics(SM_SWAPBUTTON)) vk = VK_RBUTTON;
-            break;
-        case VK_RBUTTON:
-            if (GetSystemMetrics(SM_SWAPBUTTON)) vk = VK_LBUTTON;
-            break;
+        if ( ::GetSystemMetrics(SM_SWAPBUTTON) )
+        {
+            if ( vk == VK_LBUTTON )
+                vk = VK_RBUTTON;
+            else // vk == VK_RBUTTON
+                vk = VK_LBUTTON;
+        }
     }
+#endif // SM_SWAPBUTTON
+
     // 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