mirror of
https://github.com/gyurix1968/guacamole-client.git
synced 2025-09-07 21:51:23 +00:00
GUACAMOLE-161: Merge do not rely on receiving keyup for Caps Lock on Mac.
This commit is contained in:
@@ -100,7 +100,15 @@ Guacamole.Keyboard = function Keyboard(element) {
|
|||||||
*
|
*
|
||||||
* @type {Boolean}
|
* @type {Boolean}
|
||||||
*/
|
*/
|
||||||
altIsTypableOnly: false
|
altIsTypableOnly: false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether we can rely on receiving a keyup event for the Caps Lock
|
||||||
|
* key.
|
||||||
|
*
|
||||||
|
* @type {Boolean}
|
||||||
|
*/
|
||||||
|
capsLockKeyupUnreliable: false
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -112,9 +120,12 @@ Guacamole.Keyboard = function Keyboard(element) {
|
|||||||
if (navigator.platform.match(/ipad|iphone|ipod/i))
|
if (navigator.platform.match(/ipad|iphone|ipod/i))
|
||||||
quirks.keyupUnreliable = true;
|
quirks.keyupUnreliable = true;
|
||||||
|
|
||||||
// The Alt key on Mac is never used for keyboard shortcuts
|
// The Alt key on Mac is never used for keyboard shortcuts, and the
|
||||||
else if (navigator.platform.match(/^mac/i))
|
// Caps Lock key never dispatches keyup events
|
||||||
|
else if (navigator.platform.match(/^mac/i)) {
|
||||||
quirks.altIsTypableOnly = true;
|
quirks.altIsTypableOnly = true;
|
||||||
|
quirks.capsLockKeyupUnreliable = true;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -260,6 +271,10 @@ Guacamole.Keyboard = function Keyboard(element) {
|
|||||||
if (guac_keyboard.modifiers.meta && this.keysym !== 0xFFE7 && this.keysym !== 0xFFE8)
|
if (guac_keyboard.modifiers.meta && this.keysym !== 0xFFE7 && this.keysym !== 0xFFE8)
|
||||||
this.keyupReliable = false;
|
this.keyupReliable = false;
|
||||||
|
|
||||||
|
// We cannot rely on receiving keyup for Caps Lock on certain platforms
|
||||||
|
else if (this.keysym === 0xFFE5 && quirks.capsLockKeyupUnreliable)
|
||||||
|
this.keyupReliable = false;
|
||||||
|
|
||||||
// Determine whether default action for Alt+combinations must be prevented
|
// Determine whether default action for Alt+combinations must be prevented
|
||||||
var prevent_alt = !guac_keyboard.modifiers.ctrl && !quirks.altIsTypableOnly;
|
var prevent_alt = !guac_keyboard.modifiers.ctrl && !quirks.altIsTypableOnly;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user