diff --git a/application/application.js b/application/application.js
index 680230b..4a01cfc 100644
--- a/application/application.js
+++ b/application/application.js
@@ -383,7 +383,6 @@ Application = $.spcExtend(wdi.DomainObject, {
this.busConnection.disconnect();
this.spiceConnection.disconnect();
},
-
setMultimediaTime: function (time) {
this.multimediaTime = time;
this.lastMultimediaTime = Date.now();
@@ -443,6 +442,88 @@ Application = $.spcExtend(wdi.DomainObject, {
], "keyup"); //ctrl up
}
+
+
+
+ if(shortcut == 'CtrlAltDel') {
+ this.inputProcess.send([
+ "keydown",
+ [
+ {
+ 'generated': true,
+ 'type': "keydown",
+ 'keyCode': 17,
+ 'charCode': 0
+ }
+ ]
+
+ ], "keydown"); //ctrl
+
+ this.inputProcess.send([
+ "keydown",
+ [
+ {
+ 'generated': true,
+ 'type': "keydown",
+ 'keyCode': 18,
+ 'charCode': 0
+ }
+ ]
+
+ ], "keydown"); //alt
+
+ this.inputProcess.send([
+ "keydown",
+ [
+ {
+ 'generated': true,
+ 'type': "keydown",
+ 'keyCode': 46,
+ 'charCode': 0
+ }
+ ]
+
+ ], "keydown"); //del
+
+ this.inputProcess.send([
+ "keyup",
+ [
+ {
+ 'generated': true,
+ 'type': "keyup",
+ 'keyCode': 17,
+ 'charCode': 0
+ }
+ ]
+
+ ], "keyup"); //ctrl up
+ this.inputProcess.send([
+ "keyup",
+ [
+ {
+ 'generated': true,
+ 'type': "keyup",
+ 'keyCode': 18,
+ 'charCode': 0
+ }
+ ]
+
+ ], "keyup"); //alt up
+ this.inputProcess.send([
+ "keyup",
+ [
+ {
+ 'generated': true,
+ 'type': "keyup",
+ 'keyCode': 46,
+ 'charCode': 0
+ }
+ ]
+
+ ], "keyup"); //del up
+
+ }
+
},
dispose: function () {
diff --git a/index.html b/index.html
index c28683f..6578aaa 100644
--- a/index.html
+++ b/index.html
@@ -1,187 +1,297 @@
-
- eyeOS Spice Web Client
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+ eyeOS Spice Web Client
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/keymaps/keymap.js b/keymaps/keymap.js
index c62669b..3847bf5 100644
--- a/keymaps/keymap.js
+++ b/keymaps/keymap.js
@@ -1,129 +1,155 @@
wdi.keyShortcutsHandled = {
- CTRLV: 0
+ CTRLV: 0
}
wdi.Keymap = {
- keymap: {},
- ctrlKeymap: {},
- charmap: {},
- ctrlPressed: false,
- twoBytesScanCodes: [0x5B, 0xDB, /*0x38, 0xB8,*/ 0x5C, 0xDC, 0x1D, 0x9D, 0x5D, 0xDD, 0x52, 0xD2, 0x53, 0xD3, 0x4B, 0xCB, 0x47, 0xC9, 0x4F, 0xCF, 0x48, 0xC8, 0x50, 0xD0, 0x49, 0xC9, 0x51, 0xD1, 0x4D, 0xCD, 0x1C, 0x9C],
-
- loadKeyMap: function(layout) {
- try {
- this.keymap = wdi['Keymap' + layout.toUpperCase()].getKeymap();
- this.ctrlKeymap = wdi['Keymap' + layout.toUpperCase()].getCtrlKeymap();
- this.reservedCtrlKeymap = wdi['Keymap' + layout.toUpperCase()].getReservedCtrlKeymap();
- this.charmap = wdi['Keymap' + layout.toUpperCase()].getCharmap();
- } catch(e) {
- this.keymap = wdi.KeymapES.getKeymap();
- this.ctrlKeymap = wdi.KeymapES.getCtrlKeymap();
- this.reservedCtrlKeymap = wdi.KeymapES.getReservedCtrlKeymap();
- this.charmap = wdi.KeymapES.getCharmap();
+ keymap: {},
+ ctrlKeymap: {},
+ charmap: {},
+ ctrlPressed: false,
+ twoBytesScanCodes: [0x5B, 0xDB, 0x1C, 0x5C, 0xDC, 0x1D, 0x9D, 0x5D, 0xDD, 0x52, 0xD2, 0x53, 0xD3, 0x4B, 0xCB, 0x47, 0xC9, 0x4F, 0xCF, 0x48, 0xC8, 0x50, 0xD0, 0x49, 0xC9, 0x51, 0xD1, 0x4D, 0xCD, 0x1C, 0x9C],
+
+ loadKeyMap: function(layout) {
+ try {
+ this.keymap = wdi['Keymap' + layout.toUpperCase()].getKeymap();
+ this.ctrlKeymap = wdi['Keymap' + layout.toUpperCase()].getCtrlKeymap();
+ this.reservedCtrlKeymap = wdi['Keymap' + layout.toUpperCase()].getReservedCtrlKeymap();
+ this.charmap = wdi['Keymap' + layout.toUpperCase()].getCharmap();
+ } catch(e) {
+ this.keymap = wdi.KeymapUS.getKeymap();
+ this.ctrlKeymap = wdi.KeymapUS.getCtrlKeymap();
+ this.reservedCtrlKeymap = wdi.KeymapUS.getReservedCtrlKeymap();
+ this.charmap = wdi.KeymapUS.getCharmap();
}
- },
-
- isInKeymap: function(keycode) {
- if (this.keymap[keycode] === undefined) return false;
- else return true;
- },
-
- /**
- * Returns the associated spice key code from the given browser keyboard event
- * @param e
- * @returns {*}
- */
- getScanCodes: function(e) {
+ },
+
+ isInKeymap: function(keycode) {
+ if (this.keymap[keycode] === undefined) return false;
+ else return true;
+ },
+ checkExceptions: function(type, keyCode) {
+
+ switch (keyCode) {
+ case 226: // ABNT-2 interrogation + slash
+ if (type == "keydown") {
+ return [0x35, 0, 0];
+ } else {
+ return [0xB5, 0, 0];
+ }
+ break;
+
+ case 111: // OEM2
+ return this.makeKeyMap(0x94);
+ break;
+ case 191: // KP_DIVIDE
+ return this.makeKeyMap(0x35);
+ break;
+ default:
+ return [];
+ break;
+ }
+
+ },
+
+ /**
+ * Returns the associated spice key code from the given browser keyboard event
+ * @param e
+ * @returns {*}
+ */
+ getScanCodes: function(e) {
if (e['hasScanCode']) {
return e['scanCode'];
} else if (this.handledByCtrlKeyCode(e['type'], e['keyCode'], e['generated'])) {// before doing anything else we check if the event about to be handled has to be intercepted
- return this.getScanCodeFromKeyCode(e['keyCode'], e['type'], this.ctrlKeymap, this.reservedCtrlKeymap);
- } else if (this.handledByCharmap(e['type'])) {
- return this.getScanCodesFromCharCode(e['charCode']);
- } else if (this.handledByNormalKeyCode(e['type'], e['keyCode'])) {
- return this.getScanCodeFromKeyCode(e['keyCode'], e['type'], this.keymap);
- } else {
- return [];
- }
- },
-
- getScanCodeFromKeyCode: function(keyCode, type, keymap, additionalKeymap) {
- this.controlPressed(keyCode, type);
- var key = null;
- if(keyCode in keymap) {
- key = keymap[keyCode];
- } else {
- key = additionalKeymap[keyCode];
- }
- if (key === undefined) return [];
- if (key < 0x100) {
- if (type == 'keydown') {
- return [this.makeKeymap(key)];
- } else if (type == 'keyup') {
- return [this.makeKeymap(key | 0x80)];
- }
- } else {
- if (type == 'keydown') {
- return [this.makeKeymap(0xe0 | ((key - 0x100) << 8))];
- } else if (type == 'keyup') {
- return [this.makeKeymap(0x80e0 | ((key - 0x100) << 8))];
- }
- }
- return key;
- },
-
- controlPressed: function(keyCode, type) {
- if (keyCode === 17 || keyCode === 91) { // Ctrl or CMD key
- if (type === 'keydown') this.ctrlPressed = true;
- else if (type === 'keyup') this.ctrlPressed = false;
- }
- },
-
- handledByCtrlKeyCode: function(type, keyCode, generated) {
- if (type === 'keydown' || type === 'keyup' || type === 'keypress') {
- if (this.ctrlPressed) {
- if (type === 'keypress') {
- return true;
- }
-
- if (this.ctrlKeymap[keyCode]) {
- return true; // is the second key in a keyboard shortcut (i.e. the x in Ctrl+x)
- }
-
- //check if the event is a fake event generated from our gui or programatically
- if(generated && this.reservedCtrlKeymap[keyCode]) {
- return true;
- }
- }
- }
- return false;
- },
-
- handledByNormalKeyCode: function(type, keyCode) {
- if (type === 'keydown' || type === 'keyup') {
- if (this.keymap[keyCode]) {
- return true;
- }
- }
- return false;
- },
-
- handledByCharmap: function(type) {
- if (type === 'inputmanager') return true;
- else return false;
- },
-
- getScanCodesFromCharCode: function(charCode) {
- var scanCode = this.charmap[String.fromCharCode(charCode)];
- if (scanCode === undefined) scanCode = [];
- return scanCode;
- },
-
- makeKeymap: function(scancode) {
- if ($.inArray(scancode, this.twoBytesScanCodes) != -1) {
- return [0xE0, scancode, 0, 0];
- } else {
- return [scancode, 0, 0];
- }
- }
+ return this.getScanCodeFromKeyCode(e['keyCode'], e['type'], this.ctrlKeymap, this.reservedCtrlKeymap);
+ } else if (this.handledByCharmap(e['type'])) {
+ return this.getScanCodesFromCharCode(e['charCode']);
+ } else if (this.handledByNormalKeyCode(e['type'], e['keyCode'])) {
+ return this.getScanCodeFromKeyCode(e['keyCode'], e['type'], this.keymap);
+ } else {
+ this.checkExceptions(e['type'], e['keyCode']);
+ return [];
+ }
+ },
+
+ getScanCodeFromKeyCode: function(keyCode, type, keymap, additionalKeymap) {
+ this.controlPressed(keyCode, type);
+ var key = null;
+
+ if(keyCode in keymap) {
+ key = keymap[keyCode];
+ } else {
+ key = additionalKeymap[keyCode];
+ }
+ if (key === undefined) return [];
+
+ if (key < 0x100) {
+ if (type == 'keydown') {
+ return [this.makeKeymap(key)];
+ } else if (type == 'keyup') {
+ return [this.makeKeymap(key | 0x80)];
+ }
+ } else {
+ if (type == 'keydown') {
+ return [this.makeKeymap(0xe0 | ((key - 0x100) << 8))];
+ } else if (type == 'keyup') {
+ return [this.makeKeymap(0x80e0 | ((key - 0x100) << 8))];
+ }
+ }
+ return key;
+ },
+
+ controlPressed: function(keyCode, type) {
+ if (keyCode === 17 || keyCode === 91) { // Ctrl or CMD key
+ if (type === 'keydown') this.ctrlPressed = true;
+ else if (type === 'keyup') this.ctrlPressed = false;
+ }
+ },
+
+ handledByCtrlKeyCode: function(type, keyCode, generated) {
+ if (type === 'keydown' || type === 'keyup' || type === 'keypress') {
+ if (this.ctrlPressed) {
+ if (type === 'keypress') {
+ return true;
+ }
+
+ if (this.ctrlKeymap[keyCode]) {
+ return true; // is the second key in a keyboard shortcut (i.e. the x in Ctrl+x)
+ }
+
+ //check if the event is a fake event generated from our gui or programatically
+ if(generated && this.reservedCtrlKeymap[keyCode]) {
+ return true;
+ }
+ }
+ }
+ return false;
+ },
+
+ handledByNormalKeyCode: function(type, keyCode) {
+ if (type === 'keydown' || type === 'keyup') {
+ if (this.keymap[keyCode]) {
+ return true;
+ }
+ }
+ return false;
+ },
+
+ handledByCharmap: function(type) {
+ if (type === 'inputmanager') return true;
+ else return false;
+ },
+
+ getScanCodesFromCharCode: function(charCode) {
+ var scanCode = this.charmap[String.fromCharCode(charCode)];
+ if (scanCode === undefined) scanCode = [];
+ return scanCode;
+ },
+
+ makeKeymap: function(scancode) {
+ if ($.inArray(scancode, this.twoBytesScanCodes) != -1) {
+ return [0xE0, scancode, 0, 0];
+ } else {
+ return [scancode, 0, 0];
+ }
+ }
}
diff --git a/keymaps/keymapptbr.js b/keymaps/keymapptbr.js
new file mode 100644
index 0000000..82fe48b
--- /dev/null
+++ b/keymaps/keymapptbr.js
@@ -0,0 +1,249 @@
+// These tables map the js keyboard keys to the spice equivalent
+wdi.KeymapPTBR = function() {
+
+ // regular keys with associated chars. The columns means all the event flux to activate the key (i.e. [key up, key down])
+ // all the js events associated to these keys should have a charKey associated
+ var charmapPTBR = {};
+
+ // primeira fileira
+ charmapPTBR['\''] = [[0x29, 0, 0, 0], [0xA9, 0, 0, 0]];
+ charmapPTBR['"'] = [[0x2A, 0, 0, 0], [0x29, 0, 0, 0], [0xA9, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['1'] = [[0x2, 0, 0, 0], [0x82, 0, 0, 0]];
+ charmapPTBR['!'] = [[0x2A, 0, 0, 0], [0x2, 0, 0, 0], [0x82, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['¹'] = [[0xE0, 0x38, 0, 0], [0x2, 0, 0, 0], [0x82, 0, 0, 0], [0xE0, 0xB8, 0, 0]];
+ charmapPTBR['2'] = [[0x3, 0, 0, 0], [0x83, 0, 0, 0]];
+ charmapPTBR['@'] = [[0x2A, 0, 0, 0], [0x3, 0, 0, 0], [0x83, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['²'] = [[0xE0, 0x38, 0, 0], [0x3, 0, 0, 0], [0x83, 0, 0, 0], [0xE0, 0xB8, 0, 0]];
+ charmapPTBR['3'] = [[0x4, 0, 0, 0], [0x84, 0, 0, 0]];
+ charmapPTBR['#'] = [[0x2A, 0, 0, 0], [0x4, 0, 0, 0], [0x84, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['³'] = [[0xE0, 0x38, 0, 0], [0x4, 0, 0, 0], [0x84, 0, 0, 0], [0xE0, 0xB8, 0, 0]];
+ charmapPTBR['4'] = [[0x5, 0, 0, 0], [0x85, 0, 0, 0]];
+ charmapPTBR['$'] = [[0x2A, 0, 0, 0], [0x5, 0, 0, 0], [0x85, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['£'] = [[0xE0, 0x38, 0, 0], [0x5, 0, 0, 0], [0x85, 0, 0, 0], [0xE0, 0xB8, 0, 0]];
+ charmapPTBR['5'] = [[0x6, 0, 0, 0], [0x86, 0, 0, 0]];
+ charmapPTBR['%'] = [[0x2A, 0, 0, 0], [0x6, 0, 0, 0], [0x86, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['¢'] = [[0xE0, 0x38, 0, 0], [0x6, 0, 0, 0], [0x86, 0, 0, 0], [0xE0, 0xB8, 0, 0]];
+ charmapPTBR['6'] = [[0x7, 0, 0, 0], [0x87, 0, 0, 0]];
+ charmapPTBR['¨'] = [[0x2A, 0, 0, 0], [0x7, 0, 0, 0], [0x87, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['¬'] = [[0xE0, 0x38, 0, 0], [0x7, 0, 0, 0], [0x87, 0, 0, 0], [0xE0, 0xB8, 0, 0]];
+ charmapPTBR['7'] = [[0x8, 0, 0, 0], [0x88, 0, 0, 0]];
+ charmapPTBR['&'] = [[0x2A, 0, 0, 0], [0x8, 0, 0, 0], [0x88, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['8'] = [[0x9, 0, 0, 0], [0x89, 0, 0, 0]];
+ charmapPTBR['*'] = [[0x2A, 0, 0, 0], [0x9, 0, 0, 0], [0x89, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['('] = [[0x2A, 0, 0, 0], [0x0A, 0, 0, 0], [0x8A, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['9'] = [[0x0A, 0, 0, 0], [0x8A, 0, 0, 0]];
+ charmapPTBR[')'] = [[0x2A, 0, 0, 0], [0x0B, 0, 0, 0], [0x8B, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['0'] = [[0x0B, 0, 0, 0], [0x8B, 0, 0, 0]];
+ charmapPTBR['-'] = [[0x0C, 0, 0, 0], [0x8C, 0, 0, 0]];
+ charmapPTBR['_'] = [[0x2A, 0, 0, 0], [0x0C, 0, 0, 0], [0x8C, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['+'] = [[0x1B, 0, 0, 0], [0x9B, 0, 0, 0]];
+ charmapPTBR['='] = [[0x2A, 0, 0, 0], [0x0B, 0, 0, 0], [0x8B, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['§'] = [[0xE0, 0x38, 0, 0], [0x0B, 0, 0, 0], [0x8B, 0, 0, 0], [0xE0, 0xB8, 0, 0]];
+
+ // segunda fileira
+ charmapPTBR['q'] = [[0x10, 0, 0, 0], [0x90, 0, 0, 0]];
+ charmapPTBR['Q'] = [[0x2A, 0, 0, 0], [0x10, 0, 0, 0], [0x90, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['w'] = [[0x11, 0, 0, 0], [0x91, 0, 0, 0]];
+ charmapPTBR['W'] = [[0x2A, 0, 0, 0], [0x11, 0, 0, 0], [0x91, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['e'] = [[0x12, 0, 0, 0], [0x92, 0, 0, 0]];
+ charmapPTBR['E'] = [[0x2A, 0, 0, 0], [0x12, 0, 0, 0], [0x92, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['r'] = [[0x13, 0, 0, 0], [0x93, 0, 0, 0]];
+ charmapPTBR['R'] = [[0x2A, 0, 0, 0], [0x13, 0, 0, 0], [0x93, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['t'] = [[0x14, 0, 0, 0], [0x94, 0, 0, 0]];
+ charmapPTBR['T'] = [[0x2A, 0, 0, 0], [0x14, 0, 0, 0], [0x94, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['y'] = [[0x15, 0, 0, 0], [0x95, 0, 0, 0]];
+ charmapPTBR['Y'] = [[0x2A, 0, 0, 0], [0x15, 0, 0, 0], [0x95, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['u'] = [[0x16, 0, 0, 0], [0x96, 0, 0, 0]];
+ charmapPTBR['U'] = [[0x2A, 0, 0, 0], [0x16, 0, 0, 0], [0x96, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['i'] = [[0x17, 0, 0, 0], [0x97, 0, 0, 0]];
+ charmapPTBR['I'] = [[0x2A, 0, 0, 0], [0x17, 0, 0, 0], [0x97, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['o'] = [[0x18, 0, 0, 0], [0x98, 0, 0, 0]];
+ charmapPTBR['O'] = [[0x2A, 0, 0, 0], [0x18, 0, 0, 0], [0x98, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['p'] = [[0x19, 0, 0, 0], [0x99, 0, 0, 0]];
+ charmapPTBR['P'] = [[0x2A, 0, 0, 0], [0x19, 0, 0, 0], [0x99, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['`'] = [[0x1A, 0, 0, 0], [0x9A, 0, 0, 0]];
+ charmapPTBR['´'] = [[0x2A, 0, 0, 0], [0x1A, 0, 0, 0], [0x99, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['['] = [[0x1B, 0, 0, 0], [0x9B, 0, 0, 0]];
+ charmapPTBR['{'] = [[0x2A, 0, 0, 0], [0x1B, 0, 0, 0], [0x9B, 0, 0, 0], [0xAA, 0, 0, 0]];
+
+
+ // terceira fileira
+ charmapPTBR['a'] = [[0x1E, 0, 0, 0], [0x9E, 0, 0, 0]];
+ charmapPTBR['A'] = [[0x2A, 0, 0, 0], [0x1E, 0, 0, 0], [0x9E, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['s'] = [[0x1F, 0, 0, 0], [0x9F, 0, 0, 0]];
+ charmapPTBR['S'] = [[0x2A, 0, 0, 0], [0x1F, 0, 0, 0], [0x9F, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['d'] = [[0x20, 0, 0, 0], [0xA0, 0, 0, 0]];
+ charmapPTBR['D'] = [[0x2A, 0, 0, 0], [0x20, 0, 0, 0], [0xA0, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['f'] = [[0x21, 0, 0, 0], [0xA1, 0, 0, 0]];
+ charmapPTBR['F'] = [[0x2A, 0, 0, 0], [0x21, 0, 0, 0], [0xA1, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['g'] = [[0x22, 0, 0, 0], [0xA2, 0, 0, 0]];
+ charmapPTBR['G'] = [[0x2A, 0, 0, 0], [0x22, 0, 0, 0], [0xA2, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['h'] = [[0x23, 0, 0, 0], [0xA3, 0, 0, 0]];
+ charmapPTBR['H'] = [[0x2A, 0, 0, 0], [0x23, 0, 0, 0], [0xA3, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['j'] = [[0x24, 0, 0, 0], [0xA4, 0, 0, 0]];
+ charmapPTBR['J'] = [[0x2A, 0, 0, 0], [0x24, 0, 0, 0], [0xA4, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['k'] = [[0x25, 0, 0, 0], [0xA5, 0, 0, 0]];
+ charmapPTBR['K'] = [[0x2A, 0, 0, 0], [0x25, 0, 0, 0], [0xA5, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['l'] = [[0x26, 0, 0, 0], [0xA6, 0, 0, 0]];
+ charmapPTBR['L'] = [[0x2A, 0, 0, 0], [0x26, 0, 0, 0], [0xA6, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['ç'] = [[0x0D, 0, 0, 0], [0x8D, 0, 0, 0]];
+ charmapPTBR['Ç'] = [[0x2A, 0, 0, 0], [0x0D, 0, 0, 0], [0x8D, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['^'] = [[0x2A, 0, 0, 0], [0x28, 0, 0, 0], [0xA8, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['~'] = [[0x28, 0, 0, 0], [0xA8, 0, 0, 0]];
+ charmapPTBR['ª'] = [[0xE0, 0x38, 0, 0], [0x28, 0, 0, 0], [0xA8, 0, 0, 0], [0xE0, 0xB8, 0, 0]];
+ charmapPTBR[']'] = [[0x2B, 0, 0, 0], [0xAB, 0, 0, 0]];
+ charmapPTBR['}'] = [[0x2A, 0, 0, 0], [0x2B, 0, 0, 0], [0xAB, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['º'] = [[0xE0, 0x38, 0, 0], [0x2B, 0, 0, 0], [0xAB, 0, 0, 0], [0xE0, 0xB8, 0, 0]];
+
+
+ // quarta fileira
+ charmapPTBR['\\'] = [[0x2B, 0, 0, 0], [0xAB, 0, 0, 0]];
+ charmapPTBR['|'] = [[0x2A, 0, 0, 0], [0x2B, 0, 0, 0], [0xAB, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['z'] = [[0x2C, 0, 0, 0], [0xAC, 0, 0, 0]];
+ charmapPTBR['Z'] = [[0x2A, 0, 0, 0], [0x2C, 0, 0, 0], [0xAC, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['x'] = [[0x2D, 0, 0, 0], [0xAD, 0, 0, 0]];
+ charmapPTBR['X'] = [[0x2A, 0, 0, 0], [0x2D, 0, 0, 0], [0xAD, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['c'] = [[0x2E, 0, 0, 0], [0xAE, 0, 0, 0]];
+ charmapPTBR['C'] = [[0x2A, 0, 0, 0], [0x2E, 0, 0, 0], [0xAE, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['v'] = [[0x2F, 0, 0, 0], [0xAF, 0, 0, 0]];
+ charmapPTBR['V'] = [[0x2A, 0, 0, 0], [0x2F, 0, 0, 0], [0xAF, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['b'] = [[0x30, 0, 0, 0], [0xB0, 0, 0, 0]];
+ charmapPTBR['B'] = [[0x2A, 0, 0, 0], [0x30, 0, 0, 0], [0xB0, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['n'] = [[0x31, 0, 0, 0], [0xB1, 0, 0, 0]];
+ charmapPTBR['N'] = [[0x2A, 0, 0, 0], [0x31, 0, 0, 0], [0xB1, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['m'] = [[0x32, 0, 0, 0], [0xB2, 0, 0, 0]];
+ charmapPTBR['M'] = [[0x2A, 0, 0, 0], [0x32, 0, 0, 0], [0xB2, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR[','] = [[0x33, 0, 0, 0], [0xB3, 0, 0, 0]];
+ charmapPTBR['<'] = [[0x2A, 0, 0, 0], [0x33, 0, 0, 0], [0xB3, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['.'] = [[0x34, 0, 0, 0], [0xB4, 0, 0, 0]];
+ charmapPTBR['>'] = [[0x2A, 0, 0, 0], [0x34, 0, 0, 0], [0xB4, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR[';'] = [[0x2A, 0, 0, 0], [0x33, 0, 0, 0], [0xB3, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR[':'] = [[0x2A, 0, 0, 0], [0x34, 0, 0, 0], [0xB4, 0, 0, 0], [0xAA, 0, 0, 0]];
+
+ charmapPTBR['?'] = [[0x2A, 0, 0, 0], [0x0C, 0, 0, 0], [0x8C, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['/'] = [[0x2A, 0, 0, 0], [0x8, 0, 0, 0], [0x88, 0, 0, 0], [0xAA, 0, 0, 0]];
+ charmapPTBR['°'] = [[0xE0, 0x38, 0, 0], [0x62, 0, 0, 0], [0xE2, 0, 0, 0], [0xE0, 0xB8, 0, 0]];
+
+ // quinta fileira
+ charmapPTBR[' '] = [[0x39, 0, 0, 0], [0xB9, 0, 0, 0]];
+
+
+ // keyboard keys without character associated.
+ // all the js events associated to these keys should have a keyChar associated
+ var keymapPTBR = [];
+
+ keymapPTBR[27] = 0x1; // ESC
+ keymapPTBR[9] = 0x0F; // TAB
+ //keymapPTBR[20] = 0x3A; // BLOQ.MAY. => see the charmap, all the capital letters and shift chars send a shift in their sequence
+ keymapPTBR[16] = 0x2A; // LEFT SHIFT and RIGHT SHIFT
+ keymapPTBR[91] = 0x5B; // LEFT GUI (META, COMMAND)
+ keymapPTBR[93] = 0x38; // MENU
+ keymapPTBR[17] = 0x1D; // LEFT CONTROL and RIGHT CONTROL
+ keymapPTBR[32] = 0x39; // SPACE => see the charmap
+ keymapPTBR[8] = 0x0E; // BACKSPACE
+ keymapPTBR[13] = 0x1C; // ENTER
+ keymapPTBR[225] = 0x5D; // RIGHT ALT (ALT GR) => see the charmap, all the altgr chars send a altgr in their sequence
+ keymapPTBR[18] = 0x38; // LEFT ALT
+ keymapPTBR[92] = 0x5C; // RIGHT GUI (WINDOWS)
+ keymapPTBR[38] = 0x48; // UP ARROW
+ keymapPTBR[37] = 0x4B; // LEFT ARROW
+ keymapPTBR[40] = 0x50; // DOWN ARROW
+ keymapPTBR[39] = 0x4D; // RIGHT ARROW
+ keymapPTBR[45] = 0x52; // INSERT
+ keymapPTBR[46] = 0x53; // DELETE
+ keymapPTBR[36] = 0x47; // HOME
+ keymapPTBR[35] = 0x4F; // FIN
+ keymapPTBR[33] = 0x49; // PAGE UP
+ keymapPTBR[34] = 0x51; // PAGE UP
+ keymapPTBR[144] = 0x45; // BLOQ.NUM.
+ keymapPTBR[145] = 0x46; // SCROLL LOCK
+ keymapPTBR[112] = 0x3B; // F1
+ keymapPTBR[113] = 0x3C; // F2
+ keymapPTBR[114] = 0x3D; // F3
+ keymapPTBR[115] = 0x3E; // F4
+ keymapPTBR[116] = 0x3F; // F5
+ keymapPTBR[117] = 0x40; // F6
+ keymapPTBR[118] = 0x41; // F7
+ keymapPTBR[119] = 0x42; // F8
+ keymapPTBR[120] = 0x43; // F9
+ keymapPTBR[121] = 0x44; // F10
+ keymapPTBR[122] = 0x57; // F11
+ keymapPTBR[123] = 0x58; // F12
+
+ keymapPTBR[106] = 0x37; // KP_MULTIPLY
+ keymapPTBR[109] = 0x4A; // KP_SUBTRACT
+ keymapPTBR[107] = 0x4E; // KP_ADD
+
+ keymapPTBR[189] = 0x0C; // OEM_MINUS
+ keymapPTBR[187] = 0x0D; // OEM_PLUS
+ keymapPTBR[219] = 0x1A; // OEM_4 (grave and acute)
+ keymapPTBR[221] = 0x1B; // OEM_6 ({ and [)
+ keymapPTBR[186] = 0x27; // OEM_1 (c-cedilla)
+ keymapPTBR[222] = 0x28; // OEM_7 (^~)
+ keymapPTBR[220] = 0x2B; // OEM_5 (}])
+ keymapPTBR[192] = 0x29; // OEM_3 (' ")
+ keymapPTBR[188] = 0x33; // OEM_COMMA (< ,)
+ keymapPTBR[190] = 0x34; // OEM_PERIOD (> .)
+
+ // went thru hell to find the correct codes for these! -- see the docs at http://www.quadibloc.com/comp/scan.htm, referenced as "INT 1" and "INT 3) (grr...)
+ keymapPTBR[220] = 0x56; // backslash and pipe
+ keymapPTBR[191] = 0x73; // slash and interrogation mark
+ keymapPTBR[111] = 0x73; // KP_DIVIDE -- this won't work at all. Remapped to INT 3.
+
+ // combination keys with ctrl
+ var ctrlKeymapPTBR = [];
+
+ ctrlKeymapPTBR[65] = 0x1E; // a
+ ctrlKeymapPTBR[81] = 0x10; // q
+ ctrlKeymapPTBR[87] = 0x11; // w
+ ctrlKeymapPTBR[69] = 0x12; // e
+ ctrlKeymapPTBR[82] = 0x13; // r
+ ctrlKeymapPTBR[84] = 0x14; // t
+ ctrlKeymapPTBR[89] = 0x15; // y
+ ctrlKeymapPTBR[85] = 0x16; // u
+ ctrlKeymapPTBR[73] = 0x17; // i
+ ctrlKeymapPTBR[79] = 0x18; // o
+ ctrlKeymapPTBR[80] = 0x19; // p
+ ctrlKeymapPTBR[65] = 0x1E; // a
+ ctrlKeymapPTBR[83] = 0x1F; // s
+ ctrlKeymapPTBR[68] = 0x20; // d
+ ctrlKeymapPTBR[70] = 0x21; // f
+ ctrlKeymapPTBR[71] = 0x22; // g
+ ctrlKeymapPTBR[72] = 0x23; // h
+ ctrlKeymapPTBR[74] = 0x24; // j
+ ctrlKeymapPTBR[75] = 0x25; // k
+ ctrlKeymapPTBR[76] = 0x26; // l
+ ctrlKeymapPTBR[90] = 0x2C; // z
+ ctrlKeymapPTBR[88] = 0x2D; // x
+ ctrlKeymapPTBR[67] = 0x2E; // c
+ //ctrlKeymapPTBR[86] = 0x2F; // v to enable set disableClipboard = true in run.js
+ ctrlKeymapPTBR[66] = 0x30; // b
+ ctrlKeymapPTBR[78] = 0x31; // n
+ ctrlKeymapPTBR[77] = 0x32; // m
+
+ // reserved ctrl+? combinations we want to intercept from browser and inject manually to spice
+ var reservedCtrlKeymap = [];
+ reservedCtrlKeymap[86] = 0x2F;
+
+ return {
+ getKeymap: function() {
+ return keymapPTBR;
+ },
+
+ getCtrlKeymap: function() {
+ return ctrlKeymapPTBR;
+ },
+
+ getReservedCtrlKeymap: function() {
+ return reservedCtrlKeymap;
+ },
+
+ getCharmap: function() {
+ return charmapPTBR;
+ },
+
+ setCtrlKey: function (key, val) {
+ ctrlKeymapPTBR[key] = val;
+ }
+ };
+}( );
diff --git a/lib/images/bitmap.js b/lib/images/bitmap.js
index 299598d..1fc0c98 100644
--- a/lib/images/bitmap.js
+++ b/lib/images/bitmap.js
@@ -133,6 +133,7 @@ wdi.BMP2 = $.spcExtend(wdi.SpiceObject, {
} else {
if (type === wdi.SpiceBitmapFmt.SPICE_BITMAP_FMT_32BIT) {
+ topdown = true;
for (pos = 0; pos < size; pos += 4) {
b = data[pos];
data[pos] = data[pos + 2];
diff --git a/lib/sendkey.js b/lib/sendkey.js
new file mode 100644
index 0000000..0292b69
--- /dev/null
+++ b/lib/sendkey.js
@@ -0,0 +1,39 @@
+
+var sendKey=function(type,n){
+ var obj={
+ 'generated': true,
+ 'type': type,
+ 'keyCode': n,
+ 'charCode': 0
+ };
+ //inputProcess object,window.inputProcess=
+ //in application.js init, window.inputProcess=this.inputProcess;
+ app.inputProcess.send([type,[obj]], type);
+}
+
+var sendCtrlAltDel=function(){
+ app.disableKeyboard();
+ app.sendShortcut("CtrlAltDel");
+ app.enableKeyboard();
+}
+
+
+var switchVT=function(keynum){
+ var base=111;
+
+ app.disableKeyboard();
+ sendKey("keydown",17);
+ sendKey("keydown",18);
+ sendKey("keydown",base+keynum);
+ sendKey("keyup",base+keynum);
+ sendKey("keyup",18);
+ sendKey("keyup",17);
+ app.enableKeyboard();
+}
+
+var switchKB=function(layout){
+ wdi.Keymap.loadKeyMap("us");
+ wdi.Keymap.loadKeyMap(layout);
+ alert("mapa de teclado " + layout + " carregado.");
+}
+
diff --git a/lib/status.js b/lib/status.js
new file mode 100644
index 0000000..ea02605
--- /dev/null
+++ b/lib/status.js
@@ -0,0 +1,47 @@
+
+
+function getUrlVars() {
+ var vars = {};
+ var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
+ vars[key] = value;
+ });
+ return vars;
+}
+
+function addDynamicContent()
+{
+ // action buttons
+ var tree = document.createDocumentFragment();
+ var item1 = document.createElement("a");
+ item1.setAttribute("id", "reset");
+ item1.setAttribute("class", "btn btn-link");
+ item1.setAttribute("href", "javascript:resetVM();");
+ item1.appendChild(document.createTextNode("reset"));
+ var item1glyph = document.createElement("span");
+ item1glyph.setAttribute("class", "glyphicon glyphicon-repeat");
+
+ var item2 = document.createElement("a");
+ item2.setAttribute("id", "close");
+ item2.setAttribute("class", "btn btn-link");
+ item2.setAttribute("href", "javascript:window.close();");
+ item2.appendChild(document.createTextNode("fechar"));
+ var item2glyph = document.createElement("span");
+ item2glyph.setAttribute("class", "glyphicon glyphicon-log-out");
+
+ tree.appendChild(item1);
+ tree.appendChild(item1glyph);
+ tree.appendChild(item2);
+ tree.appendChild(item2glyph);
+ document.getElementById("action_toolbar").appendChild(tree);
+
+ document.title = 'VM: ' + getUrlVars()["vm_name"] + ' (' + getUrlVars()["arch"] + '), IP: ' + getUrlVars()["ip_addr"];
+}
+
+
+function resetVM(vm_name) {
+
+ $.get("/labvirtual/restartvm?name=" + getUrlVars()["vm_name"]);
+ alert('Comando de reset enviado para VM ' + getUrlVars()["vm_name"] + ' com sucesso.');
+
+
+}
diff --git a/lib/utils.js b/lib/utils.js
index 1b7bda7..5936e83 100644
--- a/lib/utils.js
+++ b/lib/utils.js
@@ -335,3 +335,4 @@ wdi.exceptionHandling = true;
wdi.IntegrationBenchmarkEnabled = false; // MS Excel loading time benchmark
wdi.useWorkers = true;
wdi.logOperations = false;
+
diff --git a/network/socket.js b/network/socket.js
index 699c62e..848a6b3 100644
--- a/network/socket.js
+++ b/network/socket.js
@@ -72,7 +72,7 @@ wdi.Socket = $.spcExtend(wdi.EventObject.prototype, {
self.status = wdi.socketStatus.disconnected;
console.warn('Spice Web Client: ', e.code, e.reason);
self.disconnect();
- self.fire('error', e);
+ self.fire('close', e);
};
this.websocket.onerror = function(e) {
self.status = wdi.socketStatus.failed;
diff --git a/resources/logo.png b/resources/logo.png
new file mode 100644
index 0000000..445e1bb
Binary files /dev/null and b/resources/logo.png differ
diff --git a/run.js b/run.js
index e1e5a86..1624e4a 100644
--- a/run.js
+++ b/run.js
@@ -74,11 +74,11 @@ function start () {
$(params.eventLayer).remove();
} else if (action == 'windowMoved') {
$(params.canvas).css({
- 'top': params.info.top + 'px',
+ 'top': '0px',
'left': params.info.left + 'px'
});
$(params.eventLayer).css({
- 'top': params.info.top + 'px',
+ 'top': '0px',
'left': params.info.left + 'px'
});
} else if (action == 'init' || action == 'windowCreated') {
@@ -93,11 +93,11 @@ function start () {
canvas = $(item.canvas).css({
'zIndex': 10000 - position - 1,
'position': 'absolute',
- 'top': item.info.top + 'px',
+ 'top': '0px',
'left': item.info.left + 'px'
});
eventlayer = $(item.eventLayer).css({
- 'top': item.info.top + 'px',
+ 'top': '0px',
'left': item.info.left + 'px',
'zIndex': 10000 - position
})
@@ -106,7 +106,7 @@ function start () {
}
} else if (action == 'ready') {
var width = $(window).width();
- var height = $(window).height();
+ var height = $(window).height()-40;
// launch tests
if (performanceTest) {
@@ -137,11 +137,11 @@ function start () {
$(params.eventLayer).css({'display': 'none'});
} else if (action == 'windowMaximized') {
$(params.canvas).css({
- 'top': params.info.top + 'px',
+ 'top': '0px',
'left': params.info.left + 'px'
});
$(params.eventLayer).css({
- 'top': params.info.top + 'px',
+ 'top': '0px',
'left': params.info.left + 'px'
});
} else if (action == 'windowRestored') {
@@ -149,11 +149,11 @@ function start () {
$(params.canvas).css({'display': 'block'});
$(params.eventLayer).css({'display': 'block'});
$(params.canvas).css({
- 'top': params.info.top + 'px',
+ 'top': '0px',
'left': params.info.left + 'px'
});
$(params.eventLayer).css({
- 'top': params.info.top + 'px',
+ 'top': '0px',
'left': params.info.left + 'px'
});
} else if (action == 'windowFocused') {
@@ -162,7 +162,7 @@ function start () {
wdi.Debug.log('Detected time lapse of ', params, 'seconds');
} else if (action == 'error') {
// alert('error');
- } else if ("checkResults") {
+ } else if (action == "checkResults") {
var cnv = $('#canvas_0')[0];
var ctx = cnv.getContext('2d');
var currentImgData = ctx.getImageData(0, 0, cnv.width, cnv.height);
@@ -193,8 +193,12 @@ function start () {
$(window)['resize'](function () {
app.sendCommand('setResolution', {
'width': $(window).width(),
- 'height': $(window).height()
+ 'height': $(window).height()-40
});
+ $(params.canvas).css({
+ 'top': '0px',
+ 'left': params.info.left + 'px'
+ });
});
var useWorkers = true;
@@ -208,8 +212,8 @@ function start () {
app.run({
'callback': f,
'context': this,
- 'host': getURLParameter('host') || '10.11.12.100',
- 'port': getURLParameter('port') || 8000,
+ 'host': getURLParameter('host') || '172.18.88.44',
+ 'port': getURLParameter('port') || 15900,
'protocol': getURLParameter('protocol') || 'ws',
'token': '1q2w3e4r',
'vmHost': getURLParameter('vmhost') || false,
@@ -225,7 +229,7 @@ function start () {
'heartbeatToken': 'heartbeat',
'heartbeatTimeout': 4000,//miliseconds
'busFileServerBaseUrl': 'https://10.11.12.200/fileserver/',
- 'layout': 'es',
+ 'layout': 'ptbr',
'clientOffset': {
'x': 0,
'y': 0