mirror of
				https://github.com/gyurix1968/guacamole-client.git
				synced 2025-10-31 00:53:21 +00:00 
			
		
		
		
	Simply keydown handling, fix regression in key recognition.
This commit is contained in:
		| @@ -554,48 +554,23 @@ Guacamole.Keyboard = function(element) { | |||||||
|         // Try to get keysym from keycode |         // Try to get keysym from keycode | ||||||
|         var keysym = keysym_from_keycode(keynum, location); |         var keysym = keysym_from_keycode(keynum, location); | ||||||
|  |  | ||||||
|         // By default, we expect a corresponding keypress event |  | ||||||
|         var expect_keypress = true; |  | ||||||
|  |  | ||||||
|         // If key is known from keycode, or this browser supports DOM3 key |  | ||||||
|         // events, prevent default |  | ||||||
|         if (keysym || e.key) |  | ||||||
|             expect_keypress = false; |  | ||||||
|          |  | ||||||
|         // Also try to get get keysym from keyIdentifier |         // Also try to get get keysym from keyIdentifier | ||||||
|         if (identifier) { |         if (identifier) | ||||||
|  |  | ||||||
|             keysym = keysym || |             keysym = keysym || | ||||||
|             keysym_from_key_identifier(guac_keyboard.modifiers.shift, |             keysym_from_key_identifier(guac_keyboard.modifiers.shift, | ||||||
|                 identifier, location); |                 identifier, location); | ||||||
|  |  | ||||||
|             // Prevent default if non-typable character or if modifier combination |  | ||||||
|             // likely to be eaten by browser otherwise (NOTE: We must not prevent |  | ||||||
|             // default for Ctrl+Alt, as that combination is commonly used for |  | ||||||
|             // AltGr. If we receive AltGr, we need to handle keypress, which |  | ||||||
|             // means we cannot cancel keydown). |  | ||||||
|             if (!isTypable(identifier) |  | ||||||
|                 || ( guac_keyboard.modifiers.ctrl && !guac_keyboard.modifiers.alt) |  | ||||||
|                 || (!guac_keyboard.modifiers.ctrl &&  guac_keyboard.modifiers.alt) |  | ||||||
|                 || (guac_keyboard.modifiers.meta)) |  | ||||||
|                 expect_keypress = false; |  | ||||||
|              |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         // If we do not expect to handle via keypress, handle now |  | ||||||
|         if (!expect_keypress) { |  | ||||||
|             e.preventDefault(); |  | ||||||
|  |  | ||||||
|         // Press key if known |         // Press key if known | ||||||
|         if (keysym !== null) { |         if (keysym !== null) { | ||||||
|  |  | ||||||
|  |             e.preventDefault(); | ||||||
|             keydownChar[keynum] = keysym; |             keydownChar[keynum] = keysym; | ||||||
|             press_key(keysym); |             press_key(keysym); | ||||||
|              |              | ||||||
|                 // If a key is pressed while meta is held down, the keyup will never be sent in Chrome, so send it now. (bug #108404) |             // If a key is pressed while meta is held down, the keyup will | ||||||
|                 if(guac_keyboard.modifiers.meta) { |             // never be sent in Chrome, so send it now. (bug #108404) | ||||||
|  |             if(guac_keyboard.modifiers.meta) | ||||||
|                 release_key(keysym); |                 release_key(keysym); | ||||||
|                 } |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|         } |         } | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user