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

Aten iKVM support #408

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ use a WebSockets to TCP socket proxy. There is a python proxy included
* UI and Icons : Chris Gordon
* Original Logo : Michael Sersen
* tight encoding : Michael Tinglof (Mercuri.ca)
* pixel format conversion and ATEN iKVM support : [Alexander Clouter](http://www.digriz.org.uk/)

* Included libraries:
* web-socket-js : Hiroshi Ichikawa (github.com/gimite/web-socket-js)
Expand Down
28 changes: 2 additions & 26 deletions include/display.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,21 +414,12 @@ var Display;

blitImage: function (x, y, width, height, arr, offset) {
if (this._true_color) {
this._bgrxImageData(x, y, this._viewportLoc.x, this._viewportLoc.y, width, height, arr, offset);
this._imageData(x, y, this._viewportLoc.x, this._viewportLoc.y, width, height, arr, offset);
} else {
this._cmapImageData(x, y, this._viewportLoc.x, this._viewportLoc.y, width, height, arr, offset);
}
},

blitRgbImage: function (x, y , width, height, arr, offset) {
if (this._true_color) {
this._rgbImageData(x, y, this._viewportLoc.x, this._viewportLoc.y, width, height, arr, offset);
} else {
// probably wrong?
this._cmapImageData(x, y, this._viewportLoc.x, this._viewportLoc.y, width, height, arr, offset);
}
},

blitStringImage: function (str, x, y) {
var img = new Image();
img.onload = function () {
Expand Down Expand Up @@ -542,7 +533,7 @@ var Display;
}
},

_rgbImageData: function (x, y, vx, vy, width, height, arr, offset) {
_imageData: function (x, y, vx, vy, width, height, arr, offset) {
var img = this._drawCtx.createImageData(width, height);
var data = img.data;
for (var i = 0, j = offset; i < width * height * 4; i += 4, j += 3) {
Expand All @@ -554,18 +545,6 @@ var Display;
this._drawCtx.putImageData(img, x - vx, y - vy);
},

_bgrxImageData: function (x, y, vx, vy, width, height, arr, offset) {
var img = this._drawCtx.createImageData(width, height);
var data = img.data;
for (var i = 0, j = offset; i < width * height * 4; i += 4, j += 4) {
data[i] = arr[j + 2];
data[i + 1] = arr[j + 1];
data[i + 2] = arr[j];
data[i + 3] = 255; // Alpha
}
this._drawCtx.putImageData(img, x - vx, y - vy);
},

_cmapImageData: function (x, y, vx, vy, width, height, arr, offset) {
var img = this._drawCtx.createImageData(width, height);
var data = img.data;
Expand Down Expand Up @@ -594,9 +573,6 @@ var Display;
case 'blit':
this.blitImage(a.x, a.y, a.width, a.height, a.data, 0);
break;
case 'blitRgb':
this.blitRgbImage(a.x, a.y, a.width, a.height, a.data, 0);
break;
case 'img':
if (a.img.complete) {
this.drawImage(a.img, a.x, a.y);
Expand Down
77 changes: 77 additions & 0 deletions include/keysym.js
Original file line number Diff line number Diff line change
Expand Up @@ -376,3 +376,80 @@ XK_udiaeresis = 0x00fc, /* U+00FC LATIN SMALL LETTER U WITH DIA
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 */

var XK2HID = {};

// F{1..12}
for (var i = XK_F1; i <= XK_F12; i++) {
XK2HID[i] = 0x3a + (i - XK_F1);
}
// A-Za-z
for (var i = XK_A; i <= XK_Z; i++) {
XK2HID[i] = 0x04 + (i - XK_A);
XK2HID[i + (XK_a - XK_A)] = 0x04 + (i - XK_A);
}
// 1-9
for (var i = XK_1; i <= XK_9; i++) {
XK2HID[i] = 0x1e + (i - XK_1);
}

XK2HID[XK_0] = 0x27;
XK2HID[XK_Return] = 0x28;
XK2HID[XK_Escape] = 0x29;
XK2HID[XK_BackSpace] = 0x2a;
XK2HID[XK_Tab] = 0x2b;
XK2HID[XK_space] = 0x2c;
XK2HID[XK_minus] = 0x2d;
XK2HID[XK_equal] = 0x2e;
XK2HID[XK_bracketleft] = 0x2f;
XK2HID[XK_bracketright] = 0x30;
XK2HID[XK_backslash] = 0x31;
XK2HID[XK_semicolon] = 0x33;
XK2HID[XK_apostrophe] = 0x34;
XK2HID[XK_grave] = 0x35;
XK2HID[XK_comma] = 0x36;
XK2HID[XK_period] = 0x37;
XK2HID[XK_slash] = 0x38;

XK2HID[XK_Print] = 0x46;
XK2HID[XK_Scroll_Lock] = 0x47;
XK2HID[XK_Pause] = 0x48;
XK2HID[XK_Insert] = 0x49;
XK2HID[XK_Home] = 0x4a;
XK2HID[XK_Page_Up] = 0x4b;
XK2HID[XK_Delete] = 0x4c;
XK2HID[XK_End] = 0x4d;
XK2HID[XK_Page_Down] = 0x4e;
XK2HID[XK_Right] = 0x4f;
XK2HID[XK_Left] = 0x50;
XK2HID[XK_Down] = 0x51;
XK2HID[XK_Up] = 0x52;

XK2HID[XK_Control_L] = 0xe0;
XK2HID[XK_Control_R] = XK2HID[XK_Control_L];
XK2HID[XK_Shift_L] = 0xe1;
XK2HID[XK_Shift_R] = XK2HID[XK_Shift_L];
XK2HID[XK_Alt_L] = 0xe2;
XK2HID[XK_Alt_R] = XK2HID[XK_Alt_L];
XK2HID[XK_Super_L] = 0xe3;
XK2HID[XK_Super_R] = XK2HID[XK_Super_L];

XK2HID[XK_Caps_Lock] = 0x39;

// locale hardcoded hack
XK2HID[XK_less] = XK2HID[XK_comma];
XK2HID[XK_greater] = XK2HID[XK_period];
XK2HID[XK_exclam] = XK2HID[XK_1];
XK2HID[XK_at] = XK2HID[XK_2];
XK2HID[XK_numbersign] = XK2HID[XK_3];
XK2HID[XK_dollar] = XK2HID[XK_4];
XK2HID[XK_percent] = XK2HID[XK_5];
XK2HID[XK_asciicircum] = XK2HID[XK_6];
XK2HID[XK_ampersand] = XK2HID[XK_7];
XK2HID[XK_asterisk] = XK2HID[XK_8];
XK2HID[XK_parenleft] = XK2HID[XK_9];
XK2HID[XK_parenright] = XK2HID[XK_0];
XK2HID[XK_underscore] = XK2HID[XK_minus];
XK2HID[XK_bar] = XK2HID[XK_backslash];
XK2HID[XK_quotedbl] = XK2HID[XK_apostrophe];
XK2HID[XK_asciitilde] = XK2HID[XK_grave];
Loading