* Check if a keycode is bound to something. * @param keycode The keycode that was pressed * @param global_only Limit the search to hotkeys defined as 'global'. * @return The number of the matching hotkey or -1. */
| 299 | * @return The number of the matching hotkey or -1. |
| 300 | */ |
| 301 | int HotkeyList::CheckMatch(uint16_t keycode, bool global_only) const |
| 302 | { |
| 303 | for (const Hotkey &hotkey : this->items) { |
| 304 | auto begin = hotkey.keycodes.begin(); |
| 305 | auto end = hotkey.keycodes.end(); |
| 306 | if (std::find(begin, end, keycode | WKC_GLOBAL_HOTKEY) != end || (!global_only && std::find(begin, end, keycode) != end)) { |
| 307 | return hotkey.num; |
| 308 | } |
| 309 | } |
| 310 | return -1; |
| 311 | } |
| 312 | |
| 313 | |
| 314 | static void SaveLoadHotkeys(bool save) |
no test coverage detected