From: Vadim Zeitlin Date: Sun, 24 Feb 2008 22:59:07 +0000 (+0000) Subject: restore checks for SM_SWAPBUTTON, it is not defined in WinCE SDK X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/d9fda37ba1e29443ed473d3c69e71480935e09b7 restore checks for SM_SWAPBUTTON, it is not defined in WinCE SDK git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52055 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/settings.cpp b/src/msw/settings.cpp index 280c8dd87c..476873b4af 100644 --- a/src/msw/settings.cpp +++ b/src/msw/settings.cpp @@ -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 }; diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 35e6934ecb..53eefe26ed 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -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