>> The only reason I left it in there was for the AWT_TOOLKIT environment >> variable support. Right now if you set AWT_TOOLKIT to HToolkit it will start >> in headless mode regardless of what isAquaSession() returns. If we don't >> care about that then I'll happily remove it (I'm asking because I don't know >> if it's used or not). >> >> For example: >> $ AWT_TOOLKIT=HToolkit >> ./build/macosx-x86_64-normal-server-release/jdk/bin/java -jar >> ~/Desktop/SwingSet2.jar >> 2013-10-23 09:26:21.726 java[23276:707] [JRSAppKitAWT markAppIsDaemon]: >> Process manager already initialized: can't fully enable headless mode. >> Exception in thread "main" java.awt.HeadlessException >> at >> sun.java2d.HeadlessGraphicsEnvironment.getDefaultScreenDevice(HeadlessGraphicsEnvironment.java:77) >> at SwingSet2.main(SwingSet2.java:224) >> >> But it's *only* implemented on Mac OS X so it doesn't appear to be all that >> useful unless we want it implemented for other platforms, which would be a >> whole separate issue. > > There's a documented way to choose a toolkit: it is the awt.toolkit system > property. > > We don't care about AWT_TOOLKIT anymore. It was only relevant at the time of > 1.5 and 1.6 to allow users to switch between MToolkit and XToolkit. Now that > MToolkit is gone, this environment variable isn't needed.
Ah, ok. That makes sense. In that case we can nuke most of what I just put back :) >> Another option (I think would make everyone happy) would be to add a native >> method to LWCToolkit.{java,m} that implements isAquaSession and returns a >> boolean. Call this new method in the static initializer and use it's return >> value to set java.awt.headless before calling initIDs. This will still be >> done early enough that Toolkit.java will end up wrapping LWCToolkit in a >> HeadlessToolkit, since it first initializes the wrapped toolkit *then* >> checks to see if it needs to be wrapped. Then all that code in java_props* >> and System.c could be removed. > > I like this idea. But it needs testing. Cool, I'll poke at it when I get a chance. -DrD-