diff --git a/guacamole/src/main/webapp/scripts/client-ui.js b/guacamole/src/main/webapp/scripts/client-ui.js index 23fab57e8..535c88507 100644 --- a/guacamole/src/main/webapp/scripts/client-ui.js +++ b/guacamole/src/main/webapp/scripts/client-ui.js @@ -412,6 +412,10 @@ GuacUI.Client.OnScreenKeyboard = function() { updateKeyboardSize, GuacUI.Client.KEYBOARD_AUTO_RESIZE_INTERVAL); + // Resize on window resize + window.addEventListener("resize", updateKeyboardSize, true); + + // Initialize size updateKeyboardSize(); }; @@ -421,6 +425,7 @@ GuacUI.Client.OnScreenKeyboard = function() { // Hide keyboard document.body.removeChild(keyboard_container); window.clearInterval(keyboard_resize_interval); + window.removeEventListener("resize", updateKeyboardSize, true); }; diff --git a/guacamole/src/main/webapp/scripts/guac-ui.js b/guacamole/src/main/webapp/scripts/guac-ui.js index 6c0296aea..b07bda83a 100644 --- a/guacamole/src/main/webapp/scripts/guac-ui.js +++ b/guacamole/src/main/webapp/scripts/guac-ui.js @@ -104,6 +104,13 @@ GuacUI.StateManager = new (function() { }; + /** + * Returns the current visible state. + */ + this.getState = function() { + return current_state; + }; + })(); diff --git a/guacamole/src/main/webapp/scripts/interface.js b/guacamole/src/main/webapp/scripts/interface.js index e045ed169..7fa22ccf6 100644 --- a/guacamole/src/main/webapp/scripts/interface.js +++ b/guacamole/src/main/webapp/scripts/interface.js @@ -297,8 +297,17 @@ GuacamoleUI.attach = function(guac) { // If lifting up on shift, toggle keyboard if rest of gesture // conditions satisfied if (show_keyboard_gesture_possible && keysym == 0xFFE1) { - if (keyboard.pressed[0xFFE3] && keyboard.pressed[0xFFE9]) - GuacUI.StateManager.setState(GuacUI.Client.states.OSK); + if (keyboard.pressed[0xFFE3] && keyboard.pressed[0xFFE9]) { + + // If in INTERACTIVE mode, switch to OSK + if (GuacUI.StateManager.getState() == GuacUI.Client.states.INTERACTIVE) + GuacUI.StateManager.setState(GuacUI.Client.states.OSK); + + // If in OSK mode, switch to INTERACTIVE + else if (GuacUI.StateManager.getState() == GuacUI.Client.states.OSK) + GuacUI.StateManager.setState(GuacUI.Client.states.INTERACTIVE); + + } } // Detect if no keys are pressed