RFR: 8324941: POC for Headless platform for JavaFX [v2]

Johan Vos jvos at openjdk.org
Mon Jun 23 07:47:38 UTC 2025


On Thu, 19 Jun 2025 22:18:48 GMT, Michael Strauß <mstrauss at openjdk.org> wrote:

>> Johan Vos has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Fix missing ;
>
> modules/javafx.graphics/src/main/java/com/sun/glass/ui/headless/HeadlessApplication.java line 173:
> 
>> 171: 
>> 172:     @Override
>> 173:     protected CommonDialogs.FileChooserResult staticCommonDialogs_showFileChooser(Window owner, String folder, String filename, String title, int type, boolean multipleMode, CommonDialogs.ExtensionFilter[] extensionFilters, int defaultFilterIndex) {
> 
> This is an extremely long line...

changed to the same format as com.sun.glass.ui.Application

> modules/javafx.graphics/src/main/java/com/sun/glass/ui/headless/HeadlessRobot.java line 63:
> 
>> 61:                 view.notifyKey(KeyEvent.TYPED, 0, keyval, mods);
>> 62:             }
>> 63: 
> 
> Minor: empty line

fixed

> modules/javafx.graphics/src/main/java/com/sun/glass/ui/headless/HeadlessRobot.java line 390:
> 
>> 388:         if (this.specialKeys.keyShift) answer = answer | KeyEvent.MODIFIER_SHIFT;
>> 389:         if (this.specialKeys.keyCommand) answer = answer | KeyEvent.MODIFIER_COMMAND;
>> 390:         if (this.specialKeys.keyAlt) answer = answer | KeyEvent.MODIFIER_ALT;
> 
> You can remove four utterances of the word "answer" by using the `|=` operator.

done

> modules/javafx.graphics/src/main/java/com/sun/glass/ui/headless/HeadlessWindow.java line 294:
> 
>> 292:     private void notifyResizeAndMove(int x, int y, int width, int height) {
>> 293:         HeadlessView view = (HeadlessView) getView();
>> 294:         //   if (getWidth() != width || getHeight() != height) {
> 
> Why is this code commented out?

There was a failing test, so it turns out there is an implicit contract that even if a resize is requested without different w/h parameters, at least the even should still be generated.

> modules/javafx.graphics/src/main/java/com/sun/glass/ui/headless/HeadlessWindow.java line 306:
> 
>> 304: 
>> 305:     public Color getColor(int lx, int ly) {
>> 306:         int mx = lx;// + getX();
> 
> Why is this code commented out?

the lx/ly coordinates are already expected to be taking into account the window X/Y

-------------

PR Review Comment: https://git.openjdk.org/jfx/pull/1836#discussion_r2160931952
PR Review Comment: https://git.openjdk.org/jfx/pull/1836#discussion_r2160932234
PR Review Comment: https://git.openjdk.org/jfx/pull/1836#discussion_r2160932090
PR Review Comment: https://git.openjdk.org/jfx/pull/1836#discussion_r2160935313
PR Review Comment: https://git.openjdk.org/jfx/pull/1836#discussion_r2160937014


More information about the openjfx-dev mailing list