This commit is contained in:
Adam D. Ruppe 2017-11-20 10:08:24 -05:00
parent 6e0b22583f
commit 971490085d
1 changed files with 11 additions and 9 deletions

View File

@ -3382,15 +3382,17 @@ class Window : Widget {
}
bool dispatchKeyEvent(KeyEvent ev) {
if(focusedWidget) {
auto event = new Event(ev.pressed ? "keydown" : "keyup", focusedWidget);
event.originalKeyEvent = ev;
event.character = ev.character;
event.key = ev.key;
event.state = ev.modifierState;
event.shiftKey = (ev.modifierState & ModifierState.shift) ? true : false;
event.dispatch();
}
auto wid = focusedWidget;
if(wid is null)
wid = this;
auto event = new Event(ev.pressed ? "keydown" : "keyup", wid);
event.originalKeyEvent = ev;
event.character = ev.character;
event.key = ev.key;
event.state = ev.modifierState;
event.shiftKey = (ev.modifierState & ModifierState.shift) ? true : false;
event.dispatch();
return true;
}