FW: suggestions to improve AWT (mostly Linux related)

Sjoerd Brauer Sjoerd.Brauer at flex.com
Wed Jan 13 08:56:04 UTC 2021



From: Sjoerd Brauer
Sent: woensdag 13 januari 2021 09:54
To: 'quality-discuss at openjdk.java.net' <quality-discuss at openjdk.java.net>
Subject: suggestions to improve AWT (mostly Linux related)

Dear all,

I've been working with a Raspbian CLI environment for a while and notice some unexpected behavior from AWT.Robot.
Java registers the Raspbian CLI as a headless environment even though it can be accessed directly through a keyboard and mouse (I did as well).
When fooling the java environment by setting the headless property to false it throws X11 errors because it relies on an X server to do the IO stuff.

This is the part where I believe AWT can be improved.
Yes I understand AWT exists for creating a GUI and CLI is not considered a GUI.
Yes I understand and agree that because using a CLI some AWT related stuff should not work.
Even though this is the case there already exists some exceptions of using AWT in a headless environment as described by Oracle:
https://www.oracle.com/technical-resources/articles/javase/headless.html (I'm assuming OpenJDK shares this behavior but I didn't test this).

I suggest the following improvements to the AWT.

  *   Don't make IO simulation classes like AWT.Robot rely on the X-Server but make it work directly on the OS IO system.
     *   https://pypi.org/project/keyboard/ is a great example on how you could do this (albeit written in python).
  *   Separate the headless exception into headless and a new CLIEnvironment exception.

Because the AWT is part of the Java Foundation Classes I'm writing this to you.

Hopefully you find my feedback useful.

Kind regards,

Sjoerd Brauer


Legal Disclaimer :
The information contained in this message may be privileged and confidential. 
It is intended to be read only by the individual or entity to whom it is addressed 
or by their designee. If the reader of this message is not the intended recipient, 
you are on notice that any distribution of this message, in any form, 
is strictly prohibited. If you have received this message in error, 
please immediately notify the sender and delete or destroy any copy of this message!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/quality-discuss/attachments/20210113/5e13735e/attachment.htm>


More information about the quality-discuss mailing list