Skip to content
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

invisible cursor when used with UltraVNC server 1.3.4.1 #1335

Closed
ajschorr opened this issue Sep 15, 2021 · 18 comments
Closed

invisible cursor when used with UltraVNC server 1.3.4.1 #1335

ajschorr opened this issue Sep 15, 2021 · 18 comments
Labels
notourbug This issue needs to be resolved elsewhere

Comments

@ajschorr
Copy link

Describe the bug
I have a Linux Fedora 34 workstation with tigervnc 1.11.0 installed. When I connect to a Windows 10 Pro PC
running UltraVNC 1.3.4.1 server, the cursor/mouse is completely invisible. I tried using the beta 1.11.90 version
of the tigervnc client, and it still has the same problem. This problem has been present with past versions of
UltraVNC as well.

To Reproduce
Steps to reproduce the behavior:

  1. On a Windows 10 Pro PC, run UltraVNC server 1.3.4.1
  2. On a Linux PC, connect using the tigervnc vncviewer client.
  3. Observe that the mouse is invisible.
  4. This problem does not occur with other VNC clients such as vinagre, realvnc, and remmina.

Expected behavior
The cursor should be visible.

Screenshots
If applicable, add screenshots to help explain your problem.

Client (please complete the following information):

  • OS: Fedora 34
  • VNC client: TigerVNC
  • VNC client version: 1.11.0 and 1.11.90
  • Client downloaded from: Fedora and from tightvnc sourceforge site

Server (please complete the following information):

  • OS: Windows 10 Pro
  • VNC server: UltraVNC
  • VNC server version: 1.3.4.1, but I have observed this in prior versions as well.
  • Server downloaded from: uvnc.com
  • Server was started using: standard ultravnc installation

Additional context
Add any other context about the problem here.

@ajschorr
Copy link
Author

I tested previous releases, and this worked fine throough 1.10.1. It is broken in 1.11.0. I guess somebody should run a git bisect. Maybe I will get time to do that...

@ajschorr
Copy link
Author

I ran git bisect on it. Here is the offending commit:
[schorr@asny-nuc ~/tigervnc]$ git bisect bad
2cd3cb4 is the first bad commit
commit 2cd3cb4
Author: Pierre Ossman ossman@cendio.se
Date: Mon Dec 23 16:26:40 2019 +0100

Set initial blank cursor

If the server doesn't support local cursors and want to render them
itself then we need to make sure the local cursor is invisible.

This also makes sure we always have some cursor allocated, so we can
remove the checks in some places.

vncviewer/Viewport.cxx | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

@ajschorr
Copy link
Author

Reverting that patch fixes the problem. Is that patch beneficial in other scenarios?

@CendioOssman
Copy link
Member

Yes, that change is needed to avoid double cursors for servers that do not support local cursors.

I'm afraid what you are seeing indicates a bug in UltraVNC. It's something we've seen before in that the server doesn't send over the cursor until the first time the cursor changes. So I'm afraid you'll have to report this issue to UltraVNC and see if they can come up with a fix.

Until then, the workaround we have is the setting "Show dot when no cursor".

@CendioOssman CendioOssman added the notourbug This issue needs to be resolved elsewhere label Sep 20, 2021
@ajschorr
Copy link
Author

Thanks for the response. FYI, the "show dot when no cursor" setting does not work when set from the option menu after starting vncviewer. The cursor remains invisible. However, if one invokes vncviewer with the -DotWhenNoCursor option, that does seem to work. I had not tried the latter previously. Why does it not work from the option menu?

@CendioOssman
Copy link
Member

That would be a bug in that case. Let me have a look...

@CendioOssman
Copy link
Member

I can reproduce that here, so I've added #1340. Thanks for noticing.

@ajschorr
Copy link
Author

You're welcome. I will try reporting this to UltraVNC. But isn't the UltraVNC server widely used? It seems to me that there should be some effort to make sure that the tigervnc viewer works with UltraVNC. Or am I the only one using UltraVNC? It feels not OK to me to put out a viewer that simply doesn't work with UltraVNC. The dot cursor is rather sucky, to use a technical term. Just not visually prominent enough.

@CendioOssman
Copy link
Member

It is popular, but unfortunately we cannot work around this bug without breaking things for servers that are correctly implementing things. And we don't want to punish those that try their best to follow the protocol properly. UltraVNC is fortunately an active project so hopefully they can get this fixed.

@ajschorr
Copy link
Author

I understand your point, but there still could be a "-FixBrokenCursor" option to support UltraVNC's buggy behavior. I will try reporting to them and see if they care. I have tried many VNC clients with UltraVNC, and tigervnc is the only one that doesn't work. The realvnc client works fine, as does vinagre and remmina. So why is tigervnc the exception? Are you saying that all of those other clients are broken?

@CendioOssman
Copy link
Member

