};
- var assumeNativeOSK = false;
+ // Assume no native OSK by default
+ GuacamoleUI.assumeNativeOSK = false;
// Show/Hide keyboard
var keyboardResizeInterval = null;
// If we think the platform has a native OSK, use the event target to
// cause it to display.
- if (assumeNativeOSK) {
+ if (GuacamoleUI.assumeNativeOSK) {
GuacamoleUI.eventTarget.focus();
return;
}
menuShowLongPressTimeout = null;
// Assume native OSK if menu shown via long-press
- assumeNativeOSK = true;
+ GuacamoleUI.assumeNativeOSK = true;
GuacamoleUI.showMenu();
}, 800);
menuShowLongPressTimeout = null;
};
- // Ensure the event target ALWAYS has text inside.
- GuacamoleUI.eventTarget.onchange = function() {
- GuacamoleUI.eventTarget.value = "x";
+ // Reset event target (add content, reposition cursor in middle.
+ GuacamoleUI.resetEventTarget = function() {
+ GuacamoleUI.eventTarget.value = "GUAC";
+ GuacamoleUI.eventTarget.selectionStart =
+ GuacamoleUI.eventTarget.selectionEnd = 2;
};
// Detect long-press at bottom of screen
function enableKeyboard() {
keyboard.onkeydown =
function (keysym) {
+
+ // If we're using native OSK, ensure event target is reset
+ // on each key event.
+ if (GuacamoleUI.assumeNativeOSK)
+ GuacamoleUI.resetEventTarget();
+
guac.sendKeyEvent(1, keysym);
};