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) <noreply@anthropic.com>
This commit is contained in:
2026-08-01 22:13:32 +00:00
co-authored by Claude Opus 5
parent f22c667502
commit 69c750dd72
@@ -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;