On Mon, 31 May 2021 14:05:51 GMT, Tejpal Rebari <treb...@openjdk.org> wrote:

>> Hi All,
>> Please review the following fix for jdk17.
>> 
>> Issue : On MacOS 11 Java Frame and JDialog application is freezing  in Full 
>> Screen  when the System Preference -> General -> Prefer Tabs is set to "Full 
>> Screen". It is also freezing in normal screen when Prefer Tabs is set to 
>> "Always".
>> It doesn't freeze when the Prefer tabs is set to "never".
>> 
>> Fix : The default value of allowsAutomaticWindowTabbing is 0/NO in MacOS 
>> prior to bigSur(11)  
>> (in the AWTWindow.m file),  so the issue is not seen in mac os 10.13 10.14 
>> and 10.15.
>> From MacOS 11 onwards  this value is set to 1/YES and the issue is seen.
>> This issue can also be reproduced in MacOS 10.15 by setting 
>> setAllowsAutomaticWindowTabbing to true in the AWTWindow.m file.
>> 
>> Fix is to set allowsAutomaticWindowTabbing to No for all the MacOS release 
>> staring from 10.12.
>> The allowsAutomaticTabbing was introduced in MacOS 10.12 but the default 
>> value changed in macos11.
>> 
>> Test : Added a manual test and tested on MacOS 10.15 and 11.
>> All the internal tests run are green.
>
> Tejpal Rebari has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   updated the comment

The fix looks fine, although you need to merge in the latest changes from the 
jdk master and add the now-required annotation to ignore the security manager 
deprecation warning (else it will fail to compile). I left a couple comments on 
the test as well.

src/java.desktop/macosx/classes/sun/lwawt/macosx/CPlatformWindow.java line 132:

> 130:     // This system property is named as jdk.* because it is not specific 
> to AWT
> 131:     // and it is also used in JavaFX
> 132:     public static final String MAC_OS_TABBED_WINDOW = 
> AccessController.doPrivileged(

Now that the fix for JEP 411 (security manager deprecation) is integrated, you 
will need to add the following annotation to this field, else it will fail to 
compile:


    @SuppressWarnings("removal")

test/jdk/java/awt/Window/TestAppFreeze.java line 64:

> 62:     private static void createInstructionUI() {
> 63:         SwingUtilities.invokeLater(() -> {
> 64:             String instruction = "1. This test is only for Mac OS Version 
> 11 " +

This bug also affects macOS 10.15. On 10.15 the "Prefer Tabs" setting in the 
`System Preferences -> Dock` rather than `-> General`.

test/jdk/java/awt/Window/TestAppFreeze.java line 107:

> 105:     private static void testApp() {
> 106:         testFrame = new JFrame("TestFrame");
> 107:         testFrame.setBounds(600,0,1000,200);

Minor: add spaces after the commas.

test/jdk/java/awt/Window/TestAppFreeze.java line 110:

> 108:         testFrame.getContentPane().add(new JButton(new 
> AbstractAction("Click") {
> 109:             @Override
> 110:             public void actionPerformed(ActionEvent e) {

Minor: you can use a lambda here if you like.

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

Changes requested by kcr (Author).

PR: https://git.openjdk.java.net/jdk/pull/3407

Reply via email to