TigerVNC client-side scaling

Scale the remote desktop to the viewer window — fit, stretch or by whole factors — inside TigerVNC's own vncviewer, without touching the remote resolution.

Repository on GitHub How it works

This is for you if:

What it adds

Stock TigerVNC has no client-side scaling: the viewer either shows the remote 1:1 with scrollbars, or asks the server to resize itself (RemoteResize). This patch adds two parameters:

parametervaluesdefault
ScaleOff, Fit (keep aspect, letterbox), Stretch, IntegerOff
ScaleFilterNearest, Linear, IntegerPlusLinear
vncviewer -Scale Fit -ScaleFilter Linear host:1

Switch it live from the context menu

The context menu (F8 in 1.15, Ctrl+Alt+M in 1.16) gets a Display mode submenu — Resize remote session, No resize (scrollbars), Scale to fit, Scale to stretch, Scale by integer — and a Scale filter submenu with Nearest, Linear and Integer+. Changes last for the session.

How it works

The viewer already draws into an offscreen XRender picture. Scaling sets an XRender transform and filter on that picture and composites it to the window, so the X server does the work and the viewer stays an ordinary X11 client and input methods and the clipboard keep working. Pointer coordinates go through the same pixel-centre mapping as the image, so clicks land where you see them, including in the letterbox. The full design, and the traps found while testing (bilinear fading to black at the edges, damage rectangles, the framebuffer-size assertion), are in docs/scaling.md.

Build

There is one patch per TigerVNC version, in patches/1.15.0/ and patches/1.16.2/. Use the one matching your distribution: 1.15.0 for Ubuntu 25.10–26.10 (including 26.04 LTS), Debian 13 and Fedora 40–41; 1.16.2 for Arch, Fedora 42+, Gentoo, NixOS 25.11+, openSUSE Tumbleweed, Debian 14 and Ubuntu 27.04.

On Ubuntu, the script fetches the Ubuntu source package of the chosen version, applies the Debian patches and this patch, and builds only the viewer; both versions build on Ubuntu 26.04:

sudo apt install --no-install-recommends \
     libfltk1.3-dev libavcodec-dev libavutil-dev libswscale-dev libpam0g-dev
git clone https://github.com/zirize/tigervnc-client-scaling
cd tigervnc-client-scaling
./build.sh              # 1.15.0 -> build/1.15.0/vncviewer/vncviewer
./build.sh 1.16.2       # 1.16.2 -> build/1.16.2/vncviewer/vncviewer

Elsewhere, apply the patch for your version to a TigerVNC tree:

git clone --branch v1.16.2 https://github.com/TigerVNC/tigervnc.git
cd tigervnc && git apply ../tigervnc-client-scaling/patches/1.16.2/0001-*.patch
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release && ninja -C build vncviewer

Dependencies and how to rework the patch are in docs/build.md.

Tested on

Ubuntu 26.04 LTS with KDE Plasma on Wayland (the viewer under Xwayland), TigerVNC 1.15.0+dfsg-2build1. On the real desktop, in scale mode: clipboard in both directions, Korean input through an IME running in the remote session (fcitx5-hangul) and fullscreen all work. A headless regression test on private Xvnc displays checks stock parity, every mode against reference images, pointer mapping, partial updates, live resizing and menu switching, with 0 failures.

TigerVNC 1.16.2 (the Ubuntu 27.04 source package 1.16.2+dfsg-1ubuntu1, built on the same Ubuntu 26.04): the headless test passes with 0 failures, including Scale=Off against an unpatched 1.16.2 build pixel for pixel, and on the real desktop Korean input, clipboard, fullscreen, the Ctrl+Alt+M menu and live resizing all work.

Each patch also applies cleanly to the matching upstream tag (v1.15.0, v1.16.2). Other versions have not been tried.

X11 only. The scaled path uses XRender, so Windows and macOS builds of the patched viewer will not link. Scale and ScaleFilter are command-line parameters and are not written to .tigervnc files.

GPL-2.0-or-later, the same as TigerVNC.