Adopt documentation from TigerVNC and make offsets optional

This commit is contained in:
Daniel Hammerschmidt 2025-09-15 21:00:34 +02:00
parent d379338cae
commit e8bde27810
2 changed files with 11 additions and 0 deletions

View File

@ -88,11 +88,14 @@ const extendedClipboardActionNotify = 1 << 27;
const extendedClipboardActionProvide = 1 << 28; const extendedClipboardActionProvide = 1 << 28;
// [GEOMETRY SPECIFICATIONS](https://www.x.org/releases/X11R7.7/doc/man/man7/X.7.xhtml#heading7) // [GEOMETRY SPECIFICATIONS](https://www.x.org/releases/X11R7.7/doc/man/man7/X.7.xhtml#heading7)
// [X0VNCSERVER Geometry](https://tigervnc.org/doc/x0vncserver.html#:~:text=is%2060.-,%E2%88%92Geometry%20geometry)
const geometryRegExp = new RegExp([ const geometryRegExp = new RegExp([
'^', '^',
'(?<width>0|[1-9][0-9]*)', 'x', '(?<height>0|[1-9][0-9]*)', '(?<width>0|[1-9][0-9]*)', 'x', '(?<height>0|[1-9][0-9]*)',
'(?:',
'(?:', '[+](?<left>0|[1-9][0-9]*)', '|', '[-](?<right>0|[1-9][0-9]*)', ')', '(?:', '[+](?<left>0|[1-9][0-9]*)', '|', '[-](?<right>0|[1-9][0-9]*)', ')',
'(?:', '[+](?<top>0|[1-9][0-9]*)', '|', '[-](?<bottom>0|[1-9][0-9]*)', ')', '(?:', '[+](?<top>0|[1-9][0-9]*)', '|', '[-](?<bottom>0|[1-9][0-9]*)', ')',
')?',
'$', '$',
].join('')); ].join(''));
@ -851,6 +854,7 @@ export default class RFB extends EventTargetMixin {
function compute(width, left, right, maxWidth) { function compute(width, left, right, maxWidth) {
if (width === 0 || width > maxWidth) { width = maxWidth; } if (width === 0 || width > maxWidth) { width = maxWidth; }
if (right === undefined) { if (right === undefined) {
left ??= 0;
if (left + width > maxWidth) { if (left + width > maxWidth) {
left = maxWidth - width; left = maxWidth - width;
} }

View File

@ -85,6 +85,13 @@ Currently, the following options are available:
* `resize` - How to resize the remote session if it is not the same size as * `resize` - How to resize the remote session if it is not the same size as
the browser window. Can be one of `off`, `scale` and `remote`. the browser window. Can be one of `off`, `scale` and `remote`.
* `crop_rect` - This option specifies the remote framebuffer area that will be
shown in the noVNC client. The format is widthxheight+xoffset+yoffset, where
+ signs can be replaced with signs to specify offsets from the right
and/or from the bottom of the screen. Offsets are optional, +0+0 is assumed
by default (top left corner). If the argument is empty, full screen is shown
to VNC clients (this is the default). See -Geometry parameter of TigerVNC.
* `quality` - The session JPEG quality level. Can be `0` to `9`. * `quality` - The session JPEG quality level. Can be `0` to `9`.
* `compression` - The session compression level. Can be `0` to `9`. * `compression` - The session compression level. Can be `0` to `9`.