guacamole-common-js

This article provides an introduction to guacamole-common-js, covering its advantages, implementation details, and related resources. These steps can help improve the efficiency of working with guacamole-common-js.

Dec 10, 2023 · 1 min read · 152 Words · -Views -Comments · Programming
🇨🇳 阅读中文版
Read with AI

Choose an AI assistant

ChatGPT Open in a new tab with the article link and prompt
Claude Copy the prompt, then open Claude

Open Claude
Trouble reading the article?

If the prompt is missing, copy the full prompt below into your AI assistant. If the AI cannot read the article, paste the visible passage you want to discuss and add your question.

Recently encountered an issue where after the remote desktop is started, switching to other tab pages causes input events to fail.

var keyboard = new Guacamole.Keyboard(document);

keyboard.onkeydown = function(keysym) {
// Do something ...
};

keyboard.onkeyup = function(keysym) {
// Do something ...
};

The code is roughly as shown above.

Cause

Guacamole.Keyboard captures events and prevents bubbling, so as long as it’s not destroyed, it will continue to capture all keyboard events on the webpage.

Solution

  1. Save the keyboard.onkeydown/onkeyup bound events elsewhere, set keyboard.onkeydown=null, keyboard.onkeyup=null. Then restore them when needed.
  2. Set the binding element for new Guacamole.Keyboard to the RDP desktop element

Final Thoughts

This issue demonstrates the importance of understanding how Guacamole’s keyboard event handling works. The solution involves either temporarily disabling the keyboard event handlers or binding them to a more specific element to prevent them from capturing events across the entire document when not needed.

Authors
Developer, digital product enthusiast, tinkerer, sharer, open source lover