MCPcopy Create free account
hub / github.com/VCVRack/Rack / isKeyCommand

Method isKeyCommand

src/widget/event.cpp:76–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

74
75
76bool Widget::KeyBaseEvent::isKeyCommand(int key, int mods) const {
77 // DEBUG("this key '%c' %d keyName \"%s\" mods 0x%02x | checked key '%c' %d mods 0x%02x", this->key, this->key, this->keyName.c_str(), this->mods, key, key, mods);
78 // Reject if mods don't match
79 if ((this->mods & RACK_MOD_MASK) != mods)
80 return false;
81 // Reject control characters. GLFW shouldn't generate these anyway.
82 if (this->key < 32)
83 return false;
84 // Are both keys printable?
85 if (this->key < 128 && key < 128) {
86 // Is the event a printable ASCII character?
87 if (this->keyName.size() == 1) {
88 // Uppercase event key name
89 char k = this->keyName[0];
90 if (k >= 'a' && k <= 'z')
91 k += 'A' - 'a';
92 return k == key;
93 }
94 }
95 // Check equal GLFW key ID, printable or not
96 return this->key == key;
97}
98
99
100void EventState::setHoveredWidget(widget::Widget* w) {

Callers 11

onSelectKeyMethod · 0.80
onSelectKeyMethod · 0.80
onHoverKeyMethod · 0.80
onHoverKeyMethod · 0.80
onSelectKeyMethod · 0.80
onHoverKeyMethod · 0.80
onHoverKeyMethod · 0.80
onSelectKeyMethod · 0.80
onSelectKeyMethod · 0.80
onHoverKeyMethod · 0.80
onHoverKeyMethod · 0.80

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected