mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 05:31:22 +00:00
Add text field event target, focus event target if "Show Keyboard" is clicked and use exposed the menu via long-press. Ensure backspace always sends a key event by always keeping text within the event target.
This commit is contained in:
@@ -54,6 +54,10 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<input id="eventTarget"
|
||||||
|
type="text"
|
||||||
|
style="width: 0; height: 0; position: fixed; opacity: 0"
|
||||||
|
value="x"/>
|
||||||
|
|
||||||
<!-- Display -->
|
<!-- Display -->
|
||||||
<div id="display">
|
<div id="display">
|
||||||
|
@@ -8,6 +8,7 @@ var GuacamoleUI = {
|
|||||||
"menuControl" : document.getElementById("menuControl"),
|
"menuControl" : document.getElementById("menuControl"),
|
||||||
"touchMenu" : document.getElementById("touchMenu"),
|
"touchMenu" : document.getElementById("touchMenu"),
|
||||||
"logo" : document.getElementById("status-logo"),
|
"logo" : document.getElementById("status-logo"),
|
||||||
|
"eventTarget" : document.getElementById("eventTarget"),
|
||||||
|
|
||||||
"buttons": {
|
"buttons": {
|
||||||
|
|
||||||
@@ -177,10 +178,19 @@ var GuacamoleUI = {
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var assumeNativeOSK = false;
|
||||||
|
|
||||||
// Show/Hide keyboard
|
// Show/Hide keyboard
|
||||||
var keyboardResizeInterval = null;
|
var keyboardResizeInterval = null;
|
||||||
GuacamoleUI.buttons.showKeyboard.onclick = function() {
|
GuacamoleUI.buttons.showKeyboard.onclick = function() {
|
||||||
|
|
||||||
|
// If we think the platform has a native OSK, use the event target to
|
||||||
|
// cause it to display.
|
||||||
|
if (assumeNativeOSK) {
|
||||||
|
GuacamoleUI.eventTarget.focus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
var displayed = GuacamoleUI.containers.keyboard.style.display;
|
var displayed = GuacamoleUI.containers.keyboard.style.display;
|
||||||
if (displayed != "block") {
|
if (displayed != "block") {
|
||||||
GuacamoleUI.containers.keyboard.style.display = "block";
|
GuacamoleUI.containers.keyboard.style.display = "block";
|
||||||
@@ -282,6 +292,9 @@ var GuacamoleUI = {
|
|||||||
menuShowLongPressTimeout = window.setTimeout(function() {
|
menuShowLongPressTimeout = window.setTimeout(function() {
|
||||||
|
|
||||||
menuShowLongPressTimeout = null;
|
menuShowLongPressTimeout = null;
|
||||||
|
|
||||||
|
// Assume native OSK if menu shown via long-press
|
||||||
|
assumeNativeOSK = true;
|
||||||
GuacamoleUI.showMenu();
|
GuacamoleUI.showMenu();
|
||||||
|
|
||||||
}, 800);
|
}, 800);
|
||||||
@@ -294,6 +307,11 @@ var GuacamoleUI = {
|
|||||||
menuShowLongPressTimeout = null;
|
menuShowLongPressTimeout = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Ensure the event target ALWAYS has text inside.
|
||||||
|
GuacamoleUI.eventTarget.onchange = function() {
|
||||||
|
GuacamoleUI.eventTarget.value = "x";
|
||||||
|
};
|
||||||
|
|
||||||
// Detect long-press at bottom of screen
|
// Detect long-press at bottom of screen
|
||||||
document.body.addEventListener('touchstart', GuacamoleUI.startLongPressDetect, true);
|
document.body.addEventListener('touchstart', GuacamoleUI.startLongPressDetect, true);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user