Skip to content

Commit 6ebbec2

Browse files
anshulgangwarrajesh-battala
authored andcommitted
CLOUDSTACK-5716: fixed can't type special character in console view
1 parent 513f1db commit 6ebbec2

3 files changed

Lines changed: 36 additions & 22 deletions

File tree

services/console-proxy-rdp/rdpconsole/src/main/java/rdpclient/adapter/AwtRdpKeyboardAdapter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ private int map_en_us(KeyEvent event) {
343343

344344
default:
345345
System.err.println("Key is not mapped: " + event + ".");
346-
return 57; // Space
346+
return event.getKeyCode();
347347
}
348348
}
349349

services/console-proxy/server/src/com/cloud/consoleproxy/ConsoleProxyRdpClient.java

Lines changed: 10 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,6 @@ public class ConsoleProxyRdpClient extends ConsoleProxyClientBase {
5757
private Thread _worker;
5858
private volatile boolean _workerDone = false;
5959

60-
private int _lastModifierStates = 0;
61-
6260
private AwtMouseEventSource _mouseEventSource = null;
6361
private AwtKeyEventSource _keyEventSource = null;
6462

@@ -203,26 +201,19 @@ public int mapMouseUpModifier(int code, int modifiers) {
203201

204202
private int mapModifier(int modifiers) {
205203
int mod = 0;
206-
if ((modifiers & SHIFT_KEY_MASK) != (_lastModifierStates & SHIFT_KEY_MASK)) {
207-
if ((modifiers & SHIFT_KEY_MASK) != 0)
208-
mod = mod | InputEvent.SHIFT_DOWN_MASK;
209-
}
210204

211-
if ((modifiers & CTRL_KEY_MASK) != (_lastModifierStates & CTRL_KEY_MASK)) {
212-
if ((modifiers & CTRL_KEY_MASK) != 0)
213-
mod = mod | InputEvent.CTRL_DOWN_MASK;
214-
}
205+
if ((modifiers & SHIFT_KEY_MASK) != 0)
206+
mod = mod | InputEvent.SHIFT_DOWN_MASK;
215207

216-
if ((modifiers & META_KEY_MASK) != (_lastModifierStates & META_KEY_MASK)) {
217-
if ((modifiers & META_KEY_MASK) != 0)
218-
mod = mod | InputEvent.META_DOWN_MASK;
219-
}
208+
if ((modifiers & CTRL_KEY_MASK) != 0)
209+
mod = mod | InputEvent.CTRL_DOWN_MASK;
210+
211+
if ((modifiers & META_KEY_MASK) != 0)
212+
mod = mod | InputEvent.META_DOWN_MASK;
213+
214+
if ((modifiers & ALT_KEY_MASK) != 0)
215+
mod = mod | InputEvent.ALT_DOWN_MASK;
220216

221-
if ((modifiers & ALT_KEY_MASK) != (_lastModifierStates & ALT_KEY_MASK)) {
222-
if ((modifiers & ALT_KEY_MASK) != 0)
223-
mod = mod | InputEvent.ALT_DOWN_MASK;
224-
}
225-
_lastModifierStates = mod;
226217
return mod;
227218
}
228219

services/console-proxy/server/src/com/cloud/consoleproxy/rdp/KeysymToKeycode.java

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
public class KeysymToKeycode {
2222

23-
// this keymap is taken from http://openwonderland.googlecode.com/svn/trunk/modules/foundation/xremwin/src/classes/org/jdesktop/wonderland/modules/xremwin/client/KeycodeToKeysym.java
23+
// some of this keymap is taken from http://openwonderland.googlecode.com/svn/trunk/modules/foundation/xremwin/src/classes/org/jdesktop/wonderland/modules/xremwin/client/KeycodeToKeysym.java
2424
private final static int[][] map = {
2525
/* XK_BackSpace */{0xFF08, KeyEvent.VK_BACK_SPACE},
2626
/* XK_Tab */{0xFF09, KeyEvent.VK_TAB},
@@ -101,10 +101,33 @@ public class KeysymToKeycode {
101101
/* XK_x */{0x0078, KeyEvent.VK_X},
102102
/* XK_y */{0x0079, KeyEvent.VK_Y},
103103
/* XK_z */{0x007a, KeyEvent.VK_Z},
104+
{0x0060, KeyEvent.VK_BACK_QUOTE},
105+
{0x007e, KeyEvent.VK_BACK_QUOTE},
106+
{0x0021, KeyEvent.VK_1},
107+
{0x0040, KeyEvent.VK_2},
108+
{0x0023, KeyEvent.VK_3},
109+
{0x0024, KeyEvent.VK_4},
110+
{0x0025, KeyEvent.VK_5},
111+
{0x005e, KeyEvent.VK_6},
112+
{0x0026, KeyEvent.VK_7},
113+
{0x002A, KeyEvent.VK_8},
114+
{0x0028, KeyEvent.VK_9},
115+
{0x0029, KeyEvent.VK_0},
116+
{0x005f, KeyEvent.VK_MINUS},
117+
{0x002b, KeyEvent.VK_EQUALS},
118+
{0x007b, KeyEvent.VK_OPEN_BRACKET},
119+
{0x007d, KeyEvent.VK_CLOSE_BRACKET},
120+
{0x007c, KeyEvent.VK_BACK_SLASH},
121+
{0x003a, KeyEvent.VK_SEMICOLON},
122+
{0x0027, KeyEvent.VK_QUOTE},
123+
{0x0022, KeyEvent.VK_QUOTE},
124+
{0x003c, KeyEvent.VK_COMMA},
125+
{0x003e, KeyEvent.VK_PERIOD},
126+
{0x003f, KeyEvent.VK_SLASH},
104127
};
105128

106129
public static int getKeycode(int keysym) {
107-
for (int i = 0; i < (map.length - 1); i++) {
130+
for (int i = 0; i < (map.length); i++) {
108131
if (map[i][0] == keysym) {
109132
return map[i][1];
110133
}

0 commit comments

Comments
 (0)