Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions systemvm/agent/noVNC/app/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,7 @@ const UI = {
msg = _("Connected (unencrypted) to ") + UI.desktopName;
}
UI.showStatus(msg);
UI.resetModifierKeysState();
UI.updateVisualState('connected');

// Do this last because it can only be used on rendered elements
Expand Down Expand Up @@ -1783,6 +1784,35 @@ const UI = {
selectbox.options.add(optn);
},

// Function to reset all modifier key states when reconnecting
resetModifierKeysState() {
// Reset the UI buttons for special keys
const modifierButtons = [
'noVNC_toggle_ctrl_button',
'noVNC_toggle_shift_button',
'noVNC_toggle_alt_button',
'noVNC_toggle_windows_button'
];

for (let id of modifierButtons) {
const btn = document.getElementById(id);
if (btn && btn.classList.contains("noVNC_selected")) {
btn.classList.remove("noVNC_selected");

// Also send the key-up event if needed
if (id === 'noVNC_toggle_ctrl_button') {
UI.sendKey(KeyTable.XK_Control_L, "ControlLeft", false);
} else if (id === 'noVNC_toggle_shift_button') {
UI.sendKey(KeyTable.XK_Shift_L, "ShiftLeft", false);
} else if (id === 'noVNC_toggle_alt_button') {
UI.sendKey(KeyTable.XK_Alt_L, "AltLeft", false);
} else if (id === 'noVNC_toggle_windows_button') {
UI.sendKey(KeyTable.XK_Super_L, "MetaLeft", false);
}
}
}
},

/* ------^-------
* /MISC
* ==============
Expand Down