Add VNC clipboard sync

RFB's ServerCutText/ClientCutText messages are much simpler than RDP's
CLIPRDR channel (no format-list/format-request negotiation -- text is
just sent directly in both directions), so ServerCutText now emits
remoteClipboardTextChanged instead of being discarded, and
VncSessionBackend overrides setClipboardText to send ClientCutText
immediately. Extends session_tab.cpp's clipboard-sync gate to cover
VNC alongside RDP; the QClipboard wiring itself was already
protocol-agnostic. Latin-1 only, per RFB's wire format -- no Unicode
clipboard extension is in scope.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-15 20:31:03 -06:00
co-authored by Claude Sonnet 5
parent 35d4daec7f
commit 3dd894407a
4 changed files with 134 additions and 5 deletions
+4 -1
View File
@@ -21,7 +21,8 @@ class QTcpSocket;
// Scope (see plan / issue #3 for the full rationale): standard VNC
// Authentication (security type 2) and no-auth (type 1) only -- not
// Apple's Screen Sharing scheme (type 30). Raw + CopyRect encodings only.
// No dynamic resize, no remote cursor shape sync, no clipboard sync.
// No dynamic resize, no remote cursor shape sync. Clipboard sync (Latin-1
// only, per RFB's ServerCutText/ClientCutText) is supported.
class VncSessionBackend : public SessionBackend
{
Q_OBJECT
@@ -52,6 +53,7 @@ public slots:
void sendMouseMoveEvent(int x, int y) override;
void sendMouseButtonEvent(int x, int y, int button, bool pressed) override;
void sendMouseWheelEvent(int x, int y, int deltaX, int deltaY) override;
void setClipboardText(const QString& text) override;
private slots:
void onSocketConnected();
@@ -129,6 +131,7 @@ private:
void onRectangleFinished();
void sendPointerEvent();
void sendWheelClick(quint8 wheelBit);
void sendClientCutText(const QString& text);
};
#endif