Fix show/hide of OSK.

This commit is contained in:
Michael Jumper
2012-11-13 20:18:11 -08:00
parent a15f403492
commit 5d587373f3
3 changed files with 23 additions and 2 deletions

View File

@@ -412,6 +412,10 @@ GuacUI.Client.OnScreenKeyboard = function() {
updateKeyboardSize, updateKeyboardSize,
GuacUI.Client.KEYBOARD_AUTO_RESIZE_INTERVAL); GuacUI.Client.KEYBOARD_AUTO_RESIZE_INTERVAL);
// Resize on window resize
window.addEventListener("resize", updateKeyboardSize, true);
// Initialize size
updateKeyboardSize(); updateKeyboardSize();
}; };
@@ -421,6 +425,7 @@ GuacUI.Client.OnScreenKeyboard = function() {
// Hide keyboard // Hide keyboard
document.body.removeChild(keyboard_container); document.body.removeChild(keyboard_container);
window.clearInterval(keyboard_resize_interval); window.clearInterval(keyboard_resize_interval);
window.removeEventListener("resize", updateKeyboardSize, true);
}; };

View File

@@ -104,6 +104,13 @@ GuacUI.StateManager = new (function() {
}; };
/**
* Returns the current visible state.
*/
this.getState = function() {
return current_state;
};
})(); })();

View File

@@ -297,8 +297,17 @@ GuacamoleUI.attach = function(guac) {
// If lifting up on shift, toggle keyboard if rest of gesture // If lifting up on shift, toggle keyboard if rest of gesture
// conditions satisfied // conditions satisfied
if (show_keyboard_gesture_possible && keysym == 0xFFE1) { if (show_keyboard_gesture_possible && keysym == 0xFFE1) {
if (keyboard.pressed[0xFFE3] && keyboard.pressed[0xFFE9]) if (keyboard.pressed[0xFFE3] && keyboard.pressed[0xFFE9]) {
GuacUI.StateManager.setState(GuacUI.Client.states.OSK);
// 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 // Detect if no keys are pressed