I believe your solution works, but shouldn’t you obey 
NSRequiresAquaSystemAppearance = NO if that appears in the Info.plist?

I have no problem with this system property becoming a no-op (at least when the 
value is “system”) in a future release where your bug fix is no longer present.

  Alan

> On Oct 8, 2019, at 6:35 PM, Sergey Bylokhov <sergey.bylok...@oracle.com> 
> wrote:
> 
> On 9/27/19 8:29 am, Alan Snyder wrote:
>> 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.
> 
> The AWT/Swing/Aqua LAF is a part of java.desktop and part of javase,
> so even one tck bug in any place of it will affect the whole jdk. This is
> the reason why dark mode will be marked as unsupported in the upcoming release
> and light mode will be used by default.
> For convenience in the new version I added some options to disable this fix, 
> or
> force some specific mode.
> 
> http://cr.openjdk.java.net/~serb/8231438/webrev.02 
> <http://cr.openjdk.java.net/~serb/8231438/webrev.02>
> 
> Note that the behavior of the option might be changed in the future release, 
> or it might
> be removed completely. But I assume it will work till we realize how to 
> support
> light and dark mode, and switch between them at runtime.
> 
> CSR will be created after technical review.
> 
>> 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.bylok...@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.bylok...@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.bylok...@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.
>>> 
> 
> 
> -- 
> Best regards, Sergey.

Reply via email to