| 46 | } |
| 47 | |
| 48 | std::string WinapiHandler::GetLayoutName(std::string hkl) const { |
| 49 | std::string name = ""; |
| 50 | std::vector<keyboard_layout>::const_iterator it = keyboard_layouts.begin(); |
| 51 | // First we look for existing entries without change. |
| 52 | while (it != keyboard_layouts.end() && (it->first != hkl)) { it++; } |
| 53 | if (it != keyboard_layouts.end()) { |
| 54 | name = it->second; |
| 55 | } else { |
| 56 | // If we didn't find it, then look if the name must be changed. |
| 57 | // For instance 04090409 is loaded as 00000409 (US). |
| 58 | if (hkl.find("0000") != 0) { |
| 59 | hkl = "0000"+hkl.substr(4); |
| 60 | it = keyboard_layouts.begin(); |
| 61 | while (it != keyboard_layouts.end() && (it->first != hkl)) { it++; } |
| 62 | if (it != keyboard_layouts.end()) { |
| 63 | name = it->second; |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | return name; |
| 68 | } |
| 69 | |
| 70 | std::string WinapiHandler::GetLayoutHkl(const std::string& name) const { |
| 71 | std::string hkl = ""; |