<AWT Dev> [14] Review Request: 8231438 [macos] The dark mode is not supported yet

Alan Snyder javalists at cbfiddle.com
Fri Sep 27 15:29:17 UTC 2019


I would say that a public switch is necessary and therefore must be possible.

It would be presumptuous for the JDK to assume that all Java desktop applications on macOS use AWT/Swing, much less a particular Swing LAF, and therefore incorrect to impose the limitations of AWT/Swing/Aqua LAF on all Java programs on macOS.

By the way, I tried to get Apple to make the dark mode opt-in configurable in the command line case, but they were not convinced.

I also filed a bug with Apple to support dark mode in JRS, but nothing happened.

Maybe Oracle has more leverage with Apple than I have? One can hope.

  Alan



> On Sep 26, 2019, at 11:32 PM, Sergey Bylokhov <Sergey.Bylokhov at oracle.com> wrote:
> 
> Not sure that it will be possible to make a "public" switch to disable/enable this feature,
> because both options have to be officially supported and pass all related tests.
> I need to double-check this.
> 
> On 9/26/19 11:00 pm, Alan Snyder wrote:
>> No, it works on a modified JDK 12 whose linked SDK version is 10.14 (or as a bundled app with NSRequiresAquaSystemAppearance = NO).
>>> On Sep 26, 2019, at 10:52 PM, Sergey Bylokhov <Sergey.Bylokhov at oracle.com> wrote:
>>> 
>>> On 9/26/19 6:17 pm, Alan Snyder wrote:
>>>> I have a LAF that supports dark mode, so I need this new behavior to be configurable. When using my LAF, the (user selected) default appearance should continue to be used.
>>> 
>>> I guess you L&F is working on jdk12? If yes then nothing will be changed for it.
>>> 
>>>>   Alan
>>>>> On Sep 26, 2019, at 5:38 PM, Sergey Bylokhov <Sergey.Bylokhov at oracle.com> wrote:
>>>>> 
>>>>> Hello.
>>>>> Please review the fix for JDK 14.
>>>>> 
>>>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8231438
>>>>> Fix: http://cr.openjdk.java.net/~serb/8231438/webrev.01
>>>>> 
>>>>> In jdk13 we started to use SDK 10.14 to build JDK, which automatically opt-in support of dark mode:
>>>>> --------------
>>>>> "The system assumes that apps linked against the macOS 10.14 or later SDK support both light and dark appearances"
>>>>> https://developer.apple.com/documentation/appkit/nsappearancecustomization/choosing_a_specific_appearance_for_your_macos_app?language=objc
>>>>> --------------
>>>>> 
>>>>> Unfortunately we dark mode still unsupported by the AWT/Swing, because of:
>>>>> - JavaRuntimeSupport Framework which is used by the Aqua L&F to draw the "native"
>>>>>   appearance does not provide "dark mode" appearance, the bug is filed to Apple.
>>>>>   https://bugs.openjdk.java.net/browse/JDK-8228555
>>>>> - In a few places, we mix the "native" colors used by the system and default colors
>>>>>   used by the Swing. For example, we may use a transparent white selection "native"
>>>>>   color which is invisible on top of white text fields.
>>>>> 
>>>>> While the bugs above are not fixed we may opt-out the dark mode:
>>>>> -------------
>>>>> Supporting Dark Mode is strongly encouraged. Use the NSRequiresAquaSystemAppearance key to opt out temporarily only while you work on improvements to your app's Dark Mode support. If you do not plan to support a dark appearance at all, apply a light appearance to your entire app, as described in Assign a Specific Appearance to Your App.
>>>>> https://developer.apple.com/documentation/appkit/nsappearancecustomization/choosing_a_specific_appearance_for_your_macos_app?language=objc
>>>>> -------------
>>>>> 
>>>>> I tried to disable it via plist.info but it does not work for "java -jar" case, so I disabled it in the code
>>>>> Some constants in one test were updated to work on dark and light mode, but an updated test still reproduce the initial bug.
>>>>> 
>>>>> 
>>>>> -- 
>>>>> Best regards, Sergey.
>>>>> 
>>> 
>>> 
>>> -- 
>>> Best regards, Sergey.
>>> 
> 
> 
> -- 
> Best regards, Sergey.
> 



More information about the awt-dev mailing list