Japanese keyboard + guest Japanese OS

This commit is contained in:
Kelven Yang 2011-05-17 17:11:26 -07:00
parent 6672db47c8
commit fd27127f6e
4 changed files with 44 additions and 14 deletions

View File

@ -71,8 +71,8 @@ body {
#toolbar ul li ul {
position: absolute;
top:32;
width: 130;
height: 66;
width: 260;
height: 99;
display: block;
display: none;
border-top: 1px solid black;
@ -103,7 +103,7 @@ body {
}
#toolbar ul li ul li a:hover span {
background: url(/resource/images/right.png) no-repeat right center;
background: url(/resource/images/right2.png) no-repeat right center;
}
span.dark {

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@ -280,7 +280,8 @@ AjaxViewer.STATUS_SENDING = 3;
AjaxViewer.STATUS_SENT = 4;
AjaxViewer.KEYBOARD_TYPE_ENGLISH = 0;
AjaxViewer.KEYBOARD_TYPE_JAPANESE = 1;
AjaxViewer.KEYBOARD_TYPE_JAPANESE_TO_ENGLISH = 1;
AjaxViewer.KEYBOARD_TYPE_JAPANESE_TO_JAPANESE = 2;
AjaxViewer.getEventName = function(type) {
switch(type) {
@ -442,7 +443,11 @@ AjaxViewer.prototype = {
setupKeyboardTranslationTable : function() {
this.keyboardMappers = [];
this.keyboardMappers[AjaxViewer.KEYBOARD_TYPE_ENGLISH] = new KeyboardMapper(true, null, null, null, null);
this.setupJapaneseKeyboardToEnglishVmMapping();
this.setupJapaneseKeyboardToJapaneseVmMapping();
},
setupJapaneseKeyboardToEnglishVmMapping : function() {
var keyCodeMap = [];
var shiftedKeyCodeMap = [];
var charCodeMap = [];
@ -593,10 +598,30 @@ AjaxViewer.prototype = {
keyCodeMap[110] = { code: 190, shift : 0 }; // JP NUM .
charCodeMap[46] = { code: 46, shift : 0 };
}
this.keyboardMappers[AjaxViewer.KEYBOARD_TYPE_JAPANESE] = new KeyboardMapper(false, keyCodeMap, shiftedKeyCodeMap,
this.keyboardMappers[AjaxViewer.KEYBOARD_TYPE_JAPANESE_TO_ENGLISH] = new KeyboardMapper(false, keyCodeMap, shiftedKeyCodeMap,
charCodeMap, shiftedCharCodeMap);
},
setupJapaneseKeyboardToJapaneseVmMapping : function() {
var keyCodeMap = [];
var shiftedKeyCodeMap = [];
var charCodeMap = [];
var shiftedCharCodeMap = [];
var currentLanguage = getCurrentLanguage();
if(currentLanguage == 'ja' || currentLanguage == 'ja-JP') {
// TODO
// two keys need to be handled in this case, one is the one that is at left of BACKSPACE KEY
// the other one is at left of RIGHT SHIFT key
} else {
// TODO
}
this.keyboardMappers[AjaxViewer.KEYBOARD_TYPE_JAPANESE_TO_ENGLISH] = new KeyboardMapper(false, keyCodeMap, shiftedKeyCodeMap,
charCodeMap, shiftedCharCodeMap);
},
getCurrentKeyboardMapper : function() {
return this.keyboardMappers[this.currentKeyboard];
},
@ -642,7 +667,10 @@ AjaxViewer.prototype = {
onCommand : function(cmd) {
if(cmd == "keyboard_jp") {
$("#toolbar").find(".pulldown").find("ul").hide();
this.currentKeyboard = AjaxViewer.KEYBOARD_TYPE_JAPANESE;
this.currentKeyboard = AjaxViewer.KEYBOARD_TYPE_JAPANESE_TO_ENGLISH;
} else if(cmd == "keyboard_jp_jp") {
$("#toolbar").find(".pulldown").find("ul").hide();
this.currentKeyboard = AjaxViewer.KEYBOARD_TYPE_JAPANESE_TO_JAPANESE;
} else if(cmd == "keyboard_en") {
$("#toolbar").find(".pulldown").find("ul").hide();
this.currentKeyboard = AjaxViewer.KEYBOARD_TYPE_ENGLISH;
@ -1143,11 +1171,11 @@ AjaxViewer.prototype = {
installMouseHook: function() {
var ajaxViewer = this;
var target = $(document);
var target = $(document.body);
target.mousemove(function(e) {
if(!ajaxViewer.ptInPanel(e.pageX, e.pageY))
return true;
return true;
var pt = ajaxViewer.pageToPanel(e.pageX, e.pageY);
ajaxViewer.onMouseMove(pt.x, pt.y);
@ -1161,11 +1189,11 @@ AjaxViewer.prototype = {
if(!ajaxViewer.ptInPanel(e.pageX, e.pageY))
return true;
var modifiers = ajaxViewer.getKeyModifiers(e);
var whichButton = e.button;
var pt = ajaxViewer.pageToPanel(e.pageX, e.pageY);
var pt = ajaxViewer.pageToPanel(e.pageX, e.pageY);
ajaxViewer.onMouseDown(pt.x, pt.y, whichButton, modifiers);
e.stopPropagation();
@ -1174,12 +1202,13 @@ AjaxViewer.prototype = {
target.mouseup(function(e) {
if(!ajaxViewer.ptInPanel(e.pageX, e.pageY))
return true;
return true;
var modifiers = ajaxViewer.getKeyModifiers(e);
var whichButton = e.button;
var pt = ajaxViewer.pageToPanel(e.pageX, e.pageY);
ajaxViewer.onMouseUp(pt.x, pt.y, whichButton, modifiers);
e.stopPropagation();
return false;

View File

@ -1048,8 +1048,9 @@ public class ConsoleProxyViewer implements java.lang.Runnable, RfbViewer, RfbPro
"<span><img align=\"left\" src=\"/resource/images/winlog.png\" alt=\"Keyboard\" style=\"width:16px;height:16px\"/>Keyboard</span>",
"</a>",
"<ul>",
"<li><a href=\"#\" cmd=\"keyboard_en\"><span>English (US)</span></a></li>",
"<li><a href=\"#\" cmd=\"keyboard_jp\"><span>Japanese&nbsp;&nbsp;&nbsp;</span></a></li>",
"<li><a href=\"#\" cmd=\"keyboard_en\"><span>Standard (US) keyboard</span></a></li>",
"<li><a href=\"#\" cmd=\"keyboard_jp\"><span>Japanese keyboard -> English VM</span></a></li>",
"<li><a href=\"#\" cmd=\"keyboard_jp_jp\"><span>Japanese keyboard -> Japanese VM</span></a></li>",
"</ul>",
"</li>",
"</ul>",