Relates :
|
|
Relates :
|
There is a variable awt_headless in the native system props structure used to populate system properties. This was added relatively recently in bringing in the MacOS port. Specifically it was added by this fix : https://bugs.openjdk.java.net/browse/JDK-8025673 Reviewed here : https://mail.openjdk.java.net/pipermail/awt-dev/2013-October/006114.html Where since the fix was removing some macos specific code to select the toolkit class, it probably didn't unreasonable to be setting this property as a better alternative I think this email https://mail.openjdk.java.net/pipermail/awt-dev/2013-October/006132.html started the discussion that lead to the result and conclusion we needed to use the IsInAquaSession check to make sure we don't try to launch in headful mode if we can't. Since then we've had another fix : https://bugs.openjdk.java.net/browse/JDK-8208702 https://mail.openjdk.java.net/pipermail/awt-dev/2018-October/014534.html which copied the isInAquaSession() code into the desktop module. I think it should be possible to figure out entirely in the desktop module code if we want to default to a headless session, as we already do for X11. See java/awt/GraphicsEnvironment.java's getHeadlessProperty() method. Is it as simple as calling isInAquaSession() for the macos case there ? Then that launcher code can be removed. Can getHeadlessProperty() be refactored so we don't have all the platform knowledge there? Since you don't want to instantiate the platform classes of GE we'd have to create some small helper class per-platform to give the answer. It might not have been worth it before, but maybe is if we want to call MacOS native code on MacOS ..