| 57 | } |
| 58 | |
| 59 | bool RegisteredShortcut::isSuitableInputEvent(const InputEvent& e) const |
| 60 | { |
| 61 | // Do not intercept button releases |
| 62 | if (e.state == InputEventState::release) |
| 63 | { |
| 64 | return false; |
| 65 | } |
| 66 | |
| 67 | if (e.deviceKind == InputDeviceKind::mouse) |
| 68 | { |
| 69 | // Do not allow LMB or RMB to be shortcut |
| 70 | if (e.button == 0 || e.button == 1) |
| 71 | { |
| 72 | return false; |
| 73 | } |
| 74 | } |
| 75 | else if (e.deviceKind == InputDeviceKind::keyboard) |
| 76 | { |
| 77 | // Do not allow modifier keys alone |
| 78 | switch (e.button) |
| 79 | { |
| 80 | case SDLK_LCTRL: |
| 81 | case SDLK_RCTRL: |
| 82 | case SDLK_LSHIFT: |
| 83 | case SDLK_RSHIFT: |
| 84 | case SDLK_LALT: |
| 85 | case SDLK_RALT: |
| 86 | case SDLK_LGUI: |
| 87 | case SDLK_RGUI: |
| 88 | return false; |
| 89 | } |
| 90 | } |
| 91 | |
| 92 | return true; |
| 93 | } |
| 94 | |
| 95 | std::string RegisteredShortcut::getDisplayString() const |
| 96 | { |