From: Michael Jumper Date: Sun, 3 Jul 2011 22:32:06 +0000 (-0700) Subject: Removed keymap (merged into keyboard), fixed JS semicolons, etc. X-Git-Url: http://git.alex.org.uk Removed keymap (merged into keyboard), fixed JS semicolons, etc. --- diff --git a/src/main/resources/guacamole.js b/src/main/resources/guacamole.js index ead5484..54153c5 100644 --- a/src/main/resources/guacamole.js +++ b/src/main/resources/guacamole.js @@ -54,7 +54,6 @@ function GuacamoleClient(display, tunnel) { var cursorHotspotX = 0; var cursorHotspotY = 0; - // FIXME: Make object. Clean up. var cursorRectX = 0; var cursorRectY = 0; var cursorRectW = 0; @@ -131,7 +130,7 @@ function GuacamoleClient(display, tunnel) { var nameHandler = null; this.setNameHandler = function(handler) { nameHandler = handler; - } + }; var errorHandler = null; this.setErrorHandler = function(handler) { @@ -354,7 +353,7 @@ function GuacamoleClient(display, tunnel) { if (layersToSync == 0) tunnel.sendMessage("sync:" + timestamp + ";"); - }, + } }; diff --git a/src/main/resources/keyboard.js b/src/main/resources/keyboard.js index b5e6e93..e0f784d 100644 --- a/src/main/resources/keyboard.js +++ b/src/main/resources/keyboard.js @@ -19,6 +19,52 @@ function GuacamoleKeyboard(element) { + // Keymap + + var unshiftedKeySym = new Array(); + unshiftedKeySym[8] = 0xFF08; // backspace + unshiftedKeySym[9] = 0xFF09; // tab + unshiftedKeySym[13] = 0xFF0D; // enter + unshiftedKeySym[16] = 0xFFE1; // shift + unshiftedKeySym[17] = 0xFFE3; // ctrl + unshiftedKeySym[18] = 0xFFE9; // alt + unshiftedKeySym[19] = 0xFF13; // pause/break + unshiftedKeySym[20] = 0xFFE5; // caps lock + unshiftedKeySym[27] = 0xFF1B; // escape + unshiftedKeySym[33] = 0xFF55; // page up + unshiftedKeySym[34] = 0xFF56; // page down + unshiftedKeySym[35] = 0xFF57; // end + unshiftedKeySym[36] = 0xFF50; // home + unshiftedKeySym[37] = 0xFF51; // left arrow + unshiftedKeySym[38] = 0xFF52; // up arrow + unshiftedKeySym[39] = 0xFF53; // right arrow + unshiftedKeySym[40] = 0xFF54; // down arrow + unshiftedKeySym[45] = 0xFF63; // insert + unshiftedKeySym[46] = 0xFFFF; // delete + unshiftedKeySym[91] = 0xFFEB; // left window key (super_l) + unshiftedKeySym[92] = 0xFF67; // right window key (menu key?) + unshiftedKeySym[93] = null; // select key + unshiftedKeySym[112] = 0xFFBE; // f1 + unshiftedKeySym[113] = 0xFFBF; // f2 + unshiftedKeySym[114] = 0xFFC0; // f3 + unshiftedKeySym[115] = 0xFFC1; // f4 + unshiftedKeySym[116] = 0xFFC2; // f5 + unshiftedKeySym[117] = 0xFFC3; // f6 + unshiftedKeySym[118] = 0xFFC4; // f7 + unshiftedKeySym[119] = 0xFFC5; // f8 + unshiftedKeySym[120] = 0xFFC6; // f9 + unshiftedKeySym[121] = 0xFFC7; // f10 + unshiftedKeySym[122] = 0xFFC8; // f11 + unshiftedKeySym[123] = 0xFFC9; // f12 + unshiftedKeySym[144] = 0xFF7F; // num lock + unshiftedKeySym[145] = 0xFF14; // scroll lock + + // Shifted versions, IF DIFFERENT FROM UNSHIFTED! + // If any of these are null, the unshifted one will be used. + var shiftedKeySym = new Array(); + shiftedKeySym[18] = 0xFFE7; // alt + + /*****************************************/ /*** Keyboard Handler ***/ /*****************************************/ @@ -52,27 +98,27 @@ function GuacamoleKeyboard(element) { function getKeySymFromKeyIdentifier(shifted, keyIdentifier) { - var unicodePrefixLocation = keyIdentifier.indexOf("U+"); - if (unicodePrefixLocation >= 0) { + var unicodePrefixLocation = keyIdentifier.indexOf("U+"); + if (unicodePrefixLocation >= 0) { - var hex = keyIdentifier.substring(unicodePrefixLocation+2); - var codepoint = parseInt(hex, 16); - var typedCharacter; + var hex = keyIdentifier.substring(unicodePrefixLocation+2); + var codepoint = parseInt(hex, 16); + var typedCharacter; - // Convert case if shifted - if (shifted == 0) - typedCharacter = String.fromCharCode(codepoint).toLowerCase(); - else - typedCharacter = String.fromCharCode(codepoint).toUpperCase(); + // Convert case if shifted + if (shifted == 0) + typedCharacter = String.fromCharCode(codepoint).toLowerCase(); + else + typedCharacter = String.fromCharCode(codepoint).toUpperCase(); - // Get codepoint - codepoint = typedCharacter.charCodeAt(0); + // Get codepoint + codepoint = typedCharacter.charCodeAt(0); - return getKeySymFromCharCode(codepoint); + return getKeySymFromCharCode(codepoint); - } + } - return null; + return null; } @@ -183,6 +229,8 @@ function GuacamoleKeyboard(element) { return false; } + return true; + }; // When key pressed diff --git a/src/main/resources/keymap.js b/src/main/resources/keymap.js deleted file mode 100644 index 016bf59..0000000 --- a/src/main/resources/keymap.js +++ /dev/null @@ -1,72 +0,0 @@ - -/* - * Guacamole - Clientless Remote Desktop - * Copyright (C) 2010 Michael Jumper - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - - -// Keymap - -var unshiftedKeySym = new Array(); -unshiftedKeySym[8] = 0xFF08; // backspace -unshiftedKeySym[9] = 0xFF09; // tab -unshiftedKeySym[13] = 0xFF0D; // enter -unshiftedKeySym[16] = 0xFFE1; // shift -unshiftedKeySym[17] = 0xFFE3; // ctrl -unshiftedKeySym[18] = 0xFFE9; // alt -unshiftedKeySym[19] = 0xFF13; // pause/break -unshiftedKeySym[20] = 0xFFE5; // caps lock -unshiftedKeySym[27] = 0xFF1B; // escape -unshiftedKeySym[33] = 0xFF55; // page up -unshiftedKeySym[34] = 0xFF56; // page down -unshiftedKeySym[35] = 0xFF57; // end -unshiftedKeySym[36] = 0xFF50; // home -unshiftedKeySym[37] = 0xFF51; // left arrow -unshiftedKeySym[38] = 0xFF52; // up arrow -unshiftedKeySym[39] = 0xFF53; // right arrow -unshiftedKeySym[40] = 0xFF54; // down arrow -unshiftedKeySym[45] = 0xFF63; // insert -unshiftedKeySym[46] = 0xFFFF; // delete -unshiftedKeySym[91] = 0xFFEB; // left window key (super_l) -unshiftedKeySym[92] = 0xFF67; // right window key (menu key?) -unshiftedKeySym[93] = null; // select key -unshiftedKeySym[112] = 0xFFBE; // f1 -unshiftedKeySym[113] = 0xFFBF; // f2 -unshiftedKeySym[114] = 0xFFC0; // f3 -unshiftedKeySym[115] = 0xFFC1; // f4 -unshiftedKeySym[116] = 0xFFC2; // f5 -unshiftedKeySym[117] = 0xFFC3; // f6 -unshiftedKeySym[118] = 0xFFC4; // f7 -unshiftedKeySym[119] = 0xFFC5; // f8 -unshiftedKeySym[120] = 0xFFC6; // f9 -unshiftedKeySym[121] = 0xFFC7; // f10 -unshiftedKeySym[122] = 0xFFC8; // f11 -unshiftedKeySym[123] = 0xFFC9; // f12 -unshiftedKeySym[144] = 0xFF7F; // num lock -unshiftedKeySym[145] = 0xFF14; // scroll lock - -// Shifted versions, IF DIFFERENT FROM UNSHIFTED! -// If any of these are null, the unshifted one will be used. -var shiftedKeySym = new Array(); -shiftedKeySym[18] = 0xFFE7; // alt - -// Constants for keysyms for special keys -var KEYSYM_CTRL = 65507; -var KEYSYM_ALT = 65513; -var KEYSYM_DELETE = 65535; -var KEYSYM_SHIFT = 65505; - - diff --git a/src/main/resources/layer.js b/src/main/resources/layer.js index 6921eb4..775b236 100644 --- a/src/main/resources/layer.js +++ b/src/main/resources/layer.js @@ -68,7 +68,6 @@ function Layer(width, height) { resize(width, height); - var readyHandler = null; var updates = new Array(); var autosize = 0; @@ -84,7 +83,7 @@ function Layer(width, height) { this.handle = function() { updateHandler(); - } + }; } @@ -117,20 +116,12 @@ function Layer(width, height) { updates.shift(); } - // If done with updates, call ready handler - if (display.isReady() && readyHandler != null) - readyHandler(); - } display.isReady = function() { return updates.length == 0; }; - display.setReadyHandler = function(handler) { - readyHandler = handler; - }; - display.drawImage = function(x, y, image) { reserveJob(function() { @@ -165,7 +156,7 @@ function Layer(width, height) { // the ready handler, which requires no pending updates) display.sync = function(handler) { reserveJob(handler); - } + }; display.copyRect = function(srcLayer, srcx, srcy, w, h, x, y) { @@ -226,7 +217,7 @@ function Layer(width, height) { 0xC: "copy", /* 0xD NOT IMPLEMENTED */ 0xE: "source-over", - 0xF: "lighter", + 0xF: "lighter" }; display.setChannelMask = function(mask) {