///////////////////////////////////////////////////////
| 629 | |
| 630 | //////////////////////////////////////////////////////////// |
| 631 | String getDescription(Keyboard::Scancode code) |
| 632 | { |
| 633 | // Try to translate the scan code to a consumer key |
| 634 | if (const auto consumerKeyName = sfScanToConsumerKeyName(code)) |
| 635 | return *consumerKeyName; |
| 636 | |
| 637 | WORD winCode = sfScanToWinScanExtended(code); |
| 638 | std::array<WCHAR, 1024> name{}; |
| 639 | |
| 640 | // Remap F13-F23 to values supported by GetKeyNameText |
| 641 | if ((winCode >= 0x64) && (winCode <= 0x6E)) |
| 642 | winCode += 0x18; |
| 643 | // Remap F24 to value supported by GetKeyNameText |
| 644 | if (winCode == 0x76) |
| 645 | winCode = 0x87; |
| 646 | |
| 647 | if (GetKeyNameText(winCode << 16, name.data(), static_cast<int>(name.size())) > 0) |
| 648 | return name.data(); |
| 649 | |
| 650 | return "Unknown"; |
| 651 | } |
| 652 | |
| 653 | |
| 654 | //////////////////////////////////////////////////////////// |
nothing calls this directly
no test coverage detected