Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix broken ESCAPE and ENTER other special keys #514

Merged
merged 3 commits into from
Jan 30, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions src/spiritual/spiritual-mix/gui-keys@wunderbyte.com/module.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,15 +122,35 @@ gui.KeysModule = gui.module('gui-keys@wunderbyte.com', {
* that we had really build a cross-frame keylogger and now we only broadcast
* special keys such as UP, DOWN, LEFT, RIGHT, ENTER and ESCAPE and so on.
* If needed, we could probably (safely) broadcast key combos such as `Shift+S`.
* @see https://w3c.github.io/uievents/#fixed-virtual-key-codes
* @param {boolean} down
* @param {String} key Newschool ABORTED FOR NOW
* @param {String} c (char) Bothschool
* @param {number} code Oldschool
* @param {String} sig Contextkey
*/
_maybebroadcast: function(down, key, c, code, sig) {
if (!c) {
this._broadcast(down, key, c, code, sig);
switch (code) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might as well add all the codes from https://w3c.github.io/uievents/#fixed-virtual-key-codes

did a quick regex on the table: (.*)\t(\d+) => case $2: // $1

case 8: // Backspace	
case 9: // Tab	
case 13: // Enter	
case 16: // Shift	
case 17: // Control	
case 18: // Alt	
case 20: // CapsLock	
case 27: // Escape
case 32: // Space	
case 33: // PageUp	
case 34: // PageDown	
case 35: // End	
case 36: // Home	
case 37: // ArrowLeft	
case 38: // ArrowUp	
case 39: // ArrowRight	
case 40: // ArrowDown	
case 46: // Delete

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

case 8: // Backspace
case 9: // Tab
case 13: // Enter
case 16: // Shift
case 17: // Control
case 18: // Alt
case 20: // CapsLock
case 27: // Escape
case 32: // Space
case 33: // PageUp
case 34: // PageDown
case 35: // End
case 36: // Home
case 37: // ArrowLeft
case 38: // ArrowUp
case 39: // ArrowRight
case 40: // ArrowDown
case 46: // Delete
this._broadcast(down, key, c, code, sig);
break;
}
},

Expand Down