MCPcopy Create free account
hub / github.com/OpenRCT2/OpenRCT2 / isSuitableInputEvent

Method isSuitableInputEvent

src/openrct2-ui/input/ShortcutManager.cpp:59–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57}
58
59bool 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
95std::string RegisteredShortcut::getDisplayString() const
96{

Callers 1

processEventMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected