Rename assumeNativeOSK to nativeOSK, automatically reset nativeOSK to false if menu open initiated by mouse.

This commit is contained in:
Michael Jumper
2012-03-21 22:09:13 -07:00
parent a10a7886a9
commit 0c48a7898a

View File

@@ -179,7 +179,7 @@ var GuacamoleUI = {
}; };
// Assume no native OSK by default // Assume no native OSK by default
GuacamoleUI.assumeNativeOSK = false; GuacamoleUI.nativeOSK = false;
// Show/Hide keyboard // Show/Hide keyboard
var keyboardResizeInterval = null; var keyboardResizeInterval = null;
@@ -187,7 +187,7 @@ var GuacamoleUI = {
// If we think the platform has a native OSK, use the event target to // If we think the platform has a native OSK, use the event target to
// cause it to display. // cause it to display.
if (GuacamoleUI.assumeNativeOSK) { if (GuacamoleUI.nativeOSK) {
GuacamoleUI.eventTarget.focus(); GuacamoleUI.eventTarget.focus();
return; return;
} }
@@ -248,6 +248,10 @@ var GuacamoleUI = {
// Wait and then show menu // Wait and then show menu
detectMenuOpenTimeout = window.setTimeout(function() { detectMenuOpenTimeout = window.setTimeout(function() {
// If menu opened via mouse, do not show native OSK
GuacamoleUI.nativeOSK = false;
GuacamoleUI.showMenu(); GuacamoleUI.showMenu();
detectMenuOpenTimeout = null; detectMenuOpenTimeout = null;
}, 325); }, 325);
@@ -257,7 +261,7 @@ var GuacamoleUI = {
}; };
// Initiate detection of menu close action. If not canceled through some // Initiate detection of menu close action. If not canceled through some
// user event, menu will close. // user mouse event, menu will close.
GuacamoleUI.startMenuCloseDetect = function() { GuacamoleUI.startMenuCloseDetect = function() {
if (!detectMenuCloseTimeout) { if (!detectMenuCloseTimeout) {
@@ -295,7 +299,7 @@ var GuacamoleUI = {
menuShowLongPressTimeout = null; menuShowLongPressTimeout = null;
// Assume native OSK if menu shown via long-press // Assume native OSK if menu shown via long-press
GuacamoleUI.assumeNativeOSK = true; GuacamoleUI.nativeOSK = true;
GuacamoleUI.showMenu(); GuacamoleUI.showMenu();
}, 800); }, 800);
@@ -411,7 +415,7 @@ GuacamoleUI.attach = function(guac) {
// If we're using native OSK, ensure event target is reset // If we're using native OSK, ensure event target is reset
// on each key event. // on each key event.
if (GuacamoleUI.assumeNativeOSK) if (GuacamoleUI.nativeOSK)
GuacamoleUI.resetEventTarget(); GuacamoleUI.resetEventTarget();
guac.sendKeyEvent(1, keysym); guac.sendKeyEvent(1, keysym);