From f22e73e02b547f7a36b41d15f9e8d60a4eb8520b Mon Sep 17 00:00:00 2001 From: Gijs Kruitbosch Date: Mon, 18 Jan 2016 13:07:55 +0000 Subject: [PATCH] Bug 1236058 - recognize bluetooth keyboard devices when determining whether to show an on-screen keyboard, r=masayuki,f=jaws --- widget/windows/WinIMEHandler.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/widget/windows/WinIMEHandler.cpp b/widget/windows/WinIMEHandler.cpp index 97880fba0c7..e49cf67cde0 100644 --- a/widget/windows/WinIMEHandler.cpp +++ b/widget/windows/WinIMEHandler.cpp @@ -670,7 +670,7 @@ IMEHandler::IsKeyboardPresentOnSlate() // that the OSK is displayed. // 3. If step 1 and 2 fail then we check attached keyboards and return true - // if we find ACPI\* or HID\VID* keyboards. + // if we find ACPI\*, HID\VID* or bluetooth keyboards. typedef BOOL (WINAPI* GetAutoRotationState)(PAR_STATE state); GetAutoRotationState get_rotation_state = @@ -763,12 +763,18 @@ IMEHandler::IsKeyboardPresentOnSlate() MAX_DEVICE_ID_LEN, 0); if (status == CR_SUCCESS) { + static const std::wstring BT_HID_DEVICE = L"HID\\{00001124"; + static const std::wstring BT_HOGP_DEVICE = L"HID\\{00001812"; // To reduce the scope of the hack we only look for ACPI and HID\\VID // prefixes in the keyboard device ids. if (IMEHandler::WStringStartsWithCaseInsensitive(device_id, L"ACPI") || IMEHandler::WStringStartsWithCaseInsensitive(device_id, - L"HID\\VID")) { + L"HID\\VID") || + IMEHandler::WStringStartsWithCaseInsensitive(device_id, + BT_HID_DEVICE) || + IMEHandler::WStringStartsWithCaseInsensitive(device_id, + BT_HOGP_DEVICE)) { // The heuristic we are using is to check the count of keyboards and // return true if the API's report one or more keyboards. Please note // that this will break for non keyboard devices which expose a