TigerVNC / tigervnc

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

Java: Incorrect rendering of full-color cursors on Linux #512

Open dcommander opened 7 years ago

dcommander commented 7 years ago

On all Linux platforms and JREs I tested (including Java 6, 7, and 8; RHEL 5-7; and Ubuntu), full-color cursor rendering appears to be incorrect when using the Java viewer with cursor shape updates enabled. Easiest way to reproduce the issue is to install oxygen-cursor-themes on the server and select one of those cursor themes, then connect with the Java viewer running on Linux with cursor shape updates enabled. The cursors are displayed with a single color on the client machine, regardless of whether the new alpha cursor feature is enabled or the old rich cursor feature is being used.

@bphinz since this doesn't occur with the FLTK viewer, nor on any other client platform, it appears to be a JRE bug, but I wanted to get your input on it.

--- Want to back this issue? **[Post a bounty on it!](https://app.bountysource.com/issues/49189134-java-incorrect-rendering-of-full-color-cursors-on-linux?utm_campaign=plugin&utm_content=tracker%2F3557444&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://app.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F3557444&utm_medium=issues&utm_source=github).
bphinz commented 7 years ago

Ugh... I'll have to look at this when I can get to a real physical console, but in the process of trying to reproduce it I stumbled into another issue. Running the Java client inside a linux VNC session accessed from a Java client running on Windows displays cursor colors, but looks terrible because the "inner" client thinks that it supports cursor alpha when in fact it doesn't because the "outer" client is on Windows. At a minimum, I need to devise some way to actually test whether or not the client can display alpha cursors...

BTW, there is definitely a shortcoming in the JRE because Windows is capable of supporting cursors with alpha, but the custom cursor implementation on Windows has the image type hard-coded to TYPE_INT_RGB.

bphinz commented 7 years ago

Also, on linux it appears that Toolkit.getDefaultToolkit().getMaximumCursorColors() always returns 2, so that's probably the issue you're seeing.

dcommander commented 7 years ago

Yes, further googling suggests that it's endemic to the JRE. As far as the other problem you described, it seems like that problem can't be fixed until this one is fixed, because even with alpha-enabled cursors, the inner Linux client will only display cursors using 2 colors. Seems like it might even be a reasonable thing to check Toolkit.getDefaultToolkit().getMaximumCursorColors() and disable alpha cursors if that function returns 2. I would almost say it would make sense to disable rich cursors as well, but arguably 2-color rich cursors still look a little better than X cursors (only barely, though.)