Fix: Web remote desktop reliability and UX
- Server: clamp web session adaptive quality to H264-only levels (>=Good) in EvaluateQuality and ApplyQualityLevel; Ultra/High (DIFF/RGB565) caused the browser to freeze ~1 min into a session - Server: move session-type detection to the top of ScreenSpyDlg::OnInitDialog and skip SetWindowPlacement/EnterFullScreen for hidden web sessions, eliminating the MFC dialog flash on web-triggered opens - Linux client: default QualityLevel from QUALITY_ADAPTIVE to QUALITY_GOOD to match Windows/macOS so the server's adaptive controller doesn't auto-upgrade to non-H264 algorithms - Web: clear the floating quick-action toolbar on fullscreen exit so its row of buttons (RDP reset / Mouse / Close) doesn't stay pinned to the top of the page - Web: route F11 to the remote in control mode instead of toggling local fullscreen - Web: route Esc to the remote in control mode via the Keyboard Lock API instead of exiting native fullscreen
This commit is contained in:
@@ -2290,10 +2290,14 @@
|
||||
});
|
||||
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (e.key === 'F11' && document.getElementById('screen-page').classList.contains('active')) {
|
||||
e.preventDefault();
|
||||
toggleFullscreen();
|
||||
}
|
||||
if (e.key !== 'F11') return;
|
||||
if (!document.getElementById('screen-page').classList.contains('active')) return;
|
||||
// In control mode F11 is a remote keystroke — let it fall through
|
||||
// to the desktop key handler (which calls sendKey). Outside control
|
||||
// mode F11 toggles our page fullscreen as the local convenience.
|
||||
if (controlEnabled) return;
|
||||
e.preventDefault();
|
||||
toggleFullscreen();
|
||||
});
|
||||
|
||||
// Control mode state (mouse/keyboard control)
|
||||
@@ -2365,6 +2369,40 @@
|
||||
document.getElementById('screen-page')?.classList.contains('pseudo-fullscreen'));
|
||||
}
|
||||
|
||||
// Keyboard Lock keeps F11 / Esc from triggering their browser-default
|
||||
// behaviour (F11 → toggle browser fullscreen, Esc → exit native page
|
||||
// fullscreen) while we're actively controlling a remote desktop —
|
||||
// those keys belong to the remote OS in that mode, not the local
|
||||
// browser. Lock is no-op on browsers without the API.
|
||||
function updateKeyboardLock() {
|
||||
if (!navigator.keyboard || !navigator.keyboard.lock) return;
|
||||
if (isFullscreen() && controlEnabled) {
|
||||
navigator.keyboard.lock(['Escape', 'F11']).catch(() => {});
|
||||
} else {
|
||||
navigator.keyboard.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
// Unified fullscreen-change handler. Always clears the floating
|
||||
// quick-action toolbar (its three buttons duplicate the top-right
|
||||
// toolbar that becomes visible again on exit — leaving them pinned
|
||||
// to the top of the page is just noise). Then re-evaluates the
|
||||
// keyboard lock and, for touch devices, refreshes the orientation-
|
||||
// dependent layout.
|
||||
function onFullscreenChange() {
|
||||
if (!isFullscreen()) {
|
||||
const fb = document.getElementById('floating-toolbar');
|
||||
if (fb) fb.classList.remove('visible');
|
||||
toolbarVisible = false;
|
||||
if (toolbarHideTimer) {
|
||||
clearTimeout(toolbarHideTimer);
|
||||
toolbarHideTimer = null;
|
||||
}
|
||||
}
|
||||
updateKeyboardLock();
|
||||
if (isTouchDevice) updateUIForOrientation();
|
||||
}
|
||||
|
||||
function toggleFloatingToolbar() {
|
||||
const toolbar = document.getElementById('floating-toolbar');
|
||||
toolbarVisible = !toolbarVisible;
|
||||
@@ -2517,6 +2555,12 @@
|
||||
if (controlEnabled) {
|
||||
applyRemoteCursor(currentCursorIndex);
|
||||
}
|
||||
// Sync the keyboard lock: in fullscreen + control mode, ESC and F11
|
||||
// must be passed through to the remote OS instead of triggering the
|
||||
// browser's exit-fullscreen / toggle-fullscreen behavior. The
|
||||
// updateKeyboardLock helper no-ops if either condition is missing
|
||||
// or the API is unavailable.
|
||||
updateKeyboardLock();
|
||||
}
|
||||
|
||||
// Update cursor overlay position (accounting for zoom/pan transform)
|
||||
@@ -3279,7 +3323,10 @@
|
||||
document.addEventListener('keydown', function(e) {
|
||||
if (!document.getElementById('screen-page').classList.contains('active')) return;
|
||||
if (e.target.tagName === 'INPUT') return;
|
||||
if (e.key === 'F11') return;
|
||||
// F11 belongs to the local fullscreen toggle UNLESS we're actively
|
||||
// controlling the remote — see the F11 handler above. Skip here
|
||||
// to let that one handle it.
|
||||
if (e.key === 'F11' && !controlEnabled) return;
|
||||
e.preventDefault();
|
||||
sendKey(e.keyCode, true, e.altKey);
|
||||
});
|
||||
@@ -3287,7 +3334,7 @@
|
||||
document.addEventListener('keyup', function(e) {
|
||||
if (!document.getElementById('screen-page').classList.contains('active')) return;
|
||||
if (e.target.tagName === 'INPUT') return;
|
||||
if (e.key === 'F11') return;
|
||||
if (e.key === 'F11' && !controlEnabled) return;
|
||||
e.preventDefault();
|
||||
sendKey(e.keyCode, false, e.altKey);
|
||||
});
|
||||
@@ -3480,9 +3527,10 @@
|
||||
resizeTimer = setTimeout(updateUIForOrientation, 100);
|
||||
});
|
||||
|
||||
// Listen for fullscreen changes
|
||||
document.addEventListener('fullscreenchange', updateUIForOrientation);
|
||||
document.addEventListener('webkitfullscreenchange', updateUIForOrientation);
|
||||
// Touch-device-only handlers continue here; the unified
|
||||
// fullscreen change handler (onFullscreenChange) is registered
|
||||
// below outside this branch so desktop browsers also get the
|
||||
// floating-toolbar cleanup + keyboard lock sync.
|
||||
|
||||
// Input shortcut buttons event handlers
|
||||
// Shortcuts only visible when keyboard is open, so no extra check needed
|
||||
@@ -3528,6 +3576,11 @@
|
||||
if (btnKeyboard) btnKeyboard.classList.add('ui-hidden');
|
||||
if (btnKeyboardBar) btnKeyboardBar.classList.add('ui-hidden');
|
||||
}
|
||||
// Unified fullscreen change handler — registered for all devices.
|
||||
// Touch devices need updateUIForOrientation; desktop devices need
|
||||
// the floating-toolbar cleanup. Both need the keyboard lock sync.
|
||||
document.addEventListener('fullscreenchange', onFullscreenChange);
|
||||
document.addEventListener('webkitfullscreenchange', onFullscreenChange);
|
||||
// Keyboard buttons: capture focus state and prevent blur from updating button state
|
||||
function bindKeyboardBtnEvents(btn) {
|
||||
if (!btn) return;
|
||||
|
||||
Reference in New Issue
Block a user