| 74 | |
| 75 | |
| 76 | bool 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 | |
| 100 | void EventState::setHoveredWidget(widget::Widget* w) { |
no test coverage detected