Update noVNC HTML5 client to latest version from https://github.com/kanaka/noVNC.
parent
ad7a054e8c
commit
465a5b0bd5
After Width: | Height: | Size: 339 B |
After Width: | Height: | Size: 354 B |
After Width: | Height: | Size: 385 B |
After Width: | Height: | Size: 390 B |
After Width: | Height: | Size: 735 B |
After Width: | Height: | Size: 387 B |
@ -0,0 +1,321 @@
|
||||
/*
|
||||
Copyright 2012 Google Inc.
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
Author: Boris Smus (smus@chromium.org)
|
||||
*/
|
||||
|
||||
(function(exports) {
|
||||
|
||||
// Define some local variables here.
|
||||
var socket = chrome.socket || chrome.experimental.socket;
|
||||
var dns = chrome.experimental.dns;
|
||||
|
||||
/**
|
||||
* Creates an instance of the client
|
||||
*
|
||||
* @param {String} host The remote host to connect to
|
||||
* @param {Number} port The port to connect to at the remote host
|
||||
*/
|
||||
function TcpClient(host, port, pollInterval) {
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
this.pollInterval = pollInterval || 15;
|
||||
|
||||
// Callback functions.
|
||||
this.callbacks = {
|
||||
connect: null, // Called when socket is connected.
|
||||
disconnect: null, // Called when socket is disconnected.
|
||||
recvBuffer: null, // Called (as ArrayBuffer) when client receives data from server.
|
||||
recvString: null, // Called (as string) when client receives data from server.
|
||||
sent: null // Called when client sends data to server.
|
||||
};
|
||||
|
||||
// Socket.
|
||||
this.socketId = null;
|
||||
this.isConnected = false;
|
||||
|
||||
log('initialized tcp client');
|
||||
}
|
||||
|
||||
/**
|
||||
* Connects to the TCP socket, and creates an open socket.
|
||||
*
|
||||
* @see http://developer.chrome.com/trunk/apps/socket.html#method-create
|
||||
* @param {Function} callback The function to call on connection
|
||||
*/
|
||||
TcpClient.prototype.connect = function(callback) {
|
||||
// First resolve the hostname to an IP.
|
||||
dns.resolve(this.host, function(result) {
|
||||
this.addr = result.address;
|
||||
socket.create('tcp', {}, this._onCreate.bind(this));
|
||||
|
||||
// Register connect callback.
|
||||
this.callbacks.connect = callback;
|
||||
}.bind(this));
|
||||
};
|
||||
|
||||
/**
|
||||
* Sends an arraybuffer/view down the wire to the remote side
|
||||
*
|
||||
* @see http://developer.chrome.com/trunk/apps/socket.html#method-write
|
||||
* @param {String} msg The arraybuffer/view to send
|
||||
* @param {Function} callback The function to call when the message has sent
|
||||
*/
|
||||
TcpClient.prototype.sendBuffer = function(buf, callback) {
|
||||
if (buf.buffer) {
|
||||
buf = buf.buffer;
|
||||
}
|
||||
|
||||
/*
|
||||
// Debug
|
||||
var bytes = [], u8 = new Uint8Array(buf);
|
||||
for (var i = 0; i < u8.length; i++) {
|
||||
bytes.push(u8[i]);
|
||||
}
|
||||
log("sending bytes: " + (bytes.join(',')));
|
||||
*/
|
||||
|
||||
socket.write(this.socketId, buf, this._onWriteComplete.bind(this));
|
||||
|
||||
// Register sent callback.
|
||||
this.callbacks.sent = callback;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sends a string down the wire to the remote side
|
||||
*
|
||||
* @see http://developer.chrome.com/trunk/apps/socket.html#method-write
|
||||
* @param {String} msg The string to send
|
||||
* @param {Function} callback The function to call when the message has sent
|
||||
*/
|
||||
TcpClient.prototype.sendString = function(msg, callback) {
|
||||
/*
|
||||
// Debug
|
||||
log("sending string: " + msg);
|
||||
*/
|
||||
|
||||
this._stringToArrayBuffer(msg, function(arrayBuffer) {
|
||||
socket.write(this.socketId, arrayBuffer, this._onWriteComplete.bind(this));
|
||||
}.bind(this));
|
||||
|
||||
// Register sent callback.
|
||||
this.callbacks.sent = callback;
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the callback for when a message is received
|
||||
*
|
||||
* @param {Function} callback The function to call when a message has arrived
|
||||
* @param {String} type The callback argument type: "arraybuffer" or "string"
|
||||
*/
|
||||
TcpClient.prototype.addResponseListener = function(callback, type) {
|
||||
if (typeof type === "undefined") {
|
||||
type = "arraybuffer";
|
||||
}
|
||||
// Register received callback.
|
||||
if (type === "string") {
|
||||
this.callbacks.recvString = callback;
|
||||
} else {
|
||||
this.callbacks.recvBuffer = callback;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the callback for when the socket disconnects
|
||||
*
|
||||
* @param {Function} callback The function to call when the socket disconnects
|
||||
* @param {String} type The callback argument type: "arraybuffer" or "string"
|
||||
*/
|
||||
TcpClient.prototype.addDisconnectListener = function(callback) {
|
||||
// Register disconnect callback.
|
||||
this.callbacks.disconnect = callback;
|
||||
};
|
||||
|
||||
/**
|
||||
* Disconnects from the remote side
|
||||
*
|
||||
* @see http://developer.chrome.com/trunk/apps/socket.html#method-disconnect
|
||||
*/
|
||||
TcpClient.prototype.disconnect = function() {
|
||||
if (this.isConnected) {
|
||||
this.isConnected = false;
|
||||
socket.disconnect(this.socketId);
|
||||
if (this.callbacks.disconnect) {
|
||||
this.callbacks.disconnect();
|
||||
}
|
||||
log('socket disconnected');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The callback function used for when we attempt to have Chrome
|
||||
* create a socket. If the socket is successfully created
|
||||
* we go ahead and connect to the remote side.
|
||||
*
|
||||
* @private
|
||||
* @see http://developer.chrome.com/trunk/apps/socket.html#method-connect
|
||||
* @param {Object} createInfo The socket details
|
||||
*/
|
||||
TcpClient.prototype._onCreate = function(createInfo) {
|
||||
this.socketId = createInfo.socketId;
|
||||
if (this.socketId > 0) {
|
||||
socket.connect(this.socketId, this.addr, this.port, this._onConnectComplete.bind(this));
|
||||
} else {
|
||||
error('Unable to create socket');
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The callback function used for when we attempt to have Chrome
|
||||
* connect to the remote side. If a successful connection is
|
||||
* made then polling starts to check for data to read
|
||||
*
|
||||
* @private
|
||||
* @param {Number} resultCode Indicates whether the connection was successful
|
||||
*/
|
||||
TcpClient.prototype._onConnectComplete = function(resultCode) {
|
||||
// Start polling for reads.
|
||||
this.isConnected = true;
|
||||
setTimeout(this._periodicallyRead.bind(this), this.pollInterval);
|
||||
|
||||
if (this.callbacks.connect) {
|
||||
log('connect complete');
|
||||
this.callbacks.connect();
|
||||
}
|
||||
log('onConnectComplete');
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks for new data to read from the socket
|
||||
*
|
||||
* @see http://developer.chrome.com/trunk/apps/socket.html#method-read
|
||||
*/
|
||||
TcpClient.prototype._periodicallyRead = function() {
|
||||
var that = this;
|
||||
socket.getInfo(this.socketId, function (info) {
|
||||
if (info.connected) {
|
||||
setTimeout(that._periodicallyRead.bind(that), that.pollInterval);
|
||||
socket.read(that.socketId, null, that._onDataRead.bind(that));
|
||||
} else if (that.isConnected) {
|
||||
log('socket disconnect detected');
|
||||
that.disconnect();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Callback function for when data has been read from the socket.
|
||||
* Converts the array buffer that is read in to a string
|
||||
* and sends it on for further processing by passing it to
|
||||
* the previously assigned callback function.
|
||||
*
|
||||
* @private
|
||||
* @see TcpClient.prototype.addResponseListener
|
||||
* @param {Object} readInfo The incoming message
|
||||
*/
|
||||
TcpClient.prototype._onDataRead = function(readInfo) {
|
||||
// Call received callback if there's data in the response.
|
||||
if (readInfo.resultCode > 0) {
|
||||
log('onDataRead');
|
||||
|
||||
/*
|
||||
// Debug
|
||||
var bytes = [], u8 = new Uint8Array(readInfo.data);
|
||||
for (var i = 0; i < u8.length; i++) {
|
||||
bytes.push(u8[i]);
|
||||
}
|
||||
log("received bytes: " + (bytes.join(',')));
|
||||
*/
|
||||
|
||||
if (this.callbacks.recvBuffer) {
|
||||
// Return raw ArrayBuffer directly.
|
||||
this.callbacks.recvBuffer(readInfo.data);
|
||||
}
|
||||
if (this.callbacks.recvString) {
|
||||
// Convert ArrayBuffer to string.
|
||||
this._arrayBufferToString(readInfo.data, function(str) {
|
||||
this.callbacks.recvString(str);
|
||||
}.bind(this));
|
||||
}
|
||||
|
||||
// Trigger another read right away
|
||||
setTimeout(this._periodicallyRead.bind(this), 0);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Callback for when data has been successfully
|
||||
* written to the socket.
|
||||
*
|
||||
* @private
|
||||
* @param {Object} writeInfo The outgoing message
|
||||
*/
|
||||
TcpClient.prototype._onWriteComplete = function(writeInfo) {
|
||||
log('onWriteComplete');
|
||||
// Call sent callback.
|
||||
if (this.callbacks.sent) {
|
||||
this.callbacks.sent(writeInfo);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts an array buffer to a string
|
||||
*
|
||||
* @private
|
||||
* @param {ArrayBuffer} buf The buffer to convert
|
||||
* @param {Function} callback The function to call when conversion is complete
|
||||
*/
|
||||
TcpClient.prototype._arrayBufferToString = function(buf, callback) {
|
||||
var bb = new Blob([new Uint8Array(buf)]);
|
||||
var f = new FileReader();
|
||||
f.onload = function(e) {
|
||||
callback(e.target.result);
|
||||
};
|
||||
f.readAsText(bb);
|
||||
};
|
||||
|
||||
/**
|
||||
* Converts a string to an array buffer
|
||||
*
|
||||
* @private
|
||||
* @param {String} str The string to convert
|
||||
* @param {Function} callback The function to call when conversion is complete
|
||||
*/
|
||||
TcpClient.prototype._stringToArrayBuffer = function(str, callback) {
|
||||
var bb = new Blob([str]);
|
||||
var f = new FileReader();
|
||||
f.onload = function(e) {
|
||||
callback(e.target.result);
|
||||
};
|
||||
f.readAsArrayBuffer(bb);
|
||||
};
|
||||
|
||||
/**
|
||||
* Wrapper function for logging
|
||||
*/
|
||||
function log(msg) {
|
||||
console.log(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Wrapper function for error logging
|
||||
*/
|
||||
function error(msg) {
|
||||
console.error(msg);
|
||||
}
|
||||
|
||||
exports.TcpClient = TcpClient;
|
||||
|
||||
})(window);
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,543 @@
|
||||
var kbdUtil = (function() {
|
||||
"use strict";
|
||||
|
||||
function substituteCodepoint(cp) {
|
||||
// Any Unicode code points which do not have corresponding keysym entries
|
||||
// can be swapped out for another code point by adding them to this table
|
||||
var substitutions = {
|
||||
// {S,s} with comma below -> {S,s} with cedilla
|
||||
0x218 : 0x15e,
|
||||
0x219 : 0x15f,
|
||||
// {T,t} with comma below -> {T,t} with cedilla
|
||||
0x21a : 0x162,
|
||||
0x21b : 0x163
|
||||
};
|
||||
|
||||
var sub = substitutions[cp];
|
||||
return sub ? sub : cp;
|
||||
}
|
||||
|
||||
function isMac() {
|
||||
return navigator && !!(/mac/i).exec(navigator.platform);
|
||||
}
|
||||
function isWindows() {
|
||||
return navigator && !!(/win/i).exec(navigator.platform);
|
||||
}
|
||||
function isLinux() {
|
||||
return navigator && !!(/linux/i).exec(navigator.platform);
|
||||
}
|
||||
|
||||
// Return true if a modifier which is not the specified char modifier (and is not shift) is down
|
||||
function hasShortcutModifier(charModifier, currentModifiers) {
|
||||
var mods = {};
|
||||
for (var key in currentModifiers) {
|
||||
if (parseInt(key) !== 0xffe1) {
|
||||
mods[key] = currentModifiers[key];
|
||||
}
|
||||
}
|
||||
|
||||
var sum = 0;
|
||||
for (var k in currentModifiers) {
|
||||
if (mods[k]) {
|
||||
++sum;
|
||||
}
|
||||
}
|
||||
if (hasCharModifier(charModifier, mods)) {
|
||||
return sum > charModifier.length;
|
||||
}
|
||||
else {
|
||||
return sum > 0;
|
||||
}
|
||||
}
|
||||
|
||||
// Return true if the specified char modifier is currently down
|
||||
function hasCharModifier(charModifier, currentModifiers) {
|
||||
if (charModifier.length === 0) { return false; }
|
||||
|
||||
for (var i = 0; i < charModifier.length; ++i) {
|
||||
if (!currentModifiers[charModifier[i]]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Helper object tracking modifier key state
|
||||
// and generates fake key events to compensate if it gets out of sync
|
||||
function ModifierSync(charModifier) {
|
||||
var ctrl = 0xffe3;
|
||||
var alt = 0xffe9;
|
||||
var altGr = 0xfe03;
|
||||
var shift = 0xffe1;
|
||||
var meta = 0xffe7;
|
||||
|
||||
if (!charModifier) {
|
||||
if (isMac()) {
|
||||
// on Mac, Option (AKA Alt) is used as a char modifier
|
||||
charModifier = [alt];
|
||||
}
|
||||
else if (isWindows()) {
|
||||
// on Windows, Ctrl+Alt is used as a char modifier
|
||||
charModifier = [alt, ctrl];
|
||||
}
|
||||
else if (isLinux()) {
|
||||
// on Linux, AltGr is used as a char modifier
|
||||
charModifier = [altGr];
|
||||
}
|
||||
else {
|
||||
charModifier = [];
|
||||
}
|
||||
}
|
||||
|
||||
var state = {};
|
||||
state[ctrl] = false;
|
||||
state[alt] = false;
|
||||
state[altGr] = false;
|
||||
state[shift] = false;
|
||||
state[meta] = false;
|
||||
|
||||
function sync(evt, keysym) {
|
||||
var result = [];
|
||||
function syncKey(keysym) {
|
||||
return {keysym: keysyms.lookup(keysym), type: state[keysym] ? 'keydown' : 'keyup'};
|
||||
}
|
||||
|
||||
if (evt.ctrlKey !== undefined && evt.ctrlKey !== state[ctrl] && keysym !== ctrl) {
|
||||
state[ctrl] = evt.ctrlKey;
|
||||
result.push(syncKey(ctrl));
|
||||
}
|
||||
if (evt.altKey !== undefined && evt.altKey !== state[alt] && keysym !== alt) {
|
||||
state[alt] = evt.altKey;
|
||||
result.push(syncKey(alt));
|
||||
}
|
||||
if (evt.altGraphKey !== undefined && evt.altGraphKey !== state[altGr] && keysym !== altGr) {
|
||||
state[altGr] = evt.altGraphKey;
|
||||
result.push(syncKey(altGr));
|
||||
}
|
||||
if (evt.shiftKey !== undefined && evt.shiftKey !== state[shift] && keysym !== shift) {
|
||||
state[shift] = evt.shiftKey;
|
||||
result.push(syncKey(shift));
|
||||
}
|
||||
if (evt.metaKey !== undefined && evt.metaKey !== state[meta] && keysym !== meta) {
|
||||
state[meta] = evt.metaKey;
|
||||
result.push(syncKey(meta));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
function syncKeyEvent(evt, down) {
|
||||
var obj = getKeysym(evt);
|
||||
var keysym = obj ? obj.keysym : null;
|
||||
|
||||
// first, apply the event itself, if relevant
|
||||
if (keysym !== null && state[keysym] !== undefined) {
|
||||
state[keysym] = down;
|
||||
}
|
||||
return sync(evt, keysym);
|
||||
}
|
||||
|
||||
return {
|
||||
// sync on the appropriate keyboard event
|
||||
keydown: function(evt) { return syncKeyEvent(evt, true);},
|
||||
keyup: function(evt) { return syncKeyEvent(evt, false);},
|
||||
// Call this with a non-keyboard event (such as mouse events) to use its modifier state to synchronize anyway
|
||||
syncAny: function(evt) { return sync(evt);},
|
||||
|
||||
// is a shortcut modifier down?
|
||||
hasShortcutModifier: function() { return hasShortcutModifier(charModifier, state); },
|
||||
// if a char modifier is down, return the keys it consists of, otherwise return null
|
||||
activeCharModifier: function() { return hasCharModifier(charModifier, state) ? charModifier : null; }
|
||||
};
|
||||
}
|
||||
|
||||
// Get a key ID from a keyboard event
|
||||
// May be a string or an integer depending on the available properties
|
||||
function getKey(evt){
|
||||
if ('keyCode' in evt && 'key' in evt) {
|
||||
return evt.key + ':' + evt.keyCode;
|
||||
}
|
||||
else if ('keyCode' in evt) {
|
||||
return evt.keyCode;
|
||||
}
|
||||
else {
|
||||
return evt.key;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the most reliable keysym value we can get from a key event
|
||||
// if char/charCode is available, prefer those, otherwise fall back to key/keyCode/which
|
||||
function getKeysym(evt){
|
||||
var codepoint;
|
||||
if (evt.char && evt.char.length === 1) {
|
||||
codepoint = evt.char.charCodeAt();
|
||||
}
|
||||
else if (evt.charCode) {
|
||||
codepoint = evt.charCode;
|
||||
}
|
||||
else if (evt.keyCode && evt.type === 'keypress') {
|
||||
// IE10 stores the char code as keyCode, and has no other useful properties
|
||||
codepoint = evt.keyCode;
|
||||
}
|
||||
if (codepoint) {
|
||||
var res = keysyms.fromUnicode(substituteCodepoint(codepoint));
|
||||
if (res) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
// we could check evt.key here.
|
||||
// Legal values are defined in http://www.w3.org/TR/DOM-Level-3-Events/#key-values-list,
|
||||
// so we "just" need to map them to keysym, but AFAIK this is only available in IE10, which also provides evt.key
|
||||
// so we don't *need* it yet
|
||||
if (evt.keyCode) {
|
||||
return keysyms.lookup(keysymFromKeyCode(evt.keyCode, evt.shiftKey));
|
||||
}
|
||||
if (evt.which) {
|
||||
return keysyms.lookup(keysymFromKeyCode(evt.which, evt.shiftKey));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Given a keycode, try to predict which keysym it might be.
|
||||
// If the keycode is unknown, null is returned.
|
||||
function keysymFromKeyCode(keycode, shiftPressed) {
|
||||
if (typeof(keycode) !== 'number') {
|
||||
return null;
|
||||
}
|
||||
// won't be accurate for azerty
|
||||
if (keycode >= 0x30 && keycode <= 0x39) {
|
||||
return keycode; // digit
|
||||
}
|
||||
if (keycode >= 0x41 && keycode <= 0x5a) {
|
||||
// remap to lowercase unless shift is down
|
||||
return shiftPressed ? keycode : keycode + 32; // A-Z
|
||||
}
|
||||
if (keycode >= 0x60 && keycode <= 0x69) {
|
||||
return 0xffb0 + (keycode - 0x60); // numpad 0-9
|
||||
}
|
||||
|
||||
switch(keycode) {
|
||||
case 0x20: return 0x20; // space
|
||||
case 0x6a: return 0xffaa; // multiply
|
||||
case 0x6b: return 0xffab; // add
|
||||
case 0x6c: return 0xffac; // separator
|
||||
case 0x6d: return 0xffad; // subtract
|
||||
case 0x6e: return 0xffae; // decimal
|
||||
case 0x6f: return 0xffaf; // divide
|
||||
case 0xbb: return 0x2b; // +
|
||||
case 0xbc: return 0x2c; // ,
|
||||
case 0xbd: return 0x2d; // -
|
||||
case 0xbe: return 0x2e; // .
|
||||
}
|
||||
|
||||
return nonCharacterKey({keyCode: keycode});
|
||||
}
|
||||
|
||||
// if the key is a known non-character key (any key which doesn't generate character data)
|
||||
// return its keysym value. Otherwise return null
|
||||
function nonCharacterKey(evt) {
|
||||
// evt.key not implemented yet
|
||||
if (!evt.keyCode) { return null; }
|
||||
var keycode = evt.keyCode;
|
||||
|
||||
if (keycode >= 0x70 && keycode <= 0x87) {
|
||||
return 0xffbe + keycode - 0x70; // F1-F24
|
||||
}
|
||||
switch (keycode) {
|
||||
|
||||
case 8 : return 0xFF08; // BACKSPACE
|
||||
case 13 : return 0xFF0D; // ENTER
|
||||
|
||||
case 9 : return 0xFF09; // TAB
|
||||
|
||||
case 27 : return 0xFF1B; // ESCAPE
|
||||
case 46 : return 0xFFFF; // DELETE
|
||||
|
||||
case 36 : return 0xFF50; // HOME
|
||||
case 35 : return 0xFF57; // END
|
||||
case 33 : return 0xFF55; // PAGE_UP
|
||||
case 34 : return 0xFF56; // PAGE_DOWN
|
||||
case 45 : return 0xFF63; // INSERT
|
||||
|
||||
case 37 : return 0xFF51; // LEFT
|
||||
case 38 : return 0xFF52; // UP
|
||||
case 39 : return 0xFF53; // RIGHT
|
||||
case 40 : return 0xFF54; // DOWN
|
||||
case 16 : return 0xFFE1; // SHIFT
|
||||
case 17 : return 0xFFE3; // CONTROL
|
||||
case 18 : return 0xFFE9; // Left ALT (Mac Option)
|
||||
|
||||
case 224 : return 0xFE07; // Meta
|
||||
case 225 : return 0xFE03; // AltGr
|
||||
case 91 : return 0xFFEC; // Super_L (Win Key)
|
||||
case 92 : return 0xFFED; // Super_R (Win Key)
|
||||
case 93 : return 0xFF67; // Menu (Win Menu), Mac Command
|
||||
default: return null;
|
||||
}
|
||||
}
|
||||
return {
|
||||
hasShortcutModifier : hasShortcutModifier,
|
||||
hasCharModifier : hasCharModifier,
|
||||
ModifierSync : ModifierSync,
|
||||
getKey : getKey,
|
||||
getKeysym : getKeysym,
|
||||
keysymFromKeyCode : keysymFromKeyCode,
|
||||
nonCharacterKey : nonCharacterKey,
|
||||
substituteCodepoint : substituteCodepoint
|
||||
};
|
||||
})();
|
||||
|
||||
// Takes a DOM keyboard event and:
|
||||
// - determines which keysym it represents
|
||||
// - determines a keyId identifying the key that was pressed (corresponding to the key/keyCode properties on the DOM event)
|
||||
// - synthesizes events to synchronize modifier key state between which modifiers are actually down, and which we thought were down
|
||||
// - marks each event with an 'escape' property if a modifier was down which should be "escaped"
|
||||
// - generates a "stall" event in cases where it might be necessary to wait and see if a keypress event follows a keydown
|
||||
// This information is collected into an object which is passed to the next() function. (one call per event)
|
||||
function KeyEventDecoder(modifierState, next) {
|
||||
"use strict";
|
||||
function sendAll(evts) {
|
||||
for (var i = 0; i < evts.length; ++i) {
|
||||
next(evts[i]);
|
||||
}
|
||||
}
|
||||
function process(evt, type) {
|
||||
var result = {type: type};
|
||||
var keyId = kbdUtil.getKey(evt);
|
||||
if (keyId) {
|
||||
result.keyId = keyId;
|
||||
}
|
||||
|
||||
var keysym = kbdUtil.getKeysym(evt);
|
||||
|
||||
var hasModifier = modifierState.hasShortcutModifier() || !!modifierState.activeCharModifier();
|
||||
// Is this a case where we have to decide on the keysym right away, rather than waiting for the keypress?
|
||||
// "special" keys like enter, tab or backspace don't send keypress events,
|
||||
// and some browsers don't send keypresses at all if a modifier is down
|
||||
if (keysym && (type !== 'keydown' || kbdUtil.nonCharacterKey(evt) || hasModifier)) {
|
||||
result.keysym = keysym;
|
||||
}
|
||||
|
||||
var isShift = evt.keyCode === 0x10 || evt.key === 'Shift';
|
||||
|
||||
// Should we prevent the browser from handling the event?
|
||||
// Doing so on a keydown (in most browsers) prevents keypress from being generated
|
||||
// so only do that if we have to.
|
||||
var suppress = !isShift && (type !== 'keydown' || modifierState.hasShortcutModifier() || !!kbdUtil.nonCharacterKey(evt));
|
||||
|
||||
// If a char modifier is down on a keydown, we need to insert a stall,
|
||||
// so VerifyCharModifier knows to wait and see if a keypress is comnig
|
||||
var stall = type === 'keydown' && modifierState.activeCharModifier() && !kbdUtil.nonCharacterKey(evt);
|
||||
|
||||
// if a char modifier is pressed, get the keys it consists of (on Windows, AltGr is equivalent to Ctrl+Alt)
|
||||
var active = modifierState.activeCharModifier();
|
||||
|
||||
// If we have a char modifier down, and we're able to determine a keysym reliably
|
||||
// then (a) we know to treat the modifier as a char modifier,
|
||||
// and (b) we'll have to "escape" the modifier to undo the modifier when sending the char.
|
||||
if (active && keysym) {
|
||||
var isCharModifier = false;
|
||||
for (var i = 0; i < active.length; ++i) {
|
||||
if (active[i] === keysym.keysym) {
|
||||
isCharModifier = true;
|
||||
}
|
||||
}
|
||||
if (type === 'keypress' && !isCharModifier) {
|
||||
result.escape = modifierState.activeCharModifier();
|
||||
}
|
||||
}
|
||||
|
||||
if (stall) {
|
||||
// insert a fake "stall" event
|
||||
next({type: 'stall'});
|
||||
}
|
||||
next(result);
|
||||
|
||||
return suppress;
|
||||
}
|
||||
|
||||
return {
|
||||
keydown: function(evt) {
|
||||
sendAll(modifierState.keydown(evt));
|
||||
return process(evt, 'keydown');
|
||||
},
|
||||
keypress: function(evt) {
|
||||
return process(evt, 'keypress');
|
||||
},
|
||||
keyup: function(evt) {
|
||||
sendAll(modifierState.keyup(evt));
|
||||
return process(evt, 'keyup');
|
||||
},
|
||||
syncModifiers: function(evt) {
|
||||
sendAll(modifierState.syncAny(evt));
|
||||
},
|
||||
releaseAll: function() { next({type: 'releaseall'}); }
|
||||
};
|
||||
}
|
||||
|
||||
// Combines keydown and keypress events where necessary to handle char modifiers.
|
||||
// On some OS'es, a char modifier is sometimes used as a shortcut modifier.
|
||||
// For example, on Windows, AltGr is synonymous with Ctrl-Alt. On a Danish keyboard layout, AltGr-2 yields a @, but Ctrl-Alt-D does nothing
|
||||
// so when used with the '2' key, Ctrl-Alt counts as a char modifier (and should be escaped), but when used with 'D', it does not.
|
||||
// The only way we can distinguish these cases is to wait and see if a keypress event arrives
|
||||
// When we receive a "stall" event, wait a few ms before processing the next keydown. If a keypress has also arrived, merge the two
|
||||
function VerifyCharModifier(next) {
|
||||
"use strict";
|
||||
var queue = [];
|
||||
var timer = null;
|
||||
function process() {
|
||||
if (timer) {
|
||||
return;
|
||||
}
|
||||
|
||||
var delayProcess = function () {
|
||||
clearTimeout(timer);
|
||||
timer = null;
|
||||
process();
|
||||
};
|
||||
|
||||
while (queue.length !== 0) {
|
||||
var cur = queue[0];
|
||||
queue = queue.splice(1);
|
||||
switch (cur.type) {
|
||||
case 'stall':
|
||||
// insert a delay before processing available events.
|
||||
/* jshint loopfunc: true */
|
||||
timer = setTimeout(delayProcess, 5);
|
||||
/* jshint loopfunc: false */
|
||||
return;
|
||||
case 'keydown':
|
||||
// is the next element a keypress? Then we should merge the two
|
||||
if (queue.length !== 0 && queue[0].type === 'keypress') {
|
||||
// Firefox sends keypress even when no char is generated.
|
||||
// so, if keypress keysym is the same as we'd have guessed from keydown,
|
||||
// the modifier didn't have any effect, and should not be escaped
|
||||
if (queue[0].escape && (!cur.keysym || cur.keysym.keysym !== queue[0].keysym.keysym)) {
|
||||
cur.escape = queue[0].escape;
|
||||
}
|
||||
cur.keysym = queue[0].keysym;
|
||||
queue = queue.splice(1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// swallow stall events, and pass all others to the next stage
|
||||
if (cur.type !== 'stall') {
|
||||
next(cur);
|
||||
}
|
||||
}
|
||||
}
|
||||
return function(evt) {
|
||||
queue.push(evt);
|
||||
process();
|
||||
};
|
||||
}
|
||||
|
||||
// Keeps track of which keys we (and the server) believe are down
|
||||
// When a keyup is received, match it against this list, to determine the corresponding keysym(s)
|
||||
// in some cases, a single key may produce multiple keysyms, so the corresponding keyup event must release all of these chars
|
||||
// key repeat events should be merged into a single entry.
|
||||
// Because we can't always identify which entry a keydown or keyup event corresponds to, we sometimes have to guess
|
||||
function TrackKeyState(next) {
|
||||
"use strict";
|
||||
var state = [];
|
||||
|
||||
return function (evt) {
|
||||
var last = state.length !== 0 ? state[state.length-1] : null;
|
||||
|
||||
switch (evt.type) {
|
||||
case 'keydown':
|
||||
// insert a new entry if last seen key was different.
|
||||
if (!last || !evt.keyId || last.keyId !== evt.keyId) {
|
||||
last = {keyId: evt.keyId, keysyms: {}};
|
||||
state.push(last);
|
||||
}
|
||||
if (evt.keysym) {
|
||||
// make sure last event contains this keysym (a single "logical" keyevent
|
||||
// can cause multiple key events to be sent to the VNC server)
|
||||
last.keysyms[evt.keysym.keysym] = evt.keysym;
|
||||
last.ignoreKeyPress = true;
|
||||
next(evt);
|
||||
}
|
||||
break;
|
||||
case 'keypress':
|
||||
if (!last) {
|
||||
last = {keyId: evt.keyId, keysyms: {}};
|
||||
state.push(last);
|
||||
}
|
||||
if (!evt.keysym) {
|
||||
console.log('keypress with no keysym:', evt);
|
||||
}
|
||||
|
||||
// If we didn't expect a keypress, and already sent a keydown to the VNC server
|
||||
// based on the keydown, make sure to skip this event.
|
||||
if (evt.keysym && !last.ignoreKeyPress) {
|
||||
last.keysyms[evt.keysym.keysym] = evt.keysym;
|
||||
evt.type = 'keydown';
|
||||
next(evt);
|
||||
}
|
||||
break;
|
||||
case 'keyup':
|
||||
if (state.length === 0) {
|
||||
return;
|
||||
}
|
||||
var idx = null;
|
||||
// do we have a matching key tracked as being down?
|
||||
for (var i = 0; i !== state.length; ++i) {
|
||||
if (state[i].keyId === evt.keyId) {
|
||||
idx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// if we couldn't find a match (it happens), assume it was the last key pressed
|
||||
if (idx === null) {
|
||||
idx = state.length - 1;
|
||||
}
|
||||
|
||||
var item = state.splice(idx, 1)[0];
|
||||
// for each keysym tracked by this key entry, clone the current event and override the keysym
|
||||
var clone = (function(){
|
||||
function Clone(){}
|
||||
return function (obj) { Clone.prototype=obj; return new Clone(); };
|
||||
}());
|
||||
for (var key in item.keysyms) {
|
||||
var out = clone(evt);
|
||||
out.keysym = item.keysyms[key];
|
||||
next(out);
|
||||
}
|
||||
break;
|
||||
case 'releaseall':
|
||||
/* jshint shadow: true */
|
||||
for (var i = 0; i < state.length; ++i) {
|
||||
for (var key in state[i].keysyms) {
|
||||
var keysym = state[i].keysyms[key];
|
||||
next({keyId: 0, keysym: keysym, type: 'keyup'});
|
||||
}
|
||||
}
|
||||
/* jshint shadow: false */
|
||||
state = [];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Handles "escaping" of modifiers: if a char modifier is used to produce a keysym (such as AltGr-2 to generate an @),
|
||||
// then the modifier must be "undone" before sending the @, and "redone" afterwards.
|
||||
function EscapeModifiers(next) {
|
||||
"use strict";
|
||||
return function(evt) {
|
||||
if (evt.type !== 'keydown' || evt.escape === undefined) {
|
||||
next(evt);
|
||||
return;
|
||||
}
|
||||
// undo modifiers
|
||||
for (var i = 0; i < evt.escape.length; ++i) {
|
||||
next({type: 'keyup', keyId: 0, keysym: keysyms.lookup(evt.escape[i])});
|
||||
}
|
||||
// send the character event
|
||||
next(evt);
|
||||
// redo modifiers
|
||||
/* jshint shadow: true */
|
||||
for (var i = 0; i < evt.escape.length; ++i) {
|
||||
next({type: 'keydown', keyId: 0, keysym: keysyms.lookup(evt.escape[i])});
|
||||
}
|
||||
/* jshint shadow: false */
|
||||
};
|
||||
}
|
@ -0,0 +1,376 @@
|
||||
var XK_VoidSymbol = 0xffffff, /* Void symbol */
|
||||
|
||||
XK_BackSpace = 0xff08, /* Back space, back char */
|
||||
XK_Tab = 0xff09,
|
||||
XK_Linefeed = 0xff0a, /* Linefeed, LF */
|
||||
XK_Clear = 0xff0b,
|
||||
XK_Return = 0xff0d, /* Return, enter */
|
||||
XK_Pause = 0xff13, /* Pause, hold */
|
||||
XK_Scroll_Lock = 0xff14,
|
||||
XK_Sys_Req = 0xff15,
|
||||
XK_Escape = 0xff1b,
|
||||
XK_Delete = 0xffff, /* Delete, rubout */
|
||||
|
||||
/* Cursor control & motion */
|
||||
|
||||
XK_Home = 0xff50,
|
||||
XK_Left = 0xff51, /* Move left, left arrow */
|
||||
XK_Up = 0xff52, /* Move up, up arrow */
|
||||
XK_Right = 0xff53, /* Move right, right arrow */
|
||||
XK_Down = 0xff54, /* Move down, down arrow */
|
||||
XK_Prior = 0xff55, /* Prior, previous */
|
||||
XK_Page_Up = 0xff55,
|
||||
XK_Next = 0xff56, /* Next */
|
||||
XK_Page_Down = 0xff56,
|
||||
XK_End = 0xff57, /* EOL */
|
||||
XK_Begin = 0xff58, /* BOL */
|
||||
|
||||
|
||||
/* Misc functions */
|
||||
|
||||
XK_Select = 0xff60, /* Select, mark */
|
||||
XK_Print = 0xff61,
|
||||
XK_Execute = 0xff62, /* Execute, run, do */
|
||||
XK_Insert = 0xff63, /* Insert, insert here */
|
||||
XK_Undo = 0xff65,
|
||||
XK_Redo = 0xff66, /* Redo, again */
|
||||
XK_Menu = 0xff67,
|
||||
XK_Find = 0xff68, /* Find, search */
|
||||
XK_Cancel = 0xff69, /* Cancel, stop, abort, exit */
|
||||
XK_Help = 0xff6a, /* Help */
|
||||
XK_Break = 0xff6b,
|
||||
XK_Mode_switch = 0xff7e, /* Character set switch */
|
||||
XK_script_switch = 0xff7e, /* Alias for mode_switch */
|
||||
XK_Num_Lock = 0xff7f,
|
||||
|
||||
/* Keypad functions, keypad numbers cleverly chosen to map to ASCII */
|
||||
|
||||
XK_KP_Space = 0xff80, /* Space */
|
||||
XK_KP_Tab = 0xff89,
|
||||
XK_KP_Enter = 0xff8d, /* Enter */
|
||||
XK_KP_F1 = 0xff91, /* PF1, KP_A, ... */
|
||||
XK_KP_F2 = 0xff92,
|
||||
XK_KP_F3 = 0xff93,
|
||||
XK_KP_F4 = 0xff94,
|
||||
XK_KP_Home = 0xff95,
|
||||
XK_KP_Left = 0xff96,
|
||||
XK_KP_Up = 0xff97,
|
||||
XK_KP_Right = 0xff98,
|
||||
XK_KP_Down = 0xff99,
|
||||
XK_KP_Prior = 0xff9a,
|
||||
XK_KP_Page_Up = 0xff9a
|
||||
XK_KP_Next = 0xff9b,
|
||||
XK_KP_Page_Down = 0xff9b,
|
||||
XK_KP_End = 0xff9c,
|
||||
XK_KP_Begin = 0xff9d,
|
||||
XK_KP_Insert = 0xff9e,
|
||||
XK_KP_Delete = 0xff9f,
|
||||
XK_KP_Equal = 0xffbd, /* Equals */
|
||||
XK_KP_Multiply = 0xffaa,
|
||||
XK_KP_Add = 0xffab,
|
||||
XK_KP_Separator = 0xffac, /* Separator, often comma */
|
||||
XK_KP_Subtract = 0xffad,
|
||||
XK_KP_Decimal = 0xffae,
|
||||
XK_KP_Divide = 0xffaf,
|
||||
|
||||
XK_KP_0 = 0xffb0,
|
||||
XK_KP_1 = 0xffb1,
|
||||
XK_KP_2 = 0xffb2,
|
||||
XK_KP_3 = 0xffb3,
|
||||
XK_KP_4 = 0xffb4,
|
||||
XK_KP_5 = 0xffb5,
|
||||
XK_KP_6 = 0xffb6,
|
||||
XK_KP_7 = 0xffb7,
|
||||
XK_KP_8 = 0xffb8,
|
||||
XK_KP_9 = 0xffb9,
|
||||
|
||||
/*
|
||||
* Auxiliary functions; note the duplicate definitions for left and right
|
||||
* function keys; Sun keyboards and a few other manufacturers have such
|
||||
* function key groups on the left and/or right sides of the keyboard.
|
||||
* We've not found a keyboard with more than 35 function keys total.
|
||||
*/
|
||||
|
||||
XK_F1 = 0xffbe,
|
||||
XK_F2 = 0xffbf,
|
||||
XK_F3 = 0xffc0,
|
||||
XK_F4 = 0xffc1,
|
||||
XK_F5 = 0xffc2,
|
||||
XK_F6 = 0xffc3,
|
||||
XK_F7 = 0xffc4,
|
||||
XK_F8 = 0xffc5,
|
||||
XK_F9 = 0xffc6,
|
||||
XK_F10 = 0xffc7,
|
||||
XK_F11 = 0xffc8,
|
||||
XK_L1 = 0xffc8,
|
||||
XK_F12 = 0xffc9,
|
||||
XK_L2 = 0xffc9,
|
||||
XK_F13 = 0xffca,
|
||||
XK_L3 = 0xffca,
|
||||
XK_F14 = 0xffcb,
|
||||
XK_L4 = 0xffcb,
|
||||
XK_F15 = 0xffcc,
|
||||
XK_L5 = 0xffcc,
|
||||
XK_F16 = 0xffcd,
|
||||
XK_L6 = 0xffcd,
|
||||
XK_F17 = 0xffce,
|
||||
XK_L7 = 0xffce,
|
||||
XK_F18 = 0xffcf,
|
||||
XK_L8 = 0xffcf,
|
||||
XK_F19 = 0xffd0,
|
||||
XK_L9 = 0xffd0,
|
||||
XK_F20 = 0xffd1,
|
||||
XK_L10 = 0xffd1,
|
||||
XK_F21 = 0xffd2,
|
||||
XK_R1 = 0xffd2,
|
||||
XK_F22 = 0xffd3,
|
||||
XK_R2 = 0xffd3,
|
||||
XK_F23 = 0xffd4,
|
||||
XK_R3 = 0xffd4,
|
||||
XK_F24 = 0xffd5,
|
||||
XK_R4 = 0xffd5,
|
||||
XK_F25 = 0xffd6,
|
||||
XK_R5 = 0xffd6,
|
||||
XK_F26 = 0xffd7,
|
||||
XK_R6 = 0xffd7,
|
||||
XK_F27 = 0xffd8,
|
||||
XK_R7 = 0xffd8,
|
||||
XK_F28 = 0xffd9,
|
||||
XK_R8 = 0xffd9,
|
||||
XK_F29 = 0xffda,
|
||||
XK_R9 = 0xffda,
|
||||
XK_F30 = 0xffdb,
|
||||
XK_R10 = 0xffdb,
|
||||
XK_F31 = 0xffdc,
|
||||
XK_R11 = 0xffdc,
|
||||
XK_F32 = 0xffdd,
|
||||
XK_R12 = 0xffdd,
|
||||
XK_F33 = 0xffde,
|
||||
XK_R13 = 0xffde,
|
||||
XK_F34 = 0xffdf,
|
||||
XK_R14 = 0xffdf,
|
||||
XK_F35 = 0xffe0,
|
||||
XK_R15 = 0xffe0,
|
||||
|
||||
/* Modifiers */
|
||||
|
||||
XK_Shift_L = 0xffe1, /* Left shift */
|
||||
XK_Shift_R = 0xffe2, /* Right shift */
|
||||
XK_Control_L = 0xffe3, /* Left control */
|
||||
XK_Control_R = 0xffe4, /* Right control */
|
||||
XK_Caps_Lock = 0xffe5, /* Caps lock */
|
||||
XK_Shift_Lock = 0xffe6, /* Shift lock */
|
||||
|
||||
XK_Meta_L = 0xffe7, /* Left meta */
|
||||
XK_Meta_R = 0xffe8, /* Right meta */
|
||||
XK_Alt_L = 0xffe9, /* Left alt */
|
||||
XK_Alt_R = 0xffea, /* Right alt */
|
||||
XK_Super_L = 0xffeb, /* Left super */
|
||||
XK_Super_R = 0xffec, /* Right super */
|
||||
XK_Hyper_L = 0xffed, /* Left hyper */
|
||||
XK_Hyper_R = 0xffee, /* Right hyper */
|
||||
|
||||
/*
|
||||
* Latin 1
|
||||
* (ISO/IEC 8859-1 = Unicode U+0020..U+00FF)
|
||||
* Byte 3 = 0
|
||||
*/
|
||||
|
||||
XK_space = 0x0020, /* U+0020 SPACE */
|
||||
XK_exclam = 0x0021, /* U+0021 EXCLAMATION MARK */
|
||||
XK_quotedbl = 0x0022, /* U+0022 QUOTATION MARK */
|
||||
XK_numbersign = 0x0023, /* U+0023 NUMBER SIGN */
|
||||
XK_dollar = 0x0024, /* U+0024 DOLLAR SIGN */
|
||||
XK_percent = 0x0025, /* U+0025 PERCENT SIGN */
|
||||
XK_ampersand = 0x0026, /* U+0026 AMPERSAND */
|
||||
XK_apostrophe = 0x0027, /* U+0027 APOSTROPHE */
|
||||
XK_quoteright = 0x0027, /* deprecated */
|
||||
XK_parenleft = 0x0028, /* U+0028 LEFT PARENTHESIS */
|
||||
XK_parenright = 0x0029, /* U+0029 RIGHT PARENTHESIS */
|
||||
XK_asterisk = 0x002a, /* U+002A ASTERISK */
|
||||
XK_plus = 0x002b, /* U+002B PLUS SIGN */
|
||||
XK_comma = 0x002c, /* U+002C COMMA */
|
||||
XK_minus = 0x002d, /* U+002D HYPHEN-MINUS */
|
||||
XK_period = 0x002e, /* U+002E FULL STOP */
|
||||
XK_slash = 0x002f, /* U+002F SOLIDUS */
|
||||
XK_0 = 0x0030, /* U+0030 DIGIT ZERO */
|
||||
XK_1 = 0x0031, /* U+0031 DIGIT ONE */
|
||||
XK_2 = 0x0032, /* U+0032 DIGIT TWO */
|
||||
XK_3 = 0x0033, /* U+0033 DIGIT THREE */
|
||||
XK_4 = 0x0034, /* U+0034 DIGIT FOUR */
|
||||
XK_5 = 0x0035, /* U+0035 DIGIT FIVE */
|
||||
XK_6 = 0x0036, /* U+0036 DIGIT SIX */
|
||||
XK_7 = 0x0037, /* U+0037 DIGIT SEVEN */
|
||||
XK_8 = 0x0038, /* U+0038 DIGIT EIGHT */
|
||||
XK_9 = 0x0039, /* U+0039 DIGIT NINE */
|
||||
XK_colon = 0x003a, /* U+003A COLON */
|
||||
XK_semicolon = 0x003b, /* U+003B SEMICOLON */
|
||||
XK_less = 0x003c, /* U+003C LESS-THAN SIGN */
|
||||
XK_equal = 0x003d, /* U+003D EQUALS SIGN */
|
||||
XK_greater = 0x003e, /* U+003E GREATER-THAN SIGN */
|
||||
XK_question = 0x003f, /* U+003F QUESTION MARK */
|
||||
XK_at = 0x0040, /* U+0040 COMMERCIAL AT */
|
||||
XK_A = 0x0041, /* U+0041 LATIN CAPITAL LETTER A */
|
||||
XK_B = 0x0042, /* U+0042 LATIN CAPITAL LETTER B */
|
||||
XK_C = 0x0043, /* U+0043 LATIN CAPITAL LETTER C */
|
||||
XK_D = 0x0044, /* U+0044 LATIN CAPITAL LETTER D */
|
||||
XK_E = 0x0045, /* U+0045 LATIN CAPITAL LETTER E */
|
||||
XK_F = 0x0046, /* U+0046 LATIN CAPITAL LETTER F */
|
||||
XK_G = 0x0047, /* U+0047 LATIN CAPITAL LETTER G */
|
||||
XK_H = 0x0048, /* U+0048 LATIN CAPITAL LETTER H */
|
||||
XK_I = 0x0049, /* U+0049 LATIN CAPITAL LETTER I */
|
||||
XK_J = 0x004a, /* U+004A LATIN CAPITAL LETTER J */
|
||||
XK_K = 0x004b, /* U+004B LATIN CAPITAL LETTER K */
|
||||
XK_L = 0x004c, /* U+004C LATIN CAPITAL LETTER L */
|
||||
XK_M = 0x004d, /* U+004D LATIN CAPITAL LETTER M */
|
||||
XK_N = 0x004e, /* U+004E LATIN CAPITAL LETTER N */
|
||||
XK_O = 0x004f, /* U+004F LATIN CAPITAL LETTER O */
|
||||
XK_P = 0x0050, /* U+0050 LATIN CAPITAL LETTER P */
|
||||
XK_Q = 0x0051, /* U+0051 LATIN CAPITAL LETTER Q */
|
||||
XK_R = 0x0052, /* U+0052 LATIN CAPITAL LETTER R */
|
||||
XK_S = 0x0053, /* U+0053 LATIN CAPITAL LETTER S */
|
||||
XK_T = 0x0054, /* U+0054 LATIN CAPITAL LETTER T */
|
||||
XK_U = 0x0055, /* U+0055 LATIN CAPITAL LETTER U */
|
||||
XK_V = 0x0056, /* U+0056 LATIN CAPITAL LETTER V */
|
||||
XK_W = 0x0057, /* U+0057 LATIN CAPITAL LETTER W */
|
||||
XK_X = 0x0058, /* U+0058 LATIN CAPITAL LETTER X */
|
||||
XK_Y = 0x0059, /* U+0059 LATIN CAPITAL LETTER Y */
|
||||
XK_Z = 0x005a, /* U+005A LATIN CAPITAL LETTER Z */
|
||||
XK_bracketleft = 0x005b, /* U+005B LEFT SQUARE BRACKET */
|
||||
XK_backslash = 0x005c, /* U+005C REVERSE SOLIDUS */
|
||||
XK_bracketright = 0x005d, /* U+005D RIGHT SQUARE BRACKET */
|
||||
XK_asciicircum = 0x005e, /* U+005E CIRCUMFLEX ACCENT */
|
||||
XK_underscore = 0x005f, /* U+005F LOW LINE */
|
||||
XK_grave = 0x0060, /* U+0060 GRAVE ACCENT */
|
||||
XK_quoteleft = 0x0060, /* deprecated */
|
||||
XK_a = 0x0061, /* U+0061 LATIN SMALL LETTER A */
|
||||
XK_b = 0x0062, /* U+0062 LATIN SMALL LETTER B */
|
||||
XK_c = 0x0063, /* U+0063 LATIN SMALL LETTER C */
|
||||
XK_d = 0x0064, /* U+0064 LATIN SMALL LETTER D */
|
||||
XK_e = 0x0065, /* U+0065 LATIN SMALL LETTER E */
|
||||
XK_f = 0x0066, /* U+0066 LATIN SMALL LETTER F */
|
||||
XK_g = 0x0067, /* U+0067 LATIN SMALL LETTER G */
|
||||
XK_h = 0x0068, /* U+0068 LATIN SMALL LETTER H */
|
||||
XK_i = 0x0069, /* U+0069 LATIN SMALL LETTER I */
|
||||
XK_j = 0x006a, /* U+006A LATIN SMALL LETTER J */
|
||||
XK_k = 0x006b, /* U+006B LATIN SMALL LETTER K */
|
||||
XK_l = 0x006c, /* U+006C LATIN SMALL LETTER L */
|
||||
XK_m = 0x006d, /* U+006D LATIN SMALL LETTER M */
|
||||
XK_n = 0x006e, /* U+006E LATIN SMALL LETTER N */
|
||||
XK_o = 0x006f, /* U+006F LATIN SMALL LETTER O */
|
||||
XK_p = 0x0070, /* U+0070 LATIN SMALL LETTER P */
|
||||
XK_q = 0x0071, /* U+0071 LATIN SMALL LETTER Q */
|
||||
XK_r = 0x0072, /* U+0072 LATIN SMALL LETTER R */
|
||||
XK_s = 0x0073, /* U+0073 LATIN SMALL LETTER S */
|
||||
XK_t = 0x0074, /* U+0074 LATIN SMALL LETTER T */
|
||||
XK_u = 0x0075, /* U+0075 LATIN SMALL LETTER U */
|
||||
XK_v = 0x0076, /* U+0076 LATIN SMALL LETTER V */
|
||||
XK_w = 0x0077, /* U+0077 LATIN SMALL LETTER W */
|
||||
XK_x = 0x0078, /* U+0078 LATIN SMALL LETTER X */
|
||||
XK_y = 0x0079, /* U+0079 LATIN SMALL LETTER Y */
|
||||
XK_z = 0x007a, /* U+007A LATIN SMALL LETTER Z */
|
||||
XK_braceleft = 0x007b, /* U+007B LEFT CURLY BRACKET */
|
||||
XK_bar = 0x007c, /* U+007C VERTICAL LINE */
|
||||
XK_braceright = 0x007d, /* U+007D RIGHT CURLY BRACKET */
|
||||
XK_asciitilde = 0x007e, /* U+007E TILDE */
|
||||
|
||||
XK_nobreakspace = 0x00a0, /* U+00A0 NO-BREAK SPACE */
|
||||
XK_exclamdown = 0x00a1, /* U+00A1 INVERTED EXCLAMATION MARK */
|
||||
XK_cent = 0x00a2, /* U+00A2 CENT SIGN */
|
||||
XK_sterling = 0x00a3, /* U+00A3 POUND SIGN */
|
||||
XK_currency = 0x00a4, /* U+00A4 CURRENCY SIGN */
|
||||
XK_yen = 0x00a5, /* U+00A5 YEN SIGN */
|
||||
XK_brokenbar = 0x00a6, /* U+00A6 BROKEN BAR */
|
||||
XK_section = 0x00a7, /* U+00A7 SECTION SIGN */
|
||||
XK_diaeresis = 0x00a8, /* U+00A8 DIAERESIS */
|
||||
XK_copyright = 0x00a9, /* U+00A9 COPYRIGHT SIGN */
|
||||
XK_ordfeminine = 0x00aa, /* U+00AA FEMININE ORDINAL INDICATOR */
|
||||
XK_guillemotleft = 0x00ab, /* U+00AB LEFT-POINTING DOUBLE ANGLE QUOTATION MARK */
|
||||
XK_notsign = 0x00ac, /* U+00AC NOT SIGN */
|
||||
XK_hyphen = 0x00ad, /* U+00AD SOFT HYPHEN */
|
||||
XK_registered = 0x00ae, /* U+00AE REGISTERED SIGN */
|
||||
XK_macron = 0x00af, /* U+00AF MACRON */
|
||||
XK_degree = 0x00b0, /* U+00B0 DEGREE SIGN */
|
||||
XK_plusminus = 0x00b1, /* U+00B1 PLUS-MINUS SIGN */
|
||||
XK_twosuperior = 0x00b2, /* U+00B2 SUPERSCRIPT TWO */
|
||||
XK_threesuperior = 0x00b3, /* U+00B3 SUPERSCRIPT THREE */
|
||||
XK_acute = 0x00b4, /* U+00B4 ACUTE ACCENT */
|
||||
XK_mu = 0x00b5, /* U+00B5 MICRO SIGN */
|
||||
XK_paragraph = 0x00b6, /* U+00B6 PILCROW SIGN */
|
||||
XK_periodcentered = 0x00b7, /* U+00B7 MIDDLE DOT */
|
||||
XK_cedilla = 0x00b8, /* U+00B8 CEDILLA */
|
||||
XK_onesuperior = 0x00b9, /* U+00B9 SUPERSCRIPT ONE */
|
||||
XK_masculine = 0x00ba, /* U+00BA MASCULINE ORDINAL INDICATOR */
|
||||
XK_guillemotright = 0x00bb, /* U+00BB RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK */
|
||||
XK_onequarter = 0x00bc, /* U+00BC VULGAR FRACTION ONE QUARTER */
|
||||
XK_onehalf = 0x00bd, /* U+00BD VULGAR FRACTION ONE HALF */
|
||||
XK_threequarters = 0x00be, /* U+00BE VULGAR FRACTION THREE QUARTERS */
|
||||
XK_questiondown = 0x00bf, /* U+00BF INVERTED QUESTION MARK */
|
||||
XK_Agrave = 0x00c0, /* U+00C0 LATIN CAPITAL LETTER A WITH GRAVE */
|
||||
XK_Aacute = 0x00c1, /* U+00C1 LATIN CAPITAL LETTER A WITH ACUTE */
|
||||
XK_Acircumflex = 0x00c2, /* U+00C2 LATIN CAPITAL LETTER A WITH CIRCUMFLEX */
|
||||
XK_Atilde = 0x00c3, /* U+00C3 LATIN CAPITAL LETTER A WITH TILDE */
|
||||
XK_Adiaeresis = 0x00c4, /* U+00C4 LATIN CAPITAL LETTER A WITH DIAERESIS */
|
||||
XK_Aring = 0x00c5, /* U+00C5 LATIN CAPITAL LETTER A WITH RING ABOVE */
|
||||
XK_AE = 0x00c6, /* U+00C6 LATIN CAPITAL LETTER AE */
|
||||
XK_Ccedilla = 0x00c7, /* U+00C7 LATIN CAPITAL LETTER C WITH CEDILLA */
|
||||
XK_Egrave = 0x00c8, /* U+00C8 LATIN CAPITAL LETTER E WITH GRAVE */
|
||||
XK_Eacute = 0x00c9, /* U+00C9 LATIN CAPITAL LETTER E WITH ACUTE */
|
||||
XK_Ecircumflex = 0x00ca, /* U+00CA LATIN CAPITAL LETTER E WITH CIRCUMFLEX */
|
||||
XK_Ediaeresis = 0x00cb, /* U+00CB LATIN CAPITAL LETTER E WITH DIAERESIS */
|
||||
XK_Igrave = 0x00cc, /* U+00CC LATIN CAPITAL LETTER I WITH GRAVE */
|
||||
XK_Iacute = 0x00cd, /* U+00CD LATIN CAPITAL LETTER I WITH ACUTE */
|
||||
XK_Icircumflex = 0x00ce, /* U+00CE LATIN CAPITAL LETTER I WITH CIRCUMFLEX */
|
||||
XK_Idiaeresis = 0x00cf, /* U+00CF LATIN CAPITAL LETTER I WITH DIAERESIS */
|
||||
XK_ETH = 0x00d0, /* U+00D0 LATIN CAPITAL LETTER ETH */
|
||||
XK_Eth = 0x00d0, /* deprecated */
|
||||
XK_Ntilde = 0x00d1, /* U+00D1 LATIN CAPITAL LETTER N WITH TILDE */
|
||||
XK_Ograve = 0x00d2, /* U+00D2 LATIN CAPITAL LETTER O WITH GRAVE */
|
||||
XK_Oacute = 0x00d3, /* U+00D3 LATIN CAPITAL LETTER O WITH ACUTE */
|
||||
XK_Ocircumflex = 0x00d4, /* U+00D4 LATIN CAPITAL LETTER O WITH CIRCUMFLEX */
|
||||
XK_Otilde = 0x00d5, /* U+00D5 LATIN CAPITAL LETTER O WITH TILDE */
|
||||
XK_Odiaeresis = 0x00d6, /* U+00D6 LATIN CAPITAL LETTER O WITH DIAERESIS */
|
||||
XK_multiply = 0x00d7, /* U+00D7 MULTIPLICATION SIGN */
|
||||
XK_Oslash = 0x00d8, /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
|
||||
XK_Ooblique = 0x00d8, /* U+00D8 LATIN CAPITAL LETTER O WITH STROKE */
|
||||
XK_Ugrave = 0x00d9, /* U+00D9 LATIN CAPITAL LETTER U WITH GRAVE */
|
||||
XK_Uacute = 0x00da, /* U+00DA LATIN CAPITAL LETTER U WITH ACUTE */
|
||||
XK_Ucircumflex = 0x00db, /* U+00DB LATIN CAPITAL LETTER U WITH CIRCUMFLEX */
|
||||
XK_Udiaeresis = 0x00dc, /* U+00DC LATIN CAPITAL LETTER U WITH DIAERESIS */
|
||||
XK_Yacute = 0x00dd, /* U+00DD LATIN CAPITAL LETTER Y WITH ACUTE */
|
||||
XK_THORN = 0x00de, /* U+00DE LATIN CAPITAL LETTER THORN */
|
||||
XK_Thorn = 0x00de, /* deprecated */
|
||||
XK_ssharp = 0x00df, /* U+00DF LATIN SMALL LETTER SHARP S */
|
||||
XK_agrave = 0x00e0, /* U+00E0 LATIN SMALL LETTER A WITH GRAVE */
|
||||
XK_aacute = 0x00e1, /* U+00E1 LATIN SMALL LETTER A WITH ACUTE */
|
||||
XK_acircumflex = 0x00e2, /* U+00E2 LATIN SMALL LETTER A WITH CIRCUMFLEX */
|
||||
XK_atilde = 0x00e3, /* U+00E3 LATIN SMALL LETTER A WITH TILDE */
|
||||
XK_adiaeresis = 0x00e4, /* U+00E4 LATIN SMALL LETTER A WITH DIAERESIS */
|
||||
XK_aring = 0x00e5, /* U+00E5 LATIN SMALL LETTER A WITH RING ABOVE */
|
||||
XK_ae = 0x00e6, /* U+00E6 LATIN SMALL LETTER AE */
|
||||
XK_ccedilla = 0x00e7, /* U+00E7 LATIN SMALL LETTER C WITH CEDILLA */
|
||||
XK_egrave = 0x00e8, /* U+00E8 LATIN SMALL LETTER E WITH GRAVE */
|
||||
XK_eacute = 0x00e9, /* U+00E9 LATIN SMALL LETTER E WITH ACUTE */
|
||||
XK_ecircumflex = 0x00ea, /* U+00EA LATIN SMALL LETTER E WITH CIRCUMFLEX */
|
||||
XK_ediaeresis = 0x00eb, /* U+00EB LATIN SMALL LETTER E WITH DIAERESIS */
|
||||
XK_igrave = 0x00ec, /* U+00EC LATIN SMALL LETTER I WITH GRAVE */
|
||||
XK_iacute = 0x00ed, /* U+00ED LATIN SMALL LETTER I WITH ACUTE */
|
||||
XK_icircumflex = 0x00ee, /* U+00EE LATIN SMALL LETTER I WITH CIRCUMFLEX */
|
||||
XK_idiaeresis = 0x00ef, /* U+00EF LATIN SMALL LETTER I WITH DIAERESIS */
|
||||
XK_eth = 0x00f0, /* U+00F0 LATIN SMALL LETTER ETH */
|
||||
XK_ntilde = 0x00f1, /* U+00F1 LATIN SMALL LETTER N WITH TILDE */
|
||||
XK_ograve = 0x00f2, /* U+00F2 LATIN SMALL LETTER O WITH GRAVE */
|
||||
XK_oacute = 0x00f3, /* U+00F3 LATIN SMALL LETTER O WITH ACUTE */
|
||||
XK_ocircumflex = 0x00f4, /* U+00F4 LATIN SMALL LETTER O WITH CIRCUMFLEX */
|
||||
XK_otilde = 0x00f5, /* U+00F5 LATIN SMALL LETTER O WITH TILDE */
|
||||
XK_odiaeresis = 0x00f6, /* U+00F6 LATIN SMALL LETTER O WITH DIAERESIS */
|
||||
XK_division = 0x00f7, /* U+00F7 DIVISION SIGN */
|
||||
XK_oslash = 0x00f8, /* U+00F8 LATIN SMALL LETTER O WITH STROKE */
|
||||
XK_ooblique = 0x00f8, /* U+00F8 LATIN SMALL LETTER O WITH STROKE */
|
||||
XK_ugrave = 0x00f9, /* U+00F9 LATIN SMALL LETTER U WITH GRAVE */
|
||||
XK_uacute = 0x00fa, /* U+00FA LATIN SMALL LETTER U WITH ACUTE */
|
||||
XK_ucircumflex = 0x00fb, /* U+00FB LATIN SMALL LETTER U WITH CIRCUMFLEX */
|
||||
XK_udiaeresis = 0x00fc, /* U+00FC LATIN SMALL LETTER U WITH DIAERESIS */
|
||||
XK_yacute = 0x00fd, /* U+00FD LATIN SMALL LETTER Y WITH ACUTE */
|
||||
XK_thorn = 0x00fe, /* U+00FE LATIN SMALL LETTER THORN */
|
||||
XK_ydiaeresis = 0x00ff; /* U+00FF LATIN SMALL LETTER Y WITH DIAERESIS */
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Loading…
Reference in new issue