From eb5b30aafc1c1c78b279b159dd46e0b6253c22ef Mon Sep 17 00:00:00 2001 From: eugen-keeper Date: Tue, 30 Sep 2025 20:33:37 +0000 Subject: [PATCH] GUACAMOLE-2147: Fix order of keystroke log in recordings. --- .../player/services/keyEventDisplayService.js | 66 ++++++++++--------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/guacamole/src/main/frontend/src/app/player/services/keyEventDisplayService.js b/guacamole/src/main/frontend/src/app/player/services/keyEventDisplayService.js index 6b0a7e06d..c362670a7 100644 --- a/guacamole/src/main/frontend/src/app/player/services/keyEventDisplayService.js +++ b/guacamole/src/main/frontend/src/app/player/services/keyEventDisplayService.js @@ -321,44 +321,48 @@ angular.module('player').factory('keyEventDisplayService', // Add the shortcut to the current batch pushEvent(shortcutText, false); } - } - // Print the key itself - else { - - var keyText; - var typed; - - // Print the value if explicitly defined - if (value !== undefined) { - - keyText = value; - typed = true; - - // If the name should be printed in addition, add it as a - // seperate event before the actual character value - if (PRINT_NAME_TOO_KEYS[keysym]) - pushEvent(formatKeyName(name), false); - - } - - // Otherwise print the name + // Print the key itself else { - keyText = formatKeyName(name); - - // While this is a representation for a single character, - // the key text is the name of the key, not the actual - // character itself - typed = false; + var keyText; + var typed; + + // Print the value if explicitly defined + if (value !== undefined) { + + keyText = value; + typed = true; + + // If the name should be printed in addition, add it as a + // seperate event before the actual character value + if (PRINT_NAME_TOO_KEYS[keysym]) + pushEvent(formatKeyName(name), false); + + } + + // Otherwise print the name + else { + + keyText = formatKeyName(name); + + // While this is a representation for a single character, + // the key text is the name of the key, not the actual + // character itself + typed = false; + + } + + // Add the key to the current batch + pushEvent(keyText, typed); } - - // Add the key to the current batch - pushEvent(keyText, typed); - } + // We ignore key release events here because in practice characters + // are printed when you press keys not release them. The release order + // can be different and lead to wrong character printing order in the log. + }); // All processed batches with events