handleKeyPress static method
Implementation
static bool handleKeyPress(KeyEvent event, FrameworkModel? framework) {
bool handled = false;
// repeat key
if (event is KeyRepeatEvent) return handled;
// none of the control keys are depressed?
// clear the keys pressed
if (!isAltPressed && !isCtrlPressed && !isShiftPressed) {
keysPressed.clear();
return handled;
}
// key up event?
if (event is KeyUpEvent) return handled;
// key is a special key
if (isControlKey(event.logicalKey)) return handled;
// add the key to the list
keysPressed.add(event.logicalKey);
// fire the frameworks shortcut handler
var shortcut = findMatching(framework?.shortcuts);
if (shortcut != null) {
handled = true;
shortcut.execute("ShortcutHandler", "execute", []);
}
// shortcut was handled?
if (!handled) handled = handleDefaults(framework);
// clear the keys buffer
if (handled) keysPressed.clear();
return handled;
}