| 597 | } |
| 598 | |
| 599 | bool InputManager::IsSingleKey(const std::wstring& input) { |
| 600 | bool is_single_key = true; |
| 601 | //StringUtilities::ComposeUnicodeString(input); |
| 602 | std::wstring composed_input = input; |
| 603 | StringUtilities::ComposeUnicodeString(&composed_input); |
| 604 | if (composed_input.size() > 1) { |
| 605 | WORD combining_bitmask = C3_NONSPACING | C3_DIACRITIC | C3_VOWELMARK; |
| 606 | std::vector<WORD> char_types(input.size()); |
| 607 | BOOL get_type_success = ::GetStringTypeW(CT_CTYPE3, |
| 608 | input.c_str(), |
| 609 | static_cast<int>(input.size()), |
| 610 | &char_types[0]); |
| 611 | if (get_type_success) { |
| 612 | bool found_alpha = false; |
| 613 | for (size_t i = 0; i < char_types.size(); ++i) { |
| 614 | if (char_types[i] & combining_bitmask) { |
| 615 | continue; |
| 616 | } |
| 617 | |
| 618 | if (char_types[i] & C3_ALPHA) { |
| 619 | if (!found_alpha) { |
| 620 | found_alpha = true; |
| 621 | } else { |
| 622 | is_single_key = false; |
| 623 | break; |
| 624 | } |
| 625 | } |
| 626 | } |
| 627 | } |
| 628 | } |
| 629 | if (!is_single_key) { |
| 630 | LOG(WARN) << "key value did not pass validation"; |
| 631 | } |
| 632 | return is_single_key; |
| 633 | } |
| 634 | |
| 635 | int InputManager::Pause(BrowserHandle browser_wrapper, |
| 636 | const Json::Value& pause_action) { |