You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by vn...@apache.org on 2018/01/16 17:01:01 UTC

[2/4] guacamole-client git commit: GUACAMOLE-232: Do not rely on receiving keyup events on iOS.

GUACAMOLE-232: Do not rely on receiving keyup events on iOS.


Project: http://git-wip-us.apache.org/repos/asf/guacamole-client/repo
Commit: http://git-wip-us.apache.org/repos/asf/guacamole-client/commit/960e83f7
Tree: http://git-wip-us.apache.org/repos/asf/guacamole-client/tree/960e83f7
Diff: http://git-wip-us.apache.org/repos/asf/guacamole-client/diff/960e83f7

Branch: refs/heads/master
Commit: 960e83f780425d93bf064f0187fd481cb848b150
Parents: d84f03a
Author: Michael Jumper <mj...@apache.org>
Authored: Mon Jan 15 00:22:15 2018 -0800
Committer: Michael Jumper <mj...@apache.org>
Committed: Mon Jan 15 00:25:24 2018 -0800

----------------------------------------------------------------------
 .../src/main/webapp/modules/Keyboard.js            | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/guacamole-client/blob/960e83f7/guacamole-common-js/src/main/webapp/modules/Keyboard.js
----------------------------------------------------------------------
diff --git a/guacamole-common-js/src/main/webapp/modules/Keyboard.js b/guacamole-common-js/src/main/webapp/modules/Keyboard.js
index da45bf7..fa93c58 100644
--- a/guacamole-common-js/src/main/webapp/modules/Keyboard.js
+++ b/guacamole-common-js/src/main/webapp/modules/Keyboard.js
@@ -66,6 +66,13 @@ Guacamole.Keyboard = function(element) {
     var quirks = {
 
         /**
+         * Whether keyup events are universally unreliable.
+         *
+         * @type {Boolean}
+         */
+        keyupUnreliable: false,
+
+        /**
          * Whether the Alt key is actually a modifier for typable keys and is
          * thus never used for keyboard shortcuts.
          *
@@ -79,8 +86,12 @@ Guacamole.Keyboard = function(element) {
     // available
     if (navigator && navigator.platform) {
 
+        // All keyup events are unreliable on iOS (sadly)
+        if (navigator.platform.match(/ipad|iphone|ipod/i))
+            quirks.keyupUnreliable = true;
+
         // The Alt key on Mac is never used for keyboard shortcuts
-        if (navigator.platform.match(/^mac/i))
+        else if (navigator.platform.match(/^mac/i))
             quirks.altIsTypableOnly = true;
 
     }
@@ -211,7 +222,7 @@ Guacamole.Keyboard = function(element) {
          *
          * @type {Boolean}
          */
-        this.keyupReliable = true;
+        this.keyupReliable = !quirks.keyupUnreliable;
 
         // DOM3 and keyCode are reliable sources if the corresponding key is
         // not a printable key
@@ -1021,7 +1032,7 @@ Guacamole.Keyboard = function(element) {
         } // end if keydown
 
         // Keyup event
-        else if (first instanceof KeyupEvent) {
+        else if (first instanceof KeyupEvent && !quirks.keyupUnreliable) {
 
             // Release specific key if known
             var keysym = first.keysym;