Oct 20 2007
Possible regression in Java 6 DisplayMode functionality on Ubuntu Gutsy
I upgraded my desktop machine to Gutsy today to have a play with it before upgrading my laptop. I’m really glad I did it in this order as it appears there may be a regression in the version of Java 6 shipping on Gutsy.
I happened to test out a Java game which uses Full Screen Exclusive Mode with a DisplayMode of 800×600. So far this app has been working ok on Feisty but when I tested it today on Gutsy it couldn’t change display mode. I discovered that Java was only able to see the current screen mode of 1280×1024 and no others.
I’ve opened a bug on Launchpad here: #154613: Java cannot change display modes / screen resolution in Gutsy, and I’ve been digging in trying to work out what’s going wrong.
I managed to locate the JNI function call in Java’s native C source code where it gets the list of modes. It’s called Java_sun_awt_X11GraphicsDevice_enumDisplayModes(...) and is in the file j2se/src/solaris/native/sun/awt/awt_GraphicsEnv.c. As expected the Ubuntu packages are built from the Sun Linux binaries - no source code. I couldn’t find the Java 6 source on Sun’s site, the link appears to be wrong. Instead I found the file in the Icedtea/OpenJDK source tree. Icedtea on Gutsy has the same problem so I’m fairly happy this is the the same or roughly the same code as in Java 6.
The function makes use of the XRandr Xorg extension to query the available display modes. I coded up a small test to see if XRandr was behaving correctly. It is, on both Gutsy and Feisty. So it looks like it could be something in Java 6 u3.
Will keep digging, as I really need this to work.
