Skip to content

libvnc: add ExtendedMouseButtons support#720

Open
marcofortina wants to merge 1 commit into
LibVNC:masterfrom
marcofortina:feature/extended-mouse-buttons
Open

libvnc: add ExtendedMouseButtons support#720
marcofortina wants to merge 1 commit into
LibVNC:masterfrom
marcofortina:feature/extended-mouse-buttons

Conversation

@marcofortina
Copy link
Copy Markdown
Contributor

@marcofortina marcofortina commented May 16, 2026

Summary

Adds ExtendedMouseButtons support for LibVNCServer/LibVNCClient.

The RFB ExtendedMouseButtons pseudo-encoding allows clients and servers to
negotiate extended PointerEvent messages with an extra button-state byte. This
is needed for mouse buttons beyond the legacy one-byte PointerEvent mask, such
as forward/back-capable devices and additional mouse buttons.

Changes

  • Add rfbEncodingExtendedMouseButtons and named button masks up to button 15.
  • Server side:
    • Accept rfbEncodingExtendedMouseButtons in SetEncodings.
    • Send the empty pseudo-rectangle acknowledgement required by the extension.
    • Track whether ExtendedMouseButtons has been negotiated for each client.
    • Decode extended PointerEvent messages only after the extension has been negotiated.
    • Preserve legacy PointerEvent handling when the extension is not negotiated.
  • Client side:
    • Advertise rfbEncodingExtendedMouseButtons.
    • Track the server acknowledgement.
    • Send normal legacy PointerEvent messages when possible.
    • Send normal button 8 without requiring the extension.
    • Send buttons above button 8 with the extended PointerEvent form after negotiation.
    • Preserve legacy behavior when the server does not acknowledge the extension.
  • Add regression coverage for:
    • ExtendedMouseButtons negotiation.
    • Server-side acknowledgement handling.
    • Client-side PointerEvent serialization.
    • Legacy fallback behavior when the extension is not negotiated.

Validation

Local validation:

git diff --check
cmake -S . -B build-686-patch \
  -DWITH_EXAMPLES=OFF \
  -DWITH_TESTS=ON \
  -DWITH_OPENSSL=OFF \
  -DWITH_GNUTLS=OFF \
  -DWITH_GCRYPT=OFF \
  -DWITH_SDL=OFF \
  -DWITH_GTK=OFF \
  -DWITH_QT=OFF \
  -DWITH_FFMPEG=OFF \
  -DWITH_XCB=OFF \
  -DWITH_LIBSSHTUNNEL=OFF \
  -DWITH_SYSTEMD=OFF \
  -DCMAKE_BUILD_TYPE=Debug
cmake --build build-686-patch --parallel 1
ctest --test-dir build-686-patch --output-on-failure

Result:

100% tests passed, 0 tests failed out of 6

Notes

This implements the negotiated ExtendedMouseButtons protocol path without
changing the legacy PointerEvent behavior for peers that do not negotiate the
extension.

This PR does not add any LibVNC-specific wire protocol. It uses the standard
RFB ExtendedMouseButtons pseudo-encoding and keeps the feature opt-in through
normal SetEncodings negotiation.

Closes #686.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support mouse back and forward button via implementating ExtendedMouseButtons

2 participants