Bug 1210033 - Add on-screen keyboard diagnostic information to about:support. r=masayuki r=felipe

This commit is contained in:
Jared Wein 2015-10-08 11:51:47 -04:00
Родитель f39b849fea
Коммит f6f9ada2ed
3 изменённых файлов: 54 добавлений и 7 удалений

Просмотреть файл

@ -3270,6 +3270,11 @@ pref("ui.osk.on_screen_keyboard_path", "");
// Only show the on-screen keyboard when Windows is in Tablet mode. Setting
// this pref to false will allow the OSK to show in regular non-tablet mode.
pref("ui.osk.require_tablet_mode", true);
// This pref stores the "reason" that the on-screen keyboard was either
// shown or not shown when focus is moved to an editable text field. It is
// used to help debug why the keyboard is either not appearing when expected
// or appearing when it is not expected.
pref("ui.osk.debug.keyboardDisplayReason", "");
# XP_WIN
#endif

Просмотреть файл

@ -89,6 +89,10 @@ const PREFS_WHITELIST = [
"storage.vacuum.last.",
"svg.",
"toolkit.startup.recent_crashes",
"ui.osk.enabled",
"ui.osk.detect_physical_keyboard",
"ui.osk.require_tablet_mode",
"ui.osk.debug.keyboardDisplayReason",
"webgl.",
];

Просмотреть файл

