Add VNC-only scale-to-fit vs actual-size display toggle

VNC has no equivalent of RDP's MS-RDPEDISP to request a different
resolution from the guest, so a high-resolution remote desktop
previously always got shrunk to fit the window, making text
illegible. Adds a per-tab "Display Mode" choice (tab-bar right-click)
between the existing scale-to-fit behavior and a new actual-size mode
that renders the framebuffer at its native pixel size inside a
QScrollArea. Reuses VncDisplayWidget's existing scale-to-fit render
math unchanged -- it degenerates to an exact 1:1 mapping once the
widget is fixed to the remote's own size. Persisted like the terminal
theme preference.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
ksmithandClaude Sonnet 5 committed 2026-09-15 18:13:43 -06:00
1 parent 6da9dc6ca5
commit 0b5454197c
6 files changed
+129 -5

No files matched your search

+15
View File
@@ -25,6 +25,19 @@ public:
void setRemoteDesktopSize(int width, int height);
void clearFrame();
// true (default): scale the whole remote screen to fit the widget,
// like RdpDisplayWidget. false: render at the remote's actual pixel
// size -- meant to be placed inside a QScrollArea, whose scrollbars
// then let the user pan around a screen larger than the window
// instead of shrinking small text to illegibility. VNC has no
// equivalent of RDP's MS-RDPEDISP to request a different resolution
// from the guest, so this is the only way to see it at native size.
void setScaleToFit(bool scaleToFit);
bool scaleToFit() const
{
return m_scaleToFit;
}
signals:
void keyInput(int key, quint32 nativeScanCode, const QString& text, bool pressed, int modifiers);
void mouseMoveInput(int x, int y);
@@ -49,12 +62,14 @@ private:
QImage m_frame;
QSize m_remoteSize;
QTimer* m_resizeDebounceTimer;
bool m_scaleToFit;
QRectF renderRect() const;
QPoint mapToRemote(const QPointF& pos) const;
QSize effectiveRemoteSize() const;
void emitViewportGeometry();
void scheduleViewportGeometryEmit();
void applySizeConstraint();
};
#endif