From 69c750dd7205cc9ce4024aaf9a7104c9ca3abc2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Padez?= Date: Sat, 1 Aug 2026 22:13:32 +0000 Subject: [PATCH] desktop: resizeSession without scaleViewport, so the cursor lands where you click Both were enabled. They are alternative strategies, not complementary ones: resizeSession asks the server to become the container's size, scaleViewport scales whatever the server sends to fit. Running both means noVNC resizes AND then applies a scale factor, and any gap between the size requested and the size actually granted leaves a fractional scale that every pointer coordinate is mapped through. The visible symptom was a cursor offset from the real pointer, with clicks landing somewhere else. It only started mattering with the move to Xvnc. x11vnc could not resize, so resizeSession was inert and scaleViewport did all the work; Xvnc implements RandR SetDesktopSize, so now both are live and they interfere. Scaling is redundant now the session genuinely becomes the container size: pixels are 1:1 and there is no coordinate arithmetic left to get wrong. Co-Authored-By: Claude Opus 5 (1M context) --- .../officerdev/src/apps/Desktop/DesktopView.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/workspaces/officerdev/src/apps/Desktop/DesktopView.tsx b/src/workspaces/officerdev/src/apps/Desktop/DesktopView.tsx index 202eaacc..bcc6e906 100644 --- a/src/workspaces/officerdev/src/apps/Desktop/DesktopView.tsx +++ b/src/workspaces/officerdev/src/apps/Desktop/DesktopView.tsx @@ -139,8 +139,14 @@ export const DesktopView = ({ className, style }: DesktopViewProps) => { credentials: { password }, }); + // resizeSession WITHOUT scaleViewport. They are alternatives, not complements: resizeSession asks + // the server to become the container's size, scaleViewport scales whatever the server sends to fit. + // Xvnc implements RandR SetDesktopSize, so the session really does become the container size and + // there is nothing left to scale. With both enabled any gap between the size requested and the size + // granted leaves a fractional scale that pointer coordinates are mapped through — which is how the + // cursor ended up offset from where you clicked. One strategy, 1:1 pixels, no coordinate maths. rfb.resizeSession = true; - rfb.scaleViewport = true; + rfb.scaleViewport = false; rfb.focusOnClick = true; rfbRef.current = rfb;