@ -29,6 +29,7 @@ const char* kOskPathPrefName = "ui.osk.on_screen_keyboard_path";
const char* kOskEnabled = "ui.osk.enabled";
const char* kOskDetectPhysicalKeyboard = "ui.osk.detect_physical_keyboard";
const char* kOskRequireTabletMode = "ui.osk.require_tablet_mode";
const char* kOskDebugReason = "ui.osk.debug.keyboardDisplayReason";
namespace mozilla {
namespace widget {
@ -547,7 +548,7 @@ IMEHandler::MaybeShowOnScreenKeyboard()
return;
}
IMEHandler::ShowOnScreenKeyboard();
IMEHandler::ShowOnScreenKeyboard();
}
// static
@ -590,22 +591,26 @@ IMEHandler::IsKeyboardPresentOnSlate()
{
// This function is only supported for Windows 8 and up.
if (!IsWin8OrLater()) {
Preferences::SetString(kOskDebugReason, L"IKPOS: Requires Win8+.");
return true;
}
if (!Preferences::GetBool(kOskDetectPhysicalKeyboard, true)) {
// Detection for physical keyboard has been disabled for testing.
Preferences::SetString(kOskDebugReason, L"IKPOS: Detection disabled.");
return false;
}
// This function should be only invoked for machines with touch screens.
if ((::GetSystemMetrics(SM_DIGITIZER) & NID_INTEGRATED_TOUCH)
!= NID_INTEGRATED_TOUCH) {
Preferences::SetString(kOskDebugReason,
L"IKPOS: Touch screen not found.");
return true;
}
// If the device is docked, the user is treating the device as a PC.
if (::GetSystemMetrics(SM_SYSTEMDOCKED) != 0) {
Preferences::SetString(kOskDebugReason, L"IKPOS: System docked.");
return true;
}
@ -632,11 +637,16 @@ IMEHandler::IsKeyboardPresentOnSlate()
if (get_rotation_state) {
AR_STATE auto_rotation_state = AR_ENABLED;
get_rotation_state(&auto_rotation_state);
if ((auto_rotation_state & AR_NOSENSOR) ||
(auto_rotation_state & AR_NOT_SUPPORTED)) {
// If there is no auto rotation sensor or rotation is not supported in
// the current configuration, then we can assume that this is a desktop
// or a traditional laptop.
// If there is no auto rotation sensor or rotation is not supported in
// the current configuration, then we can assume that this is a desktop
// or a traditional laptop.
if (auto_rotation_state & AR_NOSENSOR) {
Preferences::SetString(kOskDebugReason,
L"IKPOS: Rotation sensor not found.");
return true;
} else if (auto_rotation_state & AR_NOT_SUPPORTED) {
Preferences::SetString(kOskDebugReason,
L"IKPOS: Auto-rotation not supported.");
return true;
}
}
@ -653,6 +663,11 @@ IMEHandler::IsKeyboardPresentOnSlate()
POWER_PLATFORM_ROLE role = power_determine_platform_role();
if (((role == PlatformRoleMobile) || (role == PlatformRoleSlate)) &&
(::GetSystemMetrics(SM_CONVERTIBLESLATEMODE) == 0)) {
if (role == PlatformRoleMobile) {
Preferences::SetString(kOskDebugReason, L"IKPOS: PlatformRoleMobile.");
} else if (role == PlatformRoleSlate) {
Preferences::SetString(kOskDebugReason, L"IKPOS: PlatformRoleSlate.");
}
return false;
}
}
@ -666,6 +681,7 @@ IMEHandler::IsKeyboardPresentOnSlate()
::SetupDiGetClassDevs(&KEYBOARD_CLASS_GUID, nullptr,
nullptr, DIGCF_PRESENT);
if (device_info == INVALID_HANDLE_VALUE) {
Preferences::SetString(kOskDebugReason, L"IKPOS: No keyboard info.");
return false;
}
@ -696,10 +712,14 @@ IMEHandler::IsKeyboardPresentOnSlate()
// return true if the API's report one or more keyboards. Please note
// that this will break for non keyboard devices which expose a
// keyboard PDO.
Preferences::SetString(kOskDebugReason,
L"IKPOS: Keyboard presence confirmed.");
return true;
}
}
}
Preferences::SetString(kOskDebugReason,
L"IKPOS: Lack of keyboard confirmed.");
return false;
}
@ -710,10 +730,17 @@ IMEHandler::IsInTabletMode()
nsCOMPtr<nsIWindowsUIUtils>
uiUtils(do_GetService("@mozilla.org/windows-ui-utils;1"));
if (NS_WARN_IF(!uiUtils)) {
Preferences::SetString(kOskDebugReason,
L"IITM: nsIWindowsUIUtils not available.");
return false;
}
bool isInTabletMode = false;
uiUtils->GetInTabletMode(&isInTabletMode);
if (isInTabletMode) {
Preferences::SetString(kOskDebugReason, L"IITM: GetInTabletMode=true.");
} else {
Preferences::SetString(kOskDebugReason, L"IITM: GetInTabletMode=false.");
}
return isInTabletMode;
}
@ -725,12 +752,16 @@ IMEHandler::AutoInvokeOnScreenKeyboardInDesktopMode()
nsCOMPtr<nsIWindowsRegKey> regKey
(do_CreateInstance("@mozilla.org/windows-registry-key;1", &rv));
if (NS_WARN_IF(NS_FAILED(rv))) {
Preferences::SetString(kOskDebugReason, L"AIOSKIDM: "
L"nsIWindowsRegKey not available");
return false;
}
rv = regKey->Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER,
NS_LITERAL_STRING("SOFTWARE\\Microsoft\\TabletTip\\1.7"),
nsIWindowsRegKey::ACCESS_QUERY_VALUE);
if (NS_FAILED(rv)) {
Preferences::SetString(kOskDebugReason,
L"AIOSKIDM: failed opening regkey.");
return false;
}
// EnableDesktopModeAutoInvoke is an opt-in option from the Windows
@ -741,8 +772,15 @@ IMEHandler::AutoInvokeOnScreenKeyboardInDesktopMode()
rv = regKey->ReadIntValue(NS_LITERAL_STRING("EnableDesktopModeAutoInvoke"),
&value);
if (NS_FAILED(rv)) {
Preferences::SetString(kOskDebugReason,
L"AIOSKIDM: failed reading value of regkey.");
return false;
}
if (!!value) {
Preferences::SetString(kOskDebugReason, L"AIOSKIDM: regkey value=true.");
} else {
Preferences::SetString(kOskDebugReason, L"AIOSKIDM: regkey value=false.");
}
return !!value;
}