I would guess they misbehave against servers that want server side cursors, yes. They are rare though, so it's quite possible they haven't gotten any reports for it (or don't care). And after all, we fixed it in TigerVNC fairly recently.

@ajschorr
Copy link
Author

I posted a message in the UltraVNC forum here:
https://forum.ultravnc.net/viewtopic.php?f=3&t=37411&p=110008&hilit=tigervnc&sid=71fd232bf3fa50013d3ed0a6c620c1bc#p110008
I hope that somehow one or both sides can come up with a fix for this. The current situation
is totally broken.

Thanks,
Andy

@ajschorr
Copy link
Author

ajschorr commented Sep 20, 2021

Here's a patch to add a -UseLocalCursor option:

diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx
index 2f8a92c6..0c1979a6 100644
--- a/vncviewer/Viewport.cxx
+++ b/vncviewer/Viewport.cxx
@@ -185,8 +185,9 @@ Viewport::Viewport(int w, int h, const rfb::PixelFormat& serverPF, CConn* cc_)
 
   OptionsDialog::addCallback(handleOptions, this);
 
-  // Make sure we have an initial blank cursor set
-  setCursor(0, 0, rfb::Point(0, 0), NULL);
+  if (!useLocalCursor)
+    // Make sure we have an initial blank cursor set
+    setCursor(0, 0, rfb::Point(0, 0), NULL);
 }
 
 
@@ -582,7 +583,8 @@ int Viewport::handle(int event)
     return 1;
 
   case FL_ENTER:
-    window()->cursor(cursor, cursorHotspot.x, cursorHotspot.y);
+    if (!useLocalCursor || cursor)
+      window()->cursor(cursor, cursorHotspot.x, cursorHotspot.y);
     // Yes, we would like some pointer events please!
     return 1;
 
@@ -1315,7 +1317,7 @@ void Viewport::popupContextMenu()
   handle(FL_FOCUS);
 
   // Back to our proper mouse pointer.
-  if (Fl::belowmouse())
+  if (useLocalCursor ? ((Fl::belowmouse() == this) && cursor) : (Fl::belowmouse() != NULL))
     window()->cursor(cursor, cursorHotspot.x, cursorHotspot.y);
 
   if (m == NULL)
diff --git a/vncviewer/parameters.cxx b/vncviewer/parameters.cxx
index 18384f3a..400db5a7 100644
--- a/vncviewer/parameters.cxx
+++ b/vncviewer/parameters.cxx
@@ -64,6 +64,8 @@ BoolParameter emulateMiddleButton("EmulateMiddleButton",
 BoolParameter dotWhenNoCursor("DotWhenNoCursor",
                               "Show the dot cursor when the server sends an "
                               "invisible cursor", false);
+BoolParameter useLocalCursor("UseLocalCursor",
+                              "Force a local cursor", false);
 
 BoolParameter alertOnFatalError("AlertOnFatalError",
                                 "Give a dialog on connection problems rather "
@@ -177,6 +179,7 @@ static VoidParameter* parameterArray[] = {
   &SecurityClient::secTypes,
   &emulateMiddleButton,
   &dotWhenNoCursor,
+  &useLocalCursor,
   &reconnectOnError,
   &autoSelect,
   &fullColour,
diff --git a/vncviewer/parameters.h b/vncviewer/parameters.h
index 1dd9aca2..c20c5af6 100644
--- a/vncviewer/parameters.h
+++ b/vncviewer/parameters.h
@@ -34,6 +34,7 @@
 extern rfb::IntParameter pointerEventInterval;
 extern rfb::BoolParameter emulateMiddleButton;
 extern rfb::BoolParameter dotWhenNoCursor;
+extern rfb::BoolParameter useLocalCursor;
 
 extern rfb::StringParameter passwordFile;
 
diff --git a/vncviewer/vncviewer.man b/vncviewer/vncviewer.man
index 894787c0..1b581846 100644
--- a/vncviewer/vncviewer.man
+++ b/vncviewer/vncviewer.man
@@ -285,6 +285,10 @@ Use custom compression level. Default if \fBCompressLevel\fP is specified.
 Show the dot cursor when the server sends an invisible cursor. Default is off.
 .
 .TP
+.B \-UseLocalCursor
+Force a local cursor; needed to work around an UltraVNC interoperability problem. Default is off.
+.
+.TP
 .B \-PointerEventInterval \fItime\fP
 Time in milliseconds to rate-limit successive pointer events. Default is
 17 ms (60 Hz).

@ajschorr
Copy link
Author

FYI, I created a pull request for this patch:
#1342

@ajschorr
Copy link
Author

FYI, I opened an UltraVNC issue on this topic here:

ultravnc/UltraVNC#24

@Neustradamus
Copy link

@ajschorr: Can you add your code between "Insert code" feature?

@ajschorr
Copy link
Author

ajschorr commented Oct 28, 2021

Hi, the patch is in the pull request. Are you asking me to insert the patch again here in this issue?
I'm happy to help, but I don't quite understand what's wanted. I edited the comment above that contains the patch to quote it properly, so it should look OK now. But I think the pull request is the better way to view it.

@RudiDeVos
Copy link

Did a little research:
Seems TigerVNC send the pseudoEncoding before the actual encoding causing UltraVNC to ignore it.
Changed our code so that it's cached.
UltraVNC now send proper the cursor shapes.

TigerVNC support rfbEncodingXCursor/rfbEncodingRichCursor but not rfbEncodingPointerPos
The server can send the shapes, but can't send a position move, if the cursor moves on the server it isn't visible on the viewer, for that rfbEncodingPointerPos also need to be implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notourbug This issue needs to be resolved elsewhere
Projects
None yet
Development

No branches or pull requests

4 participants