Skip to content

Remote cursor support (tested against UltraVNC and TightVNC so far)#1964

Open
jkanefendt wants to merge 2 commits intonovnc:masterfrom
jkanefendt:feature/remote-cursor-support
Open

Remote cursor support (tested against UltraVNC and TightVNC so far)#1964
jkanefendt wants to merge 2 commits intonovnc:masterfrom
jkanefendt:feature/remote-cursor-support

Conversation

@jkanefendt
Copy link
Copy Markdown

Adds support for decoding an displaying the remote cursor position.

Copy link
Copy Markdown
Member

@CendioOssman CendioOssman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your submission!

For new extensions, the first thing is that we want to make sure that it is documented here:

https://github.com/rfbproto/rfbproto/blob/master/rfbproto.rst

Which it unfortunately isn't yet. So please, try to write down what the behaviour you've found in TightVNC and UltraVNC and we can start with getting the documentation done.

Comment thread core/encodings.js Outdated
Comment thread core/encodings.js Outdated
Comment thread core/rfb.js
const x = this._FBU.x;
const y = this._FBU.y;

this._cursor.moveRemote(x, y, this._display.scale);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that this is what this extension means? Not that the client is expected to really move the actual position of the cursor, e.g. as used in games?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's up to the client of how to deal with remote pointer events. The suggested implementation is drawing the remote cursor either if it's in view-only mode or if the local cursor is outside the canvas, otherwise such events are ignored.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The server needs to know what to expect, though. So the behaviour needs to be specified.

The UltraVNC code you linked treats it as just a display thing, which matches your PR here.

I also had a look at the original TightVNC code. It mostly does the same thing, with the exception of the X11 client. In there, it actually does XWarpCursor().

But since that isn't consistent, the server can't rely on it. So I'm willing to treat that as an odd exception and we can go with this just being for rendering.

As for when this needs to be done, it should be whenever needed to give the user the correct feedback. So it should follow the same logic the server uses without this extension.

In TigerVNC (which is based on the original RealVNC code), this is whenever the local cursor position and server cursor position differ, and some time has passed (to deal with various latencies). The TigerVNC code is rather crude, but in practice the time should be 500 ms on average.

That logic should hopefully handle view-only implicitly, as there will never be a valid local cursor position in that case.

Comment thread docs/API.md Outdated
Comment on lines +80 to +83
`showRemoteCursor`
- Is a `boolean` indicating whether the remote cursor position should
be tracked. The server must support the respective pseudo encoding.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is truly just a rendering optimization, then we don't need a setting. Just have it enabled.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in e34a1c2

@jkanefendt jkanefendt requested a review from CendioOssman June 2, 2025 09:14
@jkanefendt
Copy link
Copy Markdown
Author

Which it unfortunately isn't yet. So please, try to write down what the behaviour you've found in TightVNC and UltraVNC and we can start with getting the documentation done.

The pointer position encoding does not seem to be officially documented.

It may be reconstructed from the UltraVNC viewer implementation:
https://github.com/ultravnc/UltraVNC/blob/main/vncviewer/ClientConnection.cpp#L5954-L5958
https://github.com/ultravnc/UltraVNC/blob/main/vncviewer/ClientConnectionCursor.cpp#L154-L164

The remote pointer position is represented in the x and y coordinates of the framebuffer update message, there is no further payload.

@CendioOssman
Copy link
Copy Markdown
Member

We'd like the documentation in place before we merge this. So please see if you could have a look at writing a draft for that.

@Neustradamus
Copy link
Copy Markdown

@RudiDeVos: Have you seen this noVNC PR?

@jkanefendt
Copy link
Copy Markdown
Author

We'd like the documentation in place before we merge this. So please see if you could have a look at writing a draft for that.

@CendioOssman You mean the protocol documentation of the pointer position pseudo encoding or a description of how the implementation actually deals with this information?

@CendioOssman
Copy link
Copy Markdown
Member

I'd say those are the same thing. The protocol information should include both how things are encoded, and the semantics around how it should be used.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants