-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Remote cursor support (tested against UltraVNC and TightVNC so far) #1964
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -309,7 +309,7 @@ export default class RFB extends EventTargetMixin { | |
|
|
||
| get viewOnly() { return this._viewOnly; } | ||
| set viewOnly(viewOnly) { | ||
| this._viewOnly = viewOnly; | ||
| this._viewOnly = this._cursor.viewOnly = viewOnly; | ||
|
|
||
| if (this._rfbConnectionState === "connecting" || | ||
| this._rfbConnectionState === "connected") { | ||
|
|
@@ -413,6 +413,11 @@ export default class RFB extends EventTargetMixin { | |
| } | ||
| } | ||
|
|
||
| get showRemoteCursor() { return this._showRemoteCursor; } | ||
| set showRemoteCursor(show) { | ||
| this._showRemoteCursor = show; | ||
| } | ||
|
|
||
| // ===== PUBLIC METHODS ===== | ||
|
|
||
| disconnect() { | ||
|
|
@@ -2264,6 +2269,12 @@ export default class RFB extends EventTargetMixin { | |
| if (this._fbDepth == 24) { | ||
| encs.push(encodings.pseudoEncodingVMwareCursor); | ||
| encs.push(encodings.pseudoEncodingCursor); | ||
| encs.push(encodings.pseudoEncodingRichCursor); | ||
| } | ||
|
|
||
| if (this._showRemoteCursor) { | ||
| encs.push(encodings.pseudoEncodingPointerPos); | ||
| encs.push(encodings.pseudoEncodingTightPointerPos); | ||
| } | ||
|
|
||
| RFB.messages.clientEncodings(this._sock, encs); | ||
|
|
@@ -2673,6 +2684,7 @@ export default class RFB extends EventTargetMixin { | |
| return this._handleVMwareCursor(); | ||
|
|
||
| case encodings.pseudoEncodingCursor: | ||
| case encodings.pseudoEncodingRichCursor: | ||
| return this._handleCursor(); | ||
|
|
||
| case encodings.pseudoEncodingQEMUExtendedKeyEvent: | ||
|
|
@@ -2696,6 +2708,10 @@ export default class RFB extends EventTargetMixin { | |
| case encodings.pseudoEncodingQEMULedEvent: | ||
| return this._handleLedEvent(); | ||
|
|
||
| case encodings.pseudoEncodingPointerPos: | ||
| case encodings.pseudoEncodingTightPointerPos: | ||
| return this._handlePointerPos(); | ||
|
|
||
| default: | ||
| return this._handleDataRect(); | ||
| } | ||
|
|
@@ -2888,6 +2904,15 @@ export default class RFB extends EventTargetMixin { | |
| return true; | ||
| } | ||
|
|
||
| _handlePointerPos() { | ||
| const x = this._FBU.x; | ||
| const y = this._FBU.y; | ||
|
|
||
| this._cursor.moveRemote(x, y, this._display.scale); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 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. |
||
|
|
||
| return true; | ||
| } | ||
|
|
||
| _handleExtendedDesktopSize() { | ||
| if (this._sock.rQwait("ExtendedDesktopSize", 4)) { | ||
| return false; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -77,6 +77,10 @@ protocol stream. | |
| if the remote session is smaller than its container, or handled | ||
| according to `clipViewport` if it is larger. Disabled by default. | ||
|
|
||
| `showRemoteCursor` | ||
| - Is a `boolean` indicating whether the remote cursor position should | ||
| be tracked. The server must support the respective pseudo encoding. | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed in e34a1c2 |
||
| `showDotCursor` | ||
| - Is a `boolean` indicating whether a dot cursor should be shown | ||
| instead of a zero-sized or fully-transparent cursor if the server | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.