Issue #1595 part 5: Remove Vista checks in Windows widget code

This commit is contained in:
Pale Moon
2018-01-20 12:04:19 +01:00
committed by Roy Tam
parent 21efd52b38
commit 69d7cf9cea
10 changed files with 202 additions and 439 deletions
+4 -18
View File
@@ -1016,9 +1016,7 @@ NativeKey::GetScanCodeWithExtendedFlag() const
// MapVirtualKeyEx() has been improved for supporting extended keys since
// Vista. When we call it for mapping a scancode of an extended key and
// a virtual keycode, we need to add 0xE000 to the scancode.
// On Win XP and Win Server 2003, this doesn't support. On them, we have
// no way to get virtual keycodes from scancode of extended keys.
if (!mIsExtended || !IsVistaOrLater()) {
if (!mIsExtended) {
return mScanCode;
}
return (0xE000 | mScanCode);
@@ -1094,12 +1092,7 @@ bool
NativeKey::CanComputeVirtualKeyCodeFromScanCode() const
{
// Vista or later supports ScanCodeEx.
if (IsVistaOrLater()) {
return true;
}
// Otherwise, MapVirtualKeyEx() can compute virtual keycode only with
// non-extended key.
return !mIsExtended;
return true;
}
uint8_t
@@ -1125,8 +1118,7 @@ NativeKey::ComputeScanCodeExFromVirtualKeyCode(UINT aVirtualKeyCode) const
{
return static_cast<uint16_t>(
::MapVirtualKeyEx(aVirtualKeyCode,
IsVistaOrLater() ? MAPVK_VK_TO_VSC_EX :
MAPVK_VK_TO_VSC,
MAPVK_VK_TO_VSC_EX,
mKeyboardLayout));
}
@@ -2384,8 +2376,7 @@ KeyboardLayout::LoadLayout(HKL aLayout)
#ifdef PR_LOGGING
if (PR_LOG_TEST(sKeyboardLayoutLogger, PR_LOG_DEBUG)) {
static const UINT kExtendedScanCode[] = { 0x0000, 0xE000 };
static const UINT kMapType =
IsVistaOrLater() ? MAPVK_VSC_TO_VK_EX : MAPVK_VSC_TO_VK;
static const UINT kMapType = MAPVK_VSC_TO_VK_EX;
PR_LOG(sKeyboardLayoutLogger, PR_LOG_DEBUG,
("Logging virtual keycode values for scancode (0x%p)...",
mKeyboardLayout));
@@ -2397,11 +2388,6 @@ KeyboardLayout::LoadLayout(HKL aLayout)
PR_LOG(sKeyboardLayoutLogger, PR_LOG_DEBUG,
("0x%04X, %s", scanCode, kVirtualKeyName[virtualKeyCode]));
}
// XP and Server 2003 don't support 0xE0 prefix of the scancode.
// Therefore, we don't need to continue on them.
if (!IsVistaOrLater()) {
break;
}
}
}
#endif // #ifdef PR_LOGGING