| 152 | } |
| 153 | |
| 154 | void ShortcutManager::processEvent(const InputEvent& e) |
| 155 | { |
| 156 | if (!isPendingShortcutChange()) |
| 157 | { |
| 158 | for (const auto& shortcut : shortcuts) |
| 159 | { |
| 160 | if (shortcut.second.matches(e)) |
| 161 | { |
| 162 | shortcut.second.action(); |
| 163 | } |
| 164 | } |
| 165 | } |
| 166 | else |
| 167 | { |
| 168 | auto shortcut = getShortcut(_pendingShortcutChange); |
| 169 | if (shortcut != nullptr && shortcut->isSuitableInputEvent(e)) |
| 170 | { |
| 171 | auto shortcutInput = ShortcutInput::fromInputEvent(e); |
| 172 | if (shortcutInput.has_value()) |
| 173 | { |
| 174 | shortcut->current.clear(); |
| 175 | shortcut->current.push_back(std::move(shortcutInput.value())); |
| 176 | } |
| 177 | _pendingShortcutChange.clear(); |
| 178 | |
| 179 | auto* windowMgr = GetWindowManager(); |
| 180 | windowMgr->CloseByClass(WindowClass::changeKeyboardShortcut); |
| 181 | saveUserBindings(); |
| 182 | } |
| 183 | } |
| 184 | } |
| 185 | |
| 186 | bool ShortcutManager::processEventForSpecificShortcut(const InputEvent& e, std::string_view id) |
| 187 | { |
no test coverage detected