TigerVNC / tigervnc

High performance, multi-platform VNC client and server
https://tigervnc.org
GNU General Public License v2.0
5.1k stars 935 forks source link

The mouse often shows an incorrect cursor when connected to a Mac server. #826

Closed BlakeTNC closed 5 years ago

BlakeTNC commented 5 years ago

Describe the bug When connecting to the built-in Mac OS X Mojave VNC server, the mouse cursor will often display an incorrect cursor image in the TigerVNC client. (The cursor is "incorrect" in comparison to the native cursor being simultaneously displayed on a monitor directly connected to the server machine). This is not just a "delay" in updating the cursor image, it's permanent until another mouse image event overrides it. So in some cases, the incorrect cursor image can persist indefinitely long. I've attached a screenshot of the issue. Right before I took the screenshot, I closed an application window. While I was clicking the close button, the cursor was still showing the "corner resize" cursor image. As the screenshot shows, the corner resize cursor never changed back to a normal mouse "arrow" image, even after moving the mouse around for a bit.

To Reproduce 1) Set up the Mac server. You will need (any) Mac machine running the latest Mac OS X, which is "Mac OS X Mojave" as of this writing. To turn on the built-in VNC server, click the Apple menu>System preferences>Sharing. Click the checkbox to enable "Screen Sharing". Click the button labeled "Computer Settings...". Click the checkbox labeled "VNC viewers may control screen with password", and enter a connection password. Click okay. Close system preferences. The built-in OSX VNC server is now enabled. 2) Run this line on the server, in the mac "Terminal" application. This fixes a server-side bug where TigerVNC (or other VNC clients) can get stuck on the login screen. sudo defaults write /Library/Preferences/com.apple.RemoteManagement VNCAlwaysStartOnConsole -bool true (Note: The above terminal command, and the VNC server bug that it fixes, are described here: (https://apple.stackexchange.com/questions/342161/macos-mojave-remote-access-login-screen-stuck-on-infinite-loading-spinner) 3) Install the TigerVNC client on a Windows machine. I was using Windows 8.1, and TigerVNC 64 bit 1.9.0. ("vncviewer64-1.9.0.exe") 4) Connect to the Mac Server. 5) Manipulate windows with actions that will change the cursor, until the cursor image breaks. It helps to open and close windows, and change the focus around. 6) One specific way to break the cursor: Overlap two Windows. Open one instance of TextEdit, and one instance of Finder. Place the TextEdit window overlapping behind the Finder window, and click back and forth between the two windows, changing the focus. Within the TextEdit window, the cursor should always be a vertical line while TextEdit has focus. But in the TigerVNC client, this will not always be the case. 7) Another way to break the cursor: Open an application window. Hover over the upper left corner until the cursor changes to a "resize cursor". Slowly move the cursor over the close button, without letting the cursor change images. Click the close button. The cursor will continue to show the resize arrow.

Expected behavior The mouse cursor image should stay in sync with the server image. A delay of a few seconds is fine... (maybe up to 5 or 10 seconds?). But it should not remain incorrect indefinitely long.

Screenshots A screenshot is attached.

Client:

Server:

Misc notes This problem may be due to the Mac VNC implementation, or the Tiger client, but either way I'm hoping and imagining that a client side source code fix or workaround is possible. TigerVNC is one of the -only- windows vnc clients that works decently with the mac vnc server, while also being open source software.

Note: I'm a Java developer and have used a few other languages. If someone will point me at the code area that handles cursor images, I might (possibly) be able to help.

-BlakeTNC

Screenshot

CendioOssman commented 5 years ago

The cursor handling in the client is very simple, so I'm afraid I would have to guess that this is a server issue.

Could you test other clients and see if you get the same issue?

BlakeTNC commented 5 years ago
BlakeTNC commented 5 years ago

This is looking like a server-side problem, as you said. I'm wondering about a client workaround. Does the VNC protocol have a method whereby a client could "poll" (ask) a server for the current mouse cursor shape? If so, I'm imagining a solution where the client could ask the server for the current cursor shape every few seconds, and use that information to keep the cursor up to date. This could be configurable via an option that says "Poll server-side cursor every X seconds". Obviously polling for a resource change is not generally the most elegant way to solve programming problems, but it can be useful if nothing else is available.

CendioOssman commented 5 years ago

I'm afraid there is no such mechanism. We just passively wait for the server to send us something.

There isn't really anything more we can do here, unfortunately. I'll have to direct you to report this issue to Apple and hope they fix this.