RFR: 8364687: Enable headless with -Dglass.platform=headless [v2]

Clément de Tastes duke at openjdk.org
Wed Aug 6 21:11:23 UTC 2025


On Tue, 5 Aug 2025 11:45:50 GMT, Clément de Tastes <duke at openjdk.org> wrote:

>> Basically allow -Dglass.platform=headless to enable headless, not only -Dglass.platform=Headless.
>> This makes it consistent with other options (macosx, windows, linux, gtk and ios) as well was less error-prone for enabling it.
>
> Clément de Tastes has updated the pull request incrementally with one additional commit since the last revision:
> 
>   remove additional space

`com.sun.javafx.PlatformUtil::isHeadless` returns `true` for any case matching `"headless"`, which is not what i provided in my original suggestion.
So maybe we could reuse it :


            if (userPlatform != null) {
                if (userPlatform.equals("macosx"))
                    type = MAC;
                else if (userPlatform.equals("windows"))
                    type = WINDOWS;
                else if (userPlatform.equals("linux"))
                    type = GTK;
                else if (userPlatform.equals("gtk"))
                    type = GTK;
                else if (userPlatform.equals("ios"))
                    type = IOS;
                else
                    if (PlatformUtil.isHeadless())
                        type = HEADLESS
                    else
                        type = userPlatform;
                return type;
            }


Makes the code a bit clumsy to me, but has the benefit of reusing logic.

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

PR Comment: https://git.openjdk.org/jfx/pull/1864#issuecomment-3161620246


More information about the openjfx-dev mailing list