mirror of
https://github.com/sigmasternchen/Wish
synced 2025-03-15 07:28:56 +00:00
preparation for special key handling (like ctrl, alt, alt gr...)
This commit is contained in:
parent
960e6ec044
commit
09e14328b8
2 changed files with 10 additions and 5 deletions
13
Emulator.js
13
Emulator.js
|
@ -76,19 +76,24 @@ Emulator.genericKeyHandler = function(keycode) {
|
|||
Emulator.interrupts['key'](keycode);
|
||||
}
|
||||
Emulator.handleKeyPress = function(e) {
|
||||
Emulator.genericKeyHandler(Emulator.getKeyCode(e));
|
||||
Emulator.genericKeyHandler(Emulator.getKeyCode(e), {
|
||||
"ctrl": e.ctrlKey,
|
||||
"alt": e.altKey,
|
||||
"altgr": e.altGraphKey
|
||||
};
|
||||
}
|
||||
Emulator.handleKeyDown = function(e) {
|
||||
var keycode = Emulator.getKeyCode(e);
|
||||
if (keycode == 8 || keycode == 46) {
|
||||
Emulator.handleKeyPress(e);
|
||||
Emulator.handleKeyPress(e);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
Emulator.refocus = function () {
|
||||
window.setTimeout(function() {Emulator.input.focus();}, 1);
|
||||
console.log("Emulator: refocus input")
|
||||
window.setTimeout(function() {
|
||||
Emulator.input.focus();}, 1);
|
||||
console.log("Emulator: refocus input");
|
||||
}
|
||||
Emulator.tick = function (time) {
|
||||
if (Emulator.interrupts[time])
|
||||
|
|
|
@ -4,7 +4,7 @@ Kernel.IO.inputBuffer;
|
|||
Kernel.IO.init = function() {
|
||||
Kernel.IO.inputBuffer = new Array();
|
||||
}
|
||||
Kernel.IO.key = function(code) {
|
||||
Kernel.IO.key = function(code, modKeys) {
|
||||
Kernel.IO.inputBuffer.push(code);
|
||||
}
|
||||
Kernel.IO.powersw = function() {
|
||||
|
|
Loading…
Reference in a new